-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAssetDetails2.aspx.cs
52 lines (51 loc) · 1.76 KB
/
AssetDetails2.aspx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class AssetDetails2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Session["AID"] != null) // sessions to remember the asset for state management
{
lblAID.Text = Convert.ToString(Session["AID"]);
}
else
{
Response.Redirect("AssetDetails.aspx");
}
}
protected void btnSave_Click(object sender, EventArgs e)
{
AssetTaggingEntities context = new AssetTaggingEntities();
LUT_Assets_Masters am = new LUT_Assets_Masters() { };
int aid = Convert.ToInt32(lblAID.Text); // this is for checking if it is in db if not then should redirect itself to first data page
var result = (from a in context.LUT_Assets_Masters where a.AID == aid select a).FirstOrDefault();
if (result != null)
{
am.Warranty = YesW.Checked;
am.QR = YesQ.Checked;
am.PM = YesP.Checked;
am.NFC = YesN.Checked;
am.GPS = YesG.Checked;
am.Camera = YesC.Checked;
am.Barcode = YesB.Checked;
am.AMC = YesA.Checked;
am.RFID = YesR.Checked;
am.Maintenance = YesM.Checked;
context.LUT_Assets_Masters.Add(am);
context.SaveChanges();
Response.Redirect("AssetDetils2.aspx");
}
else
{
Response.Redirect("AssetDetils.aspx");
}
}
protected void btnBack_Click(object sender, EventArgs e)
{
Response.Redirect("AssetDetails.aspx");
}
}