protected void grvwContract_RowDataBound(Object sender, GridViewRowEventArgs e) { //Add Exception handilng try catch change by vishal 21-05-2012 try { if (e.Row.RowType == DataControlRowType.DataRow) { // Hndling GridView RowDataBound Event for Binding vendorid to Vendor name int vendorid = Convert.ToInt32(e.Row.Cells[5].Text); objVendor = objVendor.Get_By_id(vendorid); e.Row.Cells[5].Text = objVendor.Vendorname.ToString(); int contractid = Convert.ToInt32(e.Row.Cells[1].Text); objContract = objContract.Get_By_id(contractid); int TotalSpentTimeInMins = objContract.Get_Contract_Status(objContract.Activeto); Label lbl = ((Label)e.Row.FindControl("lblActive")); if (TotalSpentTimeInMins > 0) { lbl.Text = "Active"; } else { lbl.Text = "Not Active"; } } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void grdvwViewAsset_RowDataBound(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int id = Convert.ToInt16(e.Row.Cells[3].Text); objcategory = objcategory.Get_By_id(id); //objcategory = objcategory.Get_By_CategoryName(); e.Row.Cells[3].Text = objcategory.CategoryName.ToString(); int vendorid = Convert.ToInt16(e.Row.Cells[4].Text); ObjVendor = ObjVendor.Get_By_id(vendorid); e.Row.Cells[4].Text = ObjVendor.Vendorname.ToString(); } }
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 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 Vendorgrdw_RowUpdating(object sender, GridViewUpdateEventArgs e) { Vendor_mst Obj = new Vendor_mst(); string vendorname, contactperson, id; int vendorid = 0, count; vendorname = ((TextBox)Vendorgrdw.Rows[e.RowIndex].Cells[1].Controls[0]).Text; contactperson = ((TextBox)Vendorgrdw.Rows[e.RowIndex].Cells[2].Controls[0]).Text; id = Convert.ToString(Vendorgrdw.Rows[e.RowIndex].Cells[0].Text); vendorid = Convert.ToInt16(id); count = Obj.Get_Vendor_By_Vname(vendorname); ObjVendor = ObjVendor.Get_By_id(vendorid); if ((count == 0) && (vendorname != "")) { ObjVendor.Vendorid = vendorid; ObjVendor.Contactperson = contactperson; ObjVendor.Vendorname = vendorname; ObjVendor.Update(); Vendorgrdw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else if (ObjVendor.Vendorname == vendorname) { ObjVendor.Vendorid = vendorid; ObjVendor.Contactperson = contactperson; ObjVendor.Vendorname = vendorname; ObjVendor.Update(); Vendorgrdw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else if (vendorname == "") { lblerrmsg.Text = Resources.MessageResource.errVendorname.ToString(); } else { lblerrmsg.Text = Resources.MessageResource.erralready.ToString(); } }
protected void grvwContract_RowDataBound(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { // Hndling GridView RowDataBound Event for Binding vendorid to Vendor name int vendorid = Convert.ToInt16(e.Row.Cells[5].Text); objVendor = objVendor.Get_By_id(vendorid); e.Row.Cells[5].Text = objVendor.Vendorname.ToString(); int contractid = Convert.ToInt16(e.Row.Cells[1].Text); objContract = objContract.Get_By_id(contractid); int TotalSpentTimeInMins = objContract.Get_Contract_Status(objContract.Activeto); Label lbl = ((Label)e.Row.FindControl("lblActive")); if (TotalSpentTimeInMins > 0) { lbl.Text = "Active"; } else { lbl.Text = "Not Active"; } } }
protected void grdvwViewAsset_RowDataBound(Object sender, GridViewRowEventArgs e) {///Add Exception handilng try catch change by vishal 21-05-2012 try { if (e.Row.RowType == DataControlRowType.DataRow) { int id = Convert.ToInt32(e.Row.Cells[3].Text); objcategory = objcategory.Get_By_id(id); //objcategory = objcategory.Get_By_CategoryName(); e.Row.Cells[3].Text = objcategory.CategoryName.ToString(); int vendorid = Convert.ToInt32(e.Row.Cells[4].Text); ObjVendor = ObjVendor.Get_By_id(vendorid); e.Row.Cells[4].Text = ObjVendor.Vendorname.ToString(); } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void showCMDBValues() { panalupdatecmdb.Visible = true; int Incidentidforchange = Convert.ToInt16(Session["Incidentidforchange"]); ObjIncidentochange = ObjIncidentochange.Get_By_Incidentid(Incidentidforchange); int changeid = Convert.ToInt16(ObjIncidentochange.Changeid); Objincludeasset = Objincludeasset.Get_By_Changeid(changeid); int Assetid = Convert.ToInt16(Objincludeasset.Assetid); ObjConfiguration = ObjConfiguration.Get_By_id(Assetid); int itemid = Convert.ToInt16(ObjConfiguration.Itemid); ObjConfigurableitem = ObjConfigurableitem.Get_By_id(itemid); ObjCMDB = ObjCMDB.Get_By_id(Assetid); Objchange = Objchange.Get_By_id(changeid); int categoryid = Convert.ToInt16(Objchange.Categoryid); Objcategory = Objcategory.Get_By_id(categoryid); if (categoryid != 0) { lblcategory.Text = Objcategory.CategoryName.ToString(); } int Subcategoryid = Convert.ToInt16(Objchange.Subcategoryid); Objsubcategory = Objsubcategory.Get_By_id(Subcategoryid); if (Subcategoryid != 0) { lblsubcategory.Text = Objsubcategory.Subcategoryname.ToString(); } lblassetid.Text = ObjConfiguration.Assetid.ToString(); int itemid1=Convert.ToInt16(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.ToInt16(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 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(); } }
public object GenerateVendor_mstObject(ref IDataReader returnData) { Vendor_mst obj = new Vendor_mst(); while (returnData.Read()) { obj.Contactperson = (string)returnData["Contactperson"]; obj.Vendorid = (int)returnData["Vendorid"]; obj.Vendorname = (string)returnData["Vendorname"]; } returnData.Close(); returnData.Dispose(); return obj; }
public CollectionBase GenerateVendor_mstCollection(ref IDataReader returnData) { BLLCollection<Vendor_mst> col = new BLLCollection<Vendor_mst>(); while (returnData.Read()) { Vendor_mst obj = new Vendor_mst(); obj.Vendorid = (int)returnData["vendorid"]; obj.Vendorname = (string)returnData["vendorname"]; obj.Contactperson = (string)returnData["contactperson"]; col.Add(obj); } returnData.Close(); returnData.Dispose(); return col; }
string GetVendorName(int vendorid) { string vendorname = ""; objVendor = objVendor.Get_By_id(vendorid); if (objVendor.Vendorid != 0) { vendorname = objVendor.Vendorname; } return vendorname; }
public int Insert_Vendor_mst(Vendor_mst objVendor) { return (int)ExecuteNonQuery(Sp_Vendor_Insert, new object[] { objVendor.Vendorname, objVendor.Vendorid, objVendor.Contactperson }); }
protected void grdvwViewAsset_RowDataBound(Object sender, GridViewRowEventArgs e) { ///Add Exception handilng try catch change by vishal 21-05-2012 try { if (e.Row.RowType == DataControlRowType.DataRow) { int id = Convert.ToInt32(e.Row.Cells[3].Text); objcategory = objcategory.Get_By_id(id); //objcategory = objcategory.Get_By_CategoryName(); e.Row.Cells[3].Text = objcategory.CategoryName.ToString(); int vendorid = Convert.ToInt32(e.Row.Cells[4].Text); ObjVendor = ObjVendor.Get_By_id(vendorid); e.Row.Cells[4].Text = ObjVendor.Vendorname.ToString(); } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
public int Update_Vendor_mst_By_id(Vendor_mst objVendor) { return (int)ExecuteNonQuery(Sp_Vendor_Update, new object[] { objVendor.Vendorname, objVendor.Vendorid, objVendor.Contactperson }); }