protected void BindListBox() { txtContractName.Text = Session["contractname"].ToString(); txtdesc.Text = Session["description"].ToString(); drpVendor.SelectedValue = Session["vendorid"].ToString(); Asset_mst ObjAsset = new Asset_mst(); BLLCollection<Asset_mst> col = new BLLCollection<Asset_mst>(); string varAsset = Session["AssetContract"].ToString(); string[] arrAsset = varAsset.Split(','); int FlagCount = arrAsset.Length; for (int i = 0; i < FlagCount; i++) { if (arrAsset[i] != "," && arrAsset[i]!="") { Asset_mst obj = new Asset_mst(); obj = ObjAsset.Get_By_id(Convert.ToInt16(arrAsset[i].ToString())); col.Add(obj); } } ListAsset.DataTextField = "computerName"; ListAsset.DataValueField = "assetid"; ListAsset.DataSource = col; ListAsset.DataBind(); Session["AssetContract"] = ""; }
protected void BindListBox() { int contractid = Convert.ToInt32(Request.QueryString[0]); Asset_mst ObjAsset = new Asset_mst(); BLLCollection <Asset_mst> col = new BLLCollection <Asset_mst>(); string varAsset = Session["AssetContract"].ToString(); string[] arrAsset = varAsset.Split(','); int FlagCount = arrAsset.Length; for (int i = 0; i < FlagCount; i++) { if (arrAsset[i] != "," && arrAsset[i] != "") { ContractToAssetMapping objCoAsset = new ContractToAssetMapping(); ListItem item = new ListItem(); int flagcount; Asset_mst obj = new Asset_mst(); obj = ObjAsset.Get_By_id(Convert.ToInt32(arrAsset[i].ToString())); flagcount = objCoAsset.Get_by_Contractid_Assetid(contractid, Convert.ToInt32(arrAsset[i].ToString())); if (flagcount == 0) { item.Text = obj.Computername; item.Value = Convert.ToString(obj.Assetid); ListAsset.Items.Add(item); } } } }
protected void BindListBox() { drpCategory.SelectedValue = Session["Categoryid"].ToString(); drpSubcategory.SelectedValue = Session["Subcategoryid"].ToString(); drpTechnician.SelectedValue = Session["Technician"].ToString(); txtTitle.Text = Session["Title"].ToString(); drpchangetype.SelectedValue = Session["Changetype"].ToString(); Asset_mst ObjAsset = new Asset_mst(); BLLCollection <Asset_mst> col = new BLLCollection <Asset_mst>(); string varAsset = Session["AssetContract"].ToString(); string[] arrAsset = varAsset.Split(','); int FlagCount = arrAsset.Length; for (int i = 0; i < FlagCount; i++) { if (arrAsset[i] != "," && arrAsset[i] != "") { Asset_mst obj = new Asset_mst(); obj = ObjAsset.Get_By_id(Convert.ToInt32(arrAsset[i].ToString())); col.Add(obj); } } ListAsset.DataTextField = "computerName"; ListAsset.DataValueField = "assetid"; ListAsset.DataSource = col; ListAsset.DataBind(); for (int i = ListAsset.Items.Count - 1; i >= 0; i--) { ListAsset.Items[i].Selected = true; } Session["AssetContract"] = ""; }
protected void IncidentToAsset(int userid) { objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(txtUsername.Text.Trim().ToString().Trim(), objOrganization.Orgid); userid = Convert.ToInt16(objUser.Userid); assetid = Convert.ToInt16(objusertoasset.Get_AssetId_By_UserId(userid)); objassetmst = objassetmst.Get_By_id(assetid); compname = objassetmst.Computername; }
protected void BindContractData() { int contractid = Convert.ToInt32(Request.QueryString[0]); objContract = objContract.Get_By_id(contractid); if (objContract != null) { txtContractName.Text = objContract.Contractname + " " + "Renewed"; txtdesc.Text = objContract.Description; drpVendor.SelectedValue = Convert.ToString(objContract.Vendorid); colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid); foreach (ContractToAssetMapping obj in colContractToAssetMapping) { Asset_mst objA = new Asset_mst(); objA = objA.Get_By_id(obj.Assetid); colAsset.Add(objA); } ListAsset.DataTextField = "computername"; ListAsset.DataValueField = "Assetid"; ListAsset.DataSource = colAsset; ListAsset.DataBind(); } objContractNotfy = objContractNotfy.Get_By_id(contractid); if (objContractNotfy.Contractid != 0) { EscalateEmail_mst objEscalateEmail = new EscalateEmail_mst(); chkLevel1.Checked = true; txtBeforeDays.Text = objContractNotfy.Beforedays.ToString(); string varEmail = objContractNotfy.Sentto; string[] arrEmail = varEmail.Split((",").ToCharArray()); for (int i = 0; i < arrEmail.Length - 1; i++) { if (arrEmail[i] != "," && arrEmail[i] != " ") { objEscalateEmail = objEscalateEmail.Get_By_Emailid(arrEmail[i]); for (int j = listLevel1.Items.Count - 1; j >= 0; j--) { if (Convert.ToInt32(listLevel1.Items[j].Value) == objEscalateEmail.Id) { listLevel1.Items[j].Selected = true; } } } } } }
protected void BindContractData() { int contractid = Convert.ToInt16(Request.QueryString[0]); objContract = objContract.Get_By_id(contractid); if (objContract != null) { txtContractName.Text = objContract.Contractname + " " + "Renewed"; txtdesc.Text = objContract.Description; drpVendor.SelectedValue = Convert.ToString(objContract.Vendorid); colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid); foreach (ContractToAssetMapping obj in colContractToAssetMapping) { Asset_mst objA = new Asset_mst(); objA = objA.Get_By_id(obj.Assetid); colAsset.Add(objA); } ListAsset.DataTextField = "computername"; ListAsset.DataValueField = "Assetid"; ListAsset.DataSource = colAsset; ListAsset.DataBind(); } objContractNotfy = objContractNotfy.Get_By_id(contractid); if (objContractNotfy.Contractid != 0) { EscalateEmail_mst objEscalateEmail = new EscalateEmail_mst(); chkLevel1.Checked = true; txtBeforeDays.Text = objContractNotfy.Beforedays.ToString(); string varEmail = objContractNotfy.Sentto; string[] arrEmail = varEmail.Split((",").ToCharArray()); for (int i = 0; i < arrEmail.Length - 1; i++) { if (arrEmail[i] != "," && arrEmail[i] != " ") { objEscalateEmail = objEscalateEmail.Get_By_Emailid(arrEmail[i]); for (int j = listLevel1.Items.Count - 1; j >= 0; j--) { if (Convert.ToInt16(listLevel1.Items[j].Value) == objEscalateEmail.Id) { listLevel1.Items[j].Selected = true; } } } } } }
protected void BindContract() { int contractid = Convert.ToInt16(Request.QueryString[0]); objContract = objContract.Get_By_id(contractid); if (objContract!=null ) { lblContractName.Text = objContract.Contractname; lblContractId.Text = objContract.Contractid.ToString(); lblActiveFrom.Text = objContract.Activefrom.ToString(); lblActiveTo.Text = objContract.Activeto.ToString(); objVendor = objVendor.Get_By_id(objContract.Vendorid); lblVendorname.Text = objVendor.Vendorname.ToString(); lblDesc.Text = objContract.Description.ToString(); colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid); foreach (ContractToAssetMapping obj in colContractToAssetMapping) { Asset_mst objA = new Asset_mst(); objA = objA.Get_By_id(obj.Assetid); colAsset.Add(objA); } grdvwViewAsset.DataSource = colAsset; grdvwViewAsset.DataBind(); } objConRenewed = objConRenewed.Get_By_id(contractid); if (objConRenewed.Contractid!=0) { lblRen.Visible = true; Contract_mst obj = new Contract_mst(); obj = obj.Get_By_id(objConRenewed.Contractid); lblRenInfo.Text = obj.Contractname; lblRenInfo.Visible = true; } objContractNotfy = objContractNotfy.Get_By_id(contractid); if (objContractNotfy.Contractid != 0) { lblUsers.Text = objContractNotfy.Sentto; lblDays.Text = Convert.ToString(objContractNotfy.Beforedays); } else { lblUsers.Text = "-"; lblDays.Text = "-"; } }
protected void btnAddAsset_Click(object sender, EventArgs e) { //Add Exception handilng try catch change by vishal 21-05-2012 try { foreach (GridViewRow gv in grdvwViewAsset.Rows) { string gvIDs; // Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec"); // If deleteChkBxItem is Checked then ,mapped Current site to this user if (deleteChkBxItem.Checked) { ListItem item = new ListItem(); int varSiteid; int FlagCheckAsset = 0; // Get the Site Id from variable of Label type declare in GridView of grdvwSite gvIDs = ((Label)gv.FindControl("assetid")).Text.ToString(); ObjAsset = ObjAsset.Get_By_id(Convert.ToInt32(gvIDs)); item.Text = ObjAsset.Computername; item.Value = Convert.ToString(ObjAsset.Assetid); for (int i = listAsset.Items.Count - 1; i >= 0; i--) { if (Convert.ToInt32(listAsset.Items[i].Value) == ObjAsset.Assetid) { FlagCheckAsset = 1; } } if (FlagCheckAsset == 0) { listAsset.Items.Add(item); } } } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void BindContract() { int contractid = Convert.ToInt16(Request.QueryString[0]); objContract = objContract.Get_By_id(contractid); if (objContract != null) { lblContractName.Text = objContract.Contractname; lblContractId.Text = objContract.Contractid.ToString(); lblActiveFrom.Text = objContract.Activefrom.ToString(); lblActiveTo.Text = objContract.Activeto.ToString(); objVendor = objVendor.Get_By_id(objContract.Vendorid); lblVendorname.Text = objVendor.Vendorname.ToString(); lblDesc.Text = objContract.Description.ToString(); colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid); foreach (ContractToAssetMapping obj in colContractToAssetMapping) { Asset_mst objA = new Asset_mst(); objA = objA.Get_By_id(obj.Assetid); colAsset.Add(objA); } grdvwViewAsset.DataSource = colAsset; grdvwViewAsset.DataBind(); } objConRenewed = objConRenewed.Get_By_id(contractid); if (objConRenewed.Contractid != 0) { lblRen.Visible = true; Contract_mst obj = new Contract_mst(); obj = obj.Get_By_id(objConRenewed.Contractid); lblRenInfo.Text = obj.Contractname; lblRenInfo.Visible = true; } objContractNotfy = objContractNotfy.Get_By_id(contractid); if (objContractNotfy.Contractid != 0) { lblUsers.Text = objContractNotfy.Sentto; lblDays.Text = Convert.ToString(objContractNotfy.Beforedays); } else { lblUsers.Text = "-"; lblDays.Text = "-"; } }
protected void BindContractData() { int contractid = Convert.ToInt32(Request.QueryString[0]); objContract = objContract.Get_By_id(contractid); if (objContract != null) { string dd; string mm; string yy; txtContractName.Text = objContract.Contractname; txtdesc.Text = objContract.Description.ToString(); string[] tempdate = objContract.Activefrom.ToString().Split(("/").ToCharArray()); string StrData = tempdate[2].ToString(); string[] temp1 = StrData.Split((" ").ToCharArray()); if (Convert.ToInt32(tempdate[1]) < 10) { dd = "0" + tempdate[1]; } else { dd = tempdate[1]; } if (Convert.ToInt32(tempdate[0]) < 10) { mm = "0" + tempdate[0]; } else { mm = tempdate[0]; } string vardateFrom = dd + "/" + mm + "/" + temp1[0]; txtActiveFrom.Text = vardateFrom; string[] tempdate1 = objContract.Activeto.ToString().Split(("/").ToCharArray()); string StrData1 = tempdate1[2].ToString(); string[] temp2 = StrData1.Split((" ").ToCharArray()); if (Convert.ToInt32(tempdate1[1]) < 10) { dd = "0" + tempdate1[1]; } else { dd = tempdate1[1]; } if (Convert.ToInt32(tempdate1[0]) < 10) { mm = "0" + tempdate1[0]; } else { mm = tempdate1[0]; } string vardateTo = dd + "/" + mm + "/" + temp2[0]; txtActiveTo.Text = vardateTo; drpVendor.SelectedValue = Convert.ToString(objContract.Vendorid); colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid); foreach (ContractToAssetMapping obj in colContractToAssetMapping) { Asset_mst objA = new Asset_mst(); objA = objA.Get_By_id(obj.Assetid); colAsset.Add(objA); } ListAsset.DataTextField = "computername"; ListAsset.DataValueField = "Assetid"; ListAsset.DataSource = colAsset; ListAsset.DataBind(); } objContractNotfy = objContractNotfy.Get_By_id(contractid); if (objContractNotfy.Contractid != 0) { EscalateEmail_mst objEscalateEmail = new EscalateEmail_mst(); chkLevel1.Checked = true; txtBeforeDays.Text = objContractNotfy.Beforedays.ToString(); string varEmail = objContractNotfy.Sentto; string[] arrEmail = varEmail.Split((",").ToCharArray()); for (int i = 0; i < arrEmail.Length - 1; i++) { if (arrEmail[i] != "," && arrEmail[i] != " ") { objEscalateEmail = objEscalateEmail.Get_By_Emailid(arrEmail[i]); for (int j = listLevel1.Items.Count - 1; j >= 0; j--) { if (Convert.ToInt32(listLevel1.Items[j].Value) == objEscalateEmail.Id) { listLevel1.Items[j].Selected = true; } } } } } }
protected void BindListBox() { int contractid = Convert.ToInt32(Request.QueryString[0]); Asset_mst ObjAsset = new Asset_mst(); BLLCollection<Asset_mst> col = new BLLCollection<Asset_mst>(); string varAsset = Session["AssetContract"].ToString(); string[] arrAsset = varAsset.Split(','); int FlagCount = arrAsset.Length; for (int i = 0; i < FlagCount; i++) { if (arrAsset[i] != "," && arrAsset[i] != "") { ContractToAssetMapping objCoAsset = new ContractToAssetMapping(); ListItem item = new ListItem(); int flagcount; Asset_mst obj = new Asset_mst(); obj = ObjAsset.Get_By_id(Convert.ToInt32(arrAsset[i].ToString())); flagcount = objCoAsset.Get_by_Contractid_Assetid(contractid, Convert.ToInt32(arrAsset[i].ToString())); if (flagcount == 0) { item.Text = obj.Computername; item.Value = Convert.ToString(obj.Assetid); ListAsset.Items.Add(item); } } } }
protected void btnMapped_Click(object sender, EventArgs e) { //lblErrorMsg.Text = ""; int flag = 0; int tempuser; tempuser = Convert.ToInt16(Session["tempuser"]); foreach (GridViewRow gv in grdvwViewAsset.Rows) { string gvIDs; RadioButton selectonebutton = (RadioButton)gv.FindControl("selectone"); if (selectonebutton.Checked) { flag = 1; int assetid; gvIDs = ((Label)gv.FindControl("lblAssetID")).Text.ToString(); assetid = Convert.ToInt16(gvIDs); string Username = lblusername.Text.ToString().Trim(); objUser = objUser.Get_UserLogin_By_UserName_Like(Username); userid = objUser.Userid; if (lblusername.Text == "") { //lblErrorMsg.Text = "Enter the user name for mapped a particular Asset"; break; } else if (tempuser == 1) { assetcount = objusertoasset.Get_AssetId_From_UserToAssetMap(assetid); int tempuser1 = 0; if (assetcount == 0) { int flag1 = 1; ObjAsset = ObjAsset.Get_By_id(assetid); string compname = ObjAsset.Computername.ToString(); string username = lblusername.Text.ToString(); Session["compname"] = compname; Session["flag"] = flag1; Session["username"] = username; Session["assetid"] = assetid; Session["userid"] = userid; tempuser1 = 1; Session["tempuser1"] = tempuser1; Session["flag1"] = flag1; break; } else { //lblErrorMsg.Text = "Asset already mapped"; break; } } else if (userid == 0) { //lblErrorMsg.Text = "User Name doen not exist"; break; } else { assetcount = objusertoasset.Get_AssetId_From_UserToAssetMap(assetid); usercount = objusertoasset.Get_UserId_From_UserToAssetMap(userid); if (assetcount == 0) { if (usercount == 0) { int flag1 = 1; objusertoasset.Insert(userid, assetid); //lblErrorMsg.Text = "Mapped Succussfully"; ObjAsset = ObjAsset.Get_By_id(assetid); string compname = ObjAsset.Computername.ToString(); string username = lblusername.Text.ToString(); Session["compname"] = compname; Session["flag"] = flag1; Session["username"] = username; Session["assetid"] = assetid; Session["userid"] = userid; Session["flag1"] = flag1; break; } else //Update Asset id from UserToAsset table. { int flag1 = 1; int oldassetid = Convert.ToInt16(Session["assignassetid"]); objusertoasset.Update_Assetid(oldassetid, assetid); ObjAsset = ObjAsset.Get_By_id(assetid); string compname = ObjAsset.Computername.ToString(); string username = lblusername.Text.ToString(); Session["compname"] = compname; Session["flag"] = flag1; Session["username"] = username; Session["assetid"] = assetid; Session["userid"] = userid; Session["flag1"] = flag1; break; } } else { //lblErrorMsg.Text = "Asset already mapped"; break; } } } } if (flag == 0) { //lblErrorMsg.Text = "Select Asset for mapping"; } string myScript; myScript = "<script language=javascript>javascript:refreshParent(); javascript:window.close();</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); }
protected void BindListBox() { drpCategory.SelectedValue = Session["Categoryid"].ToString(); drpSubcategory.SelectedValue = Session["Subcategoryid"].ToString(); drpTechnician.SelectedValue = Session["Technician"].ToString(); txtTitle.Text = Session["Title"].ToString(); drpchangetype.SelectedValue = Session["Changetype"].ToString(); Asset_mst ObjAsset = new Asset_mst(); BLLCollection<Asset_mst> col = new BLLCollection<Asset_mst>(); string varAsset = Session["AssetContract"].ToString(); string[] arrAsset = varAsset.Split(','); int FlagCount = arrAsset.Length; for (int i = 0; i < FlagCount; i++) { if (arrAsset[i] != "," && arrAsset[i] != "") { Asset_mst obj = new Asset_mst(); obj = ObjAsset.Get_By_id(Convert.ToInt32(arrAsset[i].ToString())); col.Add(obj); } } ListAsset.DataTextField = "computerName"; ListAsset.DataValueField = "assetid"; ListAsset.DataSource = col; ListAsset.DataBind(); for (int i = ListAsset.Items.Count - 1; i >= 0; i--) { ListAsset.Items[i].Selected = true; } Session["AssetContract"] = ""; }
//////////////////////////////////////////////////////////////////meenakshi //protected void btnMapped_Click(object sender, EventArgs e) //{/////Add Exception handilng try catch change by vishal 21-05-2012 // try // { // //lblErrorMsg.Text = ""; // int flag = 0; // int tempuser; // tempuser = Convert.ToInt32(Session["tempuser"]); // foreach (GridViewRow gv in grdvwViewAsset.Rows) // { // string gvIDs; // RadioButton selectonebutton = (RadioButton)gv.FindControl("selectone"); // if (selectonebutton.Checked) // { // flag = 1; // int assetid; // gvIDs = ((Label)gv.FindControl("lblAssetID")).Text.ToString(); // assetid = Convert.ToInt32(gvIDs); // string Username = lblusername.Text.ToString().Trim(); // objUser = objUser.Get_UserLogin_By_UserName_Like(Username); // userid = objUser.Userid; // if (lblusername.Text == "") // { // //lblErrorMsg.Text = "Enter the user name for mapped a particular Asset"; // break; // } // else if (tempuser == 1) // { // assetcount = objusertoasset.Get_AssetId_From_UserToAssetMap(assetid); // int tempuser1 = 0; // if (assetcount == 0) // { // int flag1 = 1; // ObjAsset = ObjAsset.Get_By_id(assetid); // string compname = ObjAsset.Computername.ToString(); // string username = lblusername.Text.ToString(); // Session["compname"] = compname; // Session["flag"] = flag1; // Session["username"] = username; // Session["assetid"] = assetid; // Session["userid"] = userid; // tempuser1 = 1; // Session["tempuser1"] = tempuser1; // Session["flag1"] = flag1; // break; // } // else // { // //lblErrorMsg.Text = "Asset already mapped"; // break; // } // } // else if (userid == 0) // { // //lblErrorMsg.Text = "User Name doen not exist"; // break; // } // else // { // assetcount = objusertoasset.Get_AssetId_From_UserToAssetMap(assetid); // usercount = objusertoasset.Get_UserId_From_UserToAssetMap(userid); // // objcontactinfo = objcontactinfo.Get_By_id(userid); // objUser = objUser.Get_By_id(userid); // if (assetcount == 0) // { // if (usercount == 0) // { // int flag1 = 1; // objusertoasset.Insert(userid, assetid, objUser.City, objUser.Company); // //lblErrorMsg.Text = "Mapped Succussfully"; // ObjAsset = ObjAsset.Get_By_id(assetid); // string compname = ObjAsset.Computername.ToString(); // string username = lblusername.Text.ToString(); // Session["compname"] = compname; // Session["flag"] = flag1; // Session["username"] = username; // Session["assetid"] = assetid; // Session["userid"] = userid; // Session["flag1"] = flag1; // break; // } // else //Update Asset id from UserToAsset table. // { // int flag1 = 1; // int oldassetid = Convert.ToInt32(Session["assignassetid"]); // objusertoasset.Update_Assetid(oldassetid, assetid, objUser.City, objUser.Company); // ObjAsset = ObjAsset.Get_By_id(assetid); // string compname = ObjAsset.Computername.ToString(); // string username = lblusername.Text.ToString(); // Session["compname"] = compname; // Session["flag"] = flag1; // Session["username"] = username; // Session["assetid"] = assetid; // Session["userid"] = userid; // Session["flag1"] = flag1; // break; // } // } // else // { // //lblErrorMsg.Text = "Asset already mapped"; // break; // } // } // } // } // if (flag == 0) // { // //lblErrorMsg.Text = "Select Asset for mapping"; // } // string myScript; // myScript = "<script language=javascript>javascript:refreshParent(); javascript:window.close();</script>"; // Page.RegisterClientScriptBlock("MyScript", myScript); // } // catch (Exception ex) // string myScript; // myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; // Page.RegisterClientScriptBlock("MyScript", myScript); // return; // } // } protected void btnSelect_Click(object sender, EventArgs e) { try { int flag = 0; foreach (GridViewRow gv in grdvwViewAsset.Rows) { string gvIDs; RadioButton selectonebutton = (RadioButton)gv.FindControl("selectone"); if (selectonebutton.Checked) { flag = 1; int assetid; gvIDs = ((Label)gv.FindControl("lblAssetID")).Text.ToString(); assetid = Convert.ToInt32(gvIDs); Session["assId"] = assetid; int incidentid = Convert.ToInt32(Session["incidentid"]); colin = objintoass.Get_All(); //objintoass.incidentid=Convert.ToInt32(objintoass.Get_incidentId_From_incidentToAssetMap(incidentid)); int Count = Convert.ToInt32(objintoass.Get_incidentId_From_incidentToAssetMap(incidentid)); IncidentToAssetMapping objincass = new IncidentToAssetMapping(); if (incidentid != 0 && assetid != 0) { for (int i = 0; i < Count; i++) { string sQuery = ("update IncidentToAssetMapping set assetid='" + assetid + "' where incidentid='" + incidentid + "'"); string constr = System.Configuration.ConfigurationManager.ConnectionStrings["CSM_DB"].ToString(); SqlConnection sc = new SqlConnection(constr); sc.Open(); SqlCommand cmd = new SqlCommand(sQuery, sc); SqlDataReader dr = cmd.ExecuteReader(); dr.Read(); //ObjAsset = ObjAsset.Get_By_id(assetid); //string compname = ObjAsset.Computername.ToString(); //Session["compname"] = compname; //Session["flag"] = flag; } if (Count == 0) { objincass.Insert(incidentid, assetid); //ObjAsset = ObjAsset.Get_By_id(assetid); //string compname = ObjAsset.Computername.ToString(); //Session["compname"] = compname; //Session["flag"] = flag; break; } } ObjAsset = ObjAsset.Get_By_id(assetid); string compname = ObjAsset.Computername.ToString(); Session["compname"] = compname; Session["flag"] = flag; } } string myScript; myScript = "<script language=javascript>javascript:refreshParent(); javascript:window.close();</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void BindContractData() { int contractid = Convert.ToInt16(Request.QueryString[0]); objContract = objContract.Get_By_id(contractid); if (objContract != null) { string dd; string mm; string yy; txtContractName.Text = objContract.Contractname; txtdesc.Text = objContract.Description.ToString(); string[] tempdate = objContract.Activefrom.ToString().Split(("/").ToCharArray()); string StrData = tempdate[2].ToString(); string[] temp1 = StrData.Split((" ").ToCharArray()); if (Convert.ToInt16(tempdate[1]) < 10) { dd = "0" + tempdate[1]; } else { dd = tempdate[1]; } if (Convert.ToInt16(tempdate[0]) < 10) { mm = "0" + tempdate[0]; } else { mm = tempdate[0]; } string vardateFrom = dd + "/" + mm + "/" + temp1[0]; txtActiveFrom.Text = vardateFrom; string[] tempdate1 = objContract.Activeto.ToString().Split(("/").ToCharArray()); string StrData1 = tempdate1[2].ToString(); string[] temp2 = StrData1.Split((" ").ToCharArray()); if (Convert.ToInt16(tempdate1[1]) < 10) { dd = "0" + tempdate1[1]; } else { dd = tempdate1[1]; } if (Convert.ToInt16(tempdate1[0]) < 10) { mm = "0" + tempdate1[0]; } else { mm = tempdate1[0]; } string vardateTo = dd + "/" + mm + "/" + temp2[0]; txtActiveTo.Text = vardateTo; drpVendor.SelectedValue = Convert.ToString(objContract.Vendorid); colContractToAssetMapping = objContractToAsset.Get_All_By_contractid(objContract.Contractid); foreach (ContractToAssetMapping obj in colContractToAssetMapping) { Asset_mst objA = new Asset_mst(); objA = objA.Get_By_id(obj.Assetid); colAsset.Add(objA); } ListAsset.DataTextField = "computername"; ListAsset.DataValueField = "Assetid"; ListAsset.DataSource = colAsset; ListAsset.DataBind(); } objContractNotfy = objContractNotfy.Get_By_id(contractid); if (objContractNotfy.Contractid!=0) { EscalateEmail_mst objEscalateEmail = new EscalateEmail_mst(); chkLevel1.Checked = true; txtBeforeDays.Text = objContractNotfy.Beforedays.ToString(); string varEmail = objContractNotfy.Sentto; string[] arrEmail = varEmail.Split((",").ToCharArray()); for (int i = 0; i < arrEmail.Length - 1; i++) { if (arrEmail[i] != "," && arrEmail[i] != " ") { objEscalateEmail = objEscalateEmail.Get_By_Emailid(arrEmail[i]); for (int j = listLevel1.Items.Count - 1; j >= 0; j--) { if (Convert.ToInt16(listLevel1.Items[j].Value) == objEscalateEmail.Id) { listLevel1.Items[j].Selected = true; } } } } } }