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(); ObjConfigurationmst = ObjConfigurationmst.Get_By_id(Convert.ToInt32(gvIDs)); item.Text = ObjConfigurationmst.Serialno; item.Value = ObjConfigurationmst.Assetid.ToString(); for (int i = listAsset.Items.Count - 1; i >= 0; i--) { if (Convert.ToInt32(listAsset.Items[i].Value) == ObjConfigurationmst.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 btnAddAsset_Click(object sender, EventArgs e) { 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(); ObjConfigurationmst = ObjConfigurationmst.Get_By_id(Convert.ToInt16(gvIDs)); item.Text = ObjConfigurationmst.Serialno; item.Value = ObjConfigurationmst.Assetid.ToString(); for (int i = listAsset.Items.Count - 1; i >= 0; i--) { if (Convert.ToInt16(listAsset.Items[i].Value) == ObjConfigurationmst.Assetid) { FlagCheckAsset = 1; } } if (FlagCheckAsset == 0) { listAsset.Items.Add(item); } } } }
protected void BindListBox() { //drpCategory.SelectedValue=Session["Category"].ToString(); /// BindDropSubCategory(); drpSubcategory.SelectedValue = Session["Subcategory"].ToString(); drpchangetype.SelectedValue = Session["ChangeType"].ToString(); drpStatus.SelectedValue = Session["Status"].ToString(); // drpPriority.SelectedValue = Session["Priority"].ToString(); Configuration_mst ObjAsset = new Configuration_mst(); BLLCollection <Configuration_mst> col = new BLLCollection <Configuration_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] != "") { Configuration_mst obj = new Configuration_mst(); //obj = ObjAsset.Get_By_id(Convert.ToInt32(arrAsset[i].ToString())); obj = ObjAsset.Get_By_id(Convert.ToInt32(arrAsset[i].ToString())); col.Add(obj); } } ListAsset.DataTextField = "Serialno"; 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 showCMDBValues() { panalupdatecmdb.Visible = true; int Incidentidforchange = Convert.ToInt32(Session["Incidentidforchange"]); ObjIncidentochange = ObjIncidentochange.Get_By_Incidentid(Incidentidforchange); int changeid = Convert.ToInt32(ObjIncidentochange.Changeid); Objincludeasset = Objincludeasset.Get_By_Changeid(changeid); int Assetid = Convert.ToInt32(Objincludeasset.Assetid); ObjConfiguration = ObjConfiguration.Get_By_id(Assetid); int itemid = Convert.ToInt32(ObjConfiguration.Itemid); ObjConfigurableitem = ObjConfigurableitem.Get_By_id(itemid); ObjCMDB = ObjCMDB.Get_By_id(Assetid); Objchange = Objchange.Get_By_id(changeid); int categoryid = Convert.ToInt32(Objchange.Categoryid); Objcategory = Objcategory.Get_By_id(categoryid); if (categoryid != 0) { lblcategory.Text = Objcategory.CategoryName.ToString(); } int Subcategoryid = Convert.ToInt32(Objchange.Subcategoryid); Objsubcategory = Objsubcategory.Get_By_id(Subcategoryid); if (Subcategoryid != 0) { lblsubcategory.Text = Objsubcategory.Subcategoryname.ToString(); } lblassetid.Text = ObjConfiguration.Assetid.ToString(); int itemid1 = Convert.ToInt32(ObjConfiguration.Itemid); Objcategory = Objcategory.Get_By_id(itemid1); lblitemname.Text = Objcategory.CategoryName.ToString(); Objvendor = Objvendor.Get_By_id(ObjConfiguration.Vendorid); lblvendor.Text = Objvendor.Vendorname.ToString(); lblchangeid.Text = Objchange.Changeid.ToString(); lblserialno.Text = ObjConfiguration.Serialno.ToString(); int changetypid = Convert.ToInt32(Objchange.Changetype); Objchangetype = Objchangetype.Get_By_id(changetypid); lblchangetype.Text = Objchangetype.Changetypename.ToString(); lbltitle.Text = Objchange.Title.ToString(); if (ObjConfigurableitem.Param1 != "") { txtparam1.Visible = true; lblparam1.Text = ObjConfigurableitem.Param1.ToString(); txtparam1.Text = ObjCMDB.Param1.ToString(); } if (ObjConfigurableitem.Param2 != "") { txtparam2.Visible = true; lblparam2.Text = ObjConfigurableitem.Param2.ToString(); txtparam2.Text = ObjCMDB.Param2.ToString(); } if (ObjConfigurableitem.Param3 != "") { txtparam3.Visible = true; lblparam3.Text = ObjConfigurableitem.Param3.ToString(); txtparam3.Text = ObjCMDB.Param3.ToString(); } if (ObjConfigurableitem.Param4 != "") { txtparam4.Visible = true; lblparam4.Text = ObjConfigurableitem.Param4.ToString(); txtparam4.Text = ObjCMDB.Param4.ToString(); } if (ObjConfigurableitem.Param5 != "") { txtparam5.Visible = true; lblparam5.Text = ObjConfigurableitem.Param5.ToString(); txtparam5.Text = ObjCMDB.Param5.ToString(); } if (ObjConfigurableitem.Param6 != "") { txtparam6.Visible = true; lblparam6.Text = ObjConfigurableitem.Param6.ToString(); txtparam6.Text = ObjCMDB.Param6.ToString(); } if (ObjConfigurableitem.Param7 != "") { txtparam7.Visible = true; lblparam7.Text = ObjConfigurableitem.Param7.ToString(); txtparam7.Text = ObjCMDB.Param7.ToString(); } if (ObjConfigurableitem.Param8 != "") { txtparam8.Visible = true; lblparam8.Text = ObjConfigurableitem.Param8.ToString(); txtparam8.Text = ObjCMDB.Param8.ToString(); } if (ObjConfigurableitem.Param9 != "") { txtparam9.Visible = true; lblparam9.Text = ObjConfigurableitem.Param9.ToString(); txtparam9.Text = ObjCMDB.Param9.ToString(); } if (ObjConfigurableitem.Param10 != "") { txtparam10.Visible = true; lblparam10.Text = ObjConfigurableitem.Param10.ToString(); txtparam10.Text = ObjCMDB.Param10.ToString(); } }
protected void BindListBox() { //drpCategory.SelectedValue=Session["Category"].ToString(); /// BindDropSubCategory(); Configuration_mst ObjAsset = new Configuration_mst(); BLLCollection<Configuration_mst> col = new BLLCollection<Configuration_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] != "") { Configuration_mst obj = new Configuration_mst(); //obj = ObjAsset.Get_By_id(Convert.ToInt32(arrAsset[i].ToString())); obj = ObjAsset.Get_By_id(Convert.ToInt32(arrAsset[i].ToString())); col.Add(obj); } } ListAsset.DataTextField = "Serialno"; 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"] = ""; //drpSubcategory.SelectedValue = Session["Subcategory"].ToString(); //drpchangetype.SelectedValue = Session["ChangeType"].ToString(); //drpStatus.SelectedValue = Session["Status"].ToString(); }
protected void BindListBox() { Configuration_mst ObjAsset = new Configuration_mst(); BLLCollection<Configuration_mst> col = new BLLCollection<Configuration_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] != "") { Configuration_mst obj = new Configuration_mst(); obj = ObjAsset.Get_By_id(Convert.ToInt32(arrAsset[i].ToString())); col.Add(obj); } } lstassetupdate.DataTextField = "Serialno"; lstassetupdate.DataValueField = "assetid"; lstassetupdate.DataSource = col; lstassetupdate.DataBind(); for (int i = lstassetupdate.Items.Count - 1; i >= 0; i--) { lstassetupdate.Items[i].Selected = true; } Session["AssetContract"] = ""; panaleditchange.Visible = true; pan1.Visible = false; editpanal(); }
protected void Showchangeinfo() { Approvalpanal.Visible = true; btnApprove.Visible = true; btnReject.Visible = true; Alreadyapprovedpanal.Visible = false; NameValueCollection n = Request.QueryString; int changeid = Convert.ToInt32(Request.QueryString[0]); //lblchangeid.Text = changeid.ToString(); ObjChange = ObjChange.Get_By_id(changeid); lblchangeid.Text = ObjChange.Changeid.ToString(); lbltitle.Text = ObjChange.Title; lbldescription.Text = ObjChange.Description; //lblDateDisp.Text = ObjChange.Createdtime.ToString(); int requesterid = Convert.ToInt32(ObjChange.Requestedby); //lblTitle.Text = ObjChange.Title.ToString(); //lblDescription.Text = ObjChange.Description.ToString(); lblserviceeffected.Text = "Email"; int chantypeid = Convert.ToInt32(ObjChange.Changetype); ObjChangeType = ObjChangeType.Get_By_id(chantypeid); if (chantypeid != 0) { lblchangetype.Text = ObjChangeType.Changetypename.ToString(); } int changestatus = Convert.ToInt32(ObjChange.Statusid); Objchangestatus = Objchangestatus.Get_By_id(changestatus); if (changestatus != 0) { lblStatus.Text = Objchangestatus.Statusname; } int priorityid = Convert.ToInt32(ObjChange.Priority); ObjPriority = ObjPriority.Get_By_id(priorityid); if (priorityid != 0) { lblpriority.Text = ObjPriority.Name.ToString(); } else { lblpriority.Text = ""; } int category = Convert.ToInt32(ObjChange.Categoryid); ObjCategory = ObjCategory.Get_By_id(category); if (category != 0) { lblcategory.Text = ObjCategory.CategoryName.ToString(); } else { lblcategory.Text = ""; } int subcategory = Convert.ToInt32(ObjChange.Subcategoryid); Objsubcategory = Objsubcategory.Get_By_id(subcategory); if (subcategory != 0) { lblsubcategory.Text = Objsubcategory.Subcategoryname.ToString(); } else { lblsubcategory.Text = ""; } int creator = Convert.ToInt32(ObjChange.CreatedByID); ObjUser = ObjUser.Get_By_id(creator); lblCreatedby.Text = ObjUser.Username.ToString(); lblCreatedDate.Text = ObjChange.Createdtime.ToString(); int techid = Convert.ToInt32(ObjChange.Technician); ObjUser = ObjUser.Get_By_id(techid); if (techid != 0) { lbltechid.Text = ObjUser.Username.ToString(); } else { lbltechid.Text = ""; } colassetincludeinchange = objincludeasset.Get_All_IncludeAssetinchange(changeid); BLLCollection <Configuration_mst> colasset = new BLLCollection <Configuration_mst>(); Configuration_mst ObjAsset = new Configuration_mst(); foreach (IncludedAssetinchange obj in colassetincludeinchange) { ObjAsset = ObjAsset.Get_By_id(obj.Assetid); colasset.Add(ObjAsset); } lstAsset.DataTextField = "Serialno"; lstAsset.DataValueField = "assetid"; lstAsset.DataSource = colasset; lstAsset.DataBind(); }
protected void Showchangeinfo() { Approvalpanal.Visible = true; btnApprove.Visible = true; btnReject.Visible = true; Alreadyapprovedpanal.Visible = false; NameValueCollection n = Request.QueryString; int changeid = Convert.ToInt16(Request.QueryString[0]); //lblchangeid.Text = changeid.ToString(); ObjChange = ObjChange.Get_By_id(changeid); lblchangeid.Text = ObjChange.Changeid.ToString(); lbltitle.Text = ObjChange.Title; lbldescription.Text = ObjChange.Description; //lblDateDisp.Text = ObjChange.Createdtime.ToString(); int requesterid = Convert.ToInt16(ObjChange.Requestedby); //lblTitle.Text = ObjChange.Title.ToString(); //lblDescription.Text = ObjChange.Description.ToString(); lblserviceeffected.Text = "Email"; int chantypeid = Convert.ToInt16(ObjChange.Changetype); ObjChangeType = ObjChangeType.Get_By_id(chantypeid); if (chantypeid != 0) { lblchangetype.Text = ObjChangeType.Changetypename.ToString(); } int changestatus = Convert.ToInt16(ObjChange.Statusid); Objchangestatus = Objchangestatus.Get_By_id(changestatus); if (changestatus != 0) { lblStatus.Text = Objchangestatus.Statusname; } int priorityid = Convert.ToInt16(ObjChange.Priority); ObjPriority = ObjPriority.Get_By_id(priorityid); if (priorityid != 0) { lblpriority.Text = ObjPriority.Name.ToString(); } else { lblpriority.Text = ""; } int category = Convert.ToInt16(ObjChange.Categoryid); ObjCategory = ObjCategory.Get_By_id(category); if (category != 0) { lblcategory.Text = ObjCategory.CategoryName.ToString(); } else { lblcategory.Text = ""; } int subcategory = Convert.ToInt16(ObjChange.Subcategoryid); Objsubcategory = Objsubcategory.Get_By_id(subcategory); if (subcategory != 0) { lblsubcategory.Text = Objsubcategory.Subcategoryname.ToString(); } else { lblsubcategory.Text = ""; } int creator = Convert.ToInt16(ObjChange.CreatedByID); ObjUser = ObjUser.Get_By_id(creator); lblCreatedby.Text = ObjUser.Username.ToString(); lblCreatedDate.Text = ObjChange.Createdtime.ToString(); int techid = Convert.ToInt16(ObjChange.Technician); ObjUser = ObjUser.Get_By_id(techid); if (techid != 0) { lbltechid.Text = ObjUser.Username.ToString(); } else { lbltechid.Text = ""; } colassetincludeinchange = objincludeasset.Get_All_IncludeAssetinchange(changeid); BLLCollection<Configuration_mst> colasset = new BLLCollection<Configuration_mst>(); Configuration_mst ObjAsset = new Configuration_mst(); foreach (IncludedAssetinchange obj in colassetincludeinchange) { ObjAsset = ObjAsset.Get_By_id(obj.Assetid); colasset.Add(ObjAsset); } lstAsset.DataTextField = "Serialno"; lstAsset.DataValueField = "assetid"; lstAsset.DataSource = colasset; lstAsset.DataBind(); }