protected void grdvwCI_RowDataBound(Object sender, GridViewRowEventArgs e) { //Add Exception handilng try catch change by vishal 21-05-2012 try { if (e.Row.RowType == DataControlRowType.DataRow) { int itemid = Convert.ToInt32(drpitem.SelectedValue); objCategory = objCategory.Get_By_id(itemid); if (objCategory.Categoryid != 0) { e.Row.Cells[1].Text = objCategory.CategoryName.ToString(); } else { e.Row.Cells[2].Text = ""; } } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
public void Repeter_ItemDataBound(Object Sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item) { int topicid; //topicid = Convert.ToInt16(DataBinder.Eval(e.Item.DataItem, "topicid")); Label topicidL = (Label)e.Item.FindControl("lbltopicid"); topicid = Convert.ToInt16(topicidL.Text); ObjCategory = ObjCategory.Get_By_id(topicid); topicidL.Text = ObjCategory.CategoryName; topicidL.Visible = true; } else if (e.Item.ItemType == ListItemType.AlternatingItem) { int topicid; //topicid = Convert.ToInt16(DataBinder.Eval(e.Item.DataItem, "topicid")); Label topicidL = (Label)e.Item.FindControl("lbltopicid"); topicid = Convert.ToInt16(topicidL.Text); ObjCategory = ObjCategory.Get_By_id(topicid); topicidL.Text = ObjCategory.CategoryName; topicidL.Visible = true; } if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { CheckBox ck = (CheckBox)e.Item.FindControl("CheckBox1"); Label lbl = (Label)e.Item.FindControl("lblapprove"); Label solutionid = (Label)e.Item.FindControl("lblsolutionid"); Image imgapprove = (Image)e.Item.FindControl("imgapprove"); Image imgreject = (Image)e.Item.FindControl("Imgunapproved"); int slid = Convert.ToInt16(solutionid.Text); int solid = Convert.ToInt16(solutionid.Text); ObjSolution = ObjSolution.Get_By_id(solid); approvestatus = Convert.ToInt16(ObjSolution.SolutionStatus); if (approvestatus == 1) { lbl.Text = "Approved"; imgapprove.Visible = true; imgreject.Visible = false; } else if (approvestatus == 2) { lbl.Text = "Rejected"; imgapprove.Visible = false; imgreject.Visible = true; } else { lbl.Text = "Unapproved"; imgapprove.Visible = false; imgreject.Visible = false; } } }
protected void Page_Load(object sender, EventArgs e) { string strStatusClose = Resources.MessageResource.strStatusClose.ToString().Trim(); string statusString = ""; int incidentid = Convert.ToInt16(Request.QueryString[0]); Objincident = Objincident.Get_By_id(incidentid); Objincidentstate = Objincidentstate.Get_By_id(incidentid); Objincidentresoution = Objincidentresoution.Get_By_id(incidentid); objstatus = objstatus.Get_By_id(Objincidentstate.Statusid); statusString = objstatus.Statusname.ToString(); if (statusString.ToLower() == strStatusClose.ToLower()) { lbltcktno.Text = Objincident.Incidentid.ToString(); lblcreatedate.Text = Objincident.Createdatetime.ToString(); if (Objincidentstate.AssignedTime != null) { lblstarttime.Text = Objincidentstate.AssignedTime.ToString(); } lblendtime.Text = Objincident.Completedtime.ToString(); Objcategory = Objcategory.Get_By_id(Objincidentstate.Categoryid); lblcomponenteffected.Text = Objcategory.CategoryName.ToString(); lbldescription.Text = Objincident.Title.ToString(); string bb = Objincidentresoution.Resolution.ToString(); string stripped = Regex.Replace(bb, @"<(.|\n)*?>", string.Empty); lblresolution.Text = stripped.ToString(); //bind data to data bound controls and do other stuff objUser = objUser.Get_By_id(Objincident.Requesterid); lblcustomer.Text = objUser.Username.ToString(); objUser = objUser.Get_By_id(Objincidentstate.Technicianid); lblengineer.Text = objUser.Username.ToString(); objstatus = objstatus.Get_By_id(Objincidentstate.Statusid); lblrcaresult.Text = objstatus.Statusname.ToString(); } Response.Clear(); //this clears the Response of any headers or previous output Response.Buffer = true; //make sure that the entire output is rendered simultaneously /// ///Set content type to MS Excel sheet ///Use "application/msword" for MS Word doc files ///"application/pdf" for PDF files /// Response.ContentType = "application/vnd.ms-excel"; StringWriter stringWriter = new StringWriter(); //System.IO namespace should be used HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter); /// ///Render the entire Page control in the HtmlTextWriter object ///We can render individual controls also, like a DataGrid to be ///exported in custom format (excel, word etc) /// this.RenderControl(htmlTextWriter); Response.Write(stringWriter.ToString()); Response.End(); }
protected void subcategorygrdvw_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int varcateid; varcateid = Convert.ToInt32(drpCategory.SelectedValue); objCategory = objCategory.Get_By_id(varcateid); e.Row.Cells[3].Text = objCategory.CategoryName; } //if (e.Row.RowType == DataControlRowType.DataRow && e.Row.RowState != DataControlRowState.Edit) //{ // int categoryid; // Label lblcategoryid = (Label)e.Row.FindControl("lblcategory"); // if (lblcategoryid != null) // { // categoryid = Convert.ToInt32(lblcategoryid.Text); // ViewState["categoryid"] = lblcategoryid.Text; // objCategory = objCategory.Get_By_id(categoryid); // if (objCategory.Categoryid!=0) // { // lblcategoryid.Text = objCategory.CategoryName.ToString(); // } // } //} //if (e.Row.RowState == DataControlRowState.Edit ) //{ // DropDownList categorydrp = (DropDownList)e.Row.FindControl("drpcategoryname"); // BLLCollection<Category_mst> col = new BLLCollection<Category_mst>(); // col = objCategory.Get_All(); // categorydrp.DataSource = col; // categorydrp.DataTextField = "CategoryName"; // categorydrp.DataValueField = "categoryid"; // categorydrp.DataBind(); // categorydrp.SelectedValue = ViewState["categoryid"].ToString(); //} //if (e.Row.RowState == (System.Web.UI.WebControls.DataControlRowState.Alternate | System.Web.UI.WebControls.DataControlRowState.Edit)) //{ // DropDownList categorydrp = (DropDownList)e.Row.FindControl("drpcategoryname"); // BLLCollection<Category_mst> col = new BLLCollection<Category_mst>(); // col = objCategory.Get_All(); // categorydrp.DataSource = col; // categorydrp.DataTextField = "CategoryName"; // categorydrp.DataValueField = "categoryid"; // categorydrp.DataBind(); // categorydrp.SelectedValue = ViewState["categoryid"].ToString(); //} }
protected void Page_Load(object sender, EventArgs e) { string strStatusClose = Resources.MessageResource.strStatusClose.ToString().Trim(); string statusString = ""; int incidentid =Convert.ToInt16(Request.QueryString[0]); Objincident = Objincident.Get_By_id(incidentid); Objincidentstate = Objincidentstate.Get_By_id(incidentid); Objincidentresoution = Objincidentresoution.Get_By_id(incidentid); objstatus = objstatus.Get_By_id(Objincidentstate.Statusid); statusString = objstatus.Statusname.ToString(); if (statusString.ToLower() == strStatusClose.ToLower()) { lbltcktno.Text = Objincident.Incidentid.ToString(); lblcreatedate.Text = Objincident.Createdatetime.ToString(); if (Objincidentstate.AssignedTime != null) { lblstarttime.Text = Objincidentstate.AssignedTime.ToString(); } lblendtime.Text = Objincident.Completedtime.ToString(); Objcategory=Objcategory.Get_By_id(Objincidentstate.Categoryid); lblcomponenteffected.Text = Objcategory.CategoryName.ToString(); lbldescription.Text = Objincident.Title.ToString(); string bb = Objincidentresoution.Resolution.ToString(); string stripped = Regex.Replace(bb,@"<(.|\n)*?>",string.Empty); lblresolution.Text = stripped.ToString(); //bind data to data bound controls and do other stuff objUser = objUser.Get_By_id(Objincident.Requesterid); lblcustomer.Text = objUser.Username.ToString(); objUser = objUser.Get_By_id(Objincidentstate.Technicianid); lblengineer.Text = objUser.Username.ToString(); objstatus = objstatus.Get_By_id(Objincidentstate.Statusid); lblrcaresult.Text = objstatus.Statusname.ToString(); } Response.Clear(); //this clears the Response of any headers or previous output Response.Buffer = true; //make sure that the entire output is rendered simultaneously /// ///Set content type to MS Excel sheet ///Use "application/msword" for MS Word doc files ///"application/pdf" for PDF files /// Response.ContentType = "application/vnd.ms-excel"; StringWriter stringWriter = new StringWriter(); //System.IO namespace should be used HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter); /// ///Render the entire Page control in the HtmlTextWriter object ///We can render individual controls also, like a DataGrid to be ///exported in custom format (excel, word etc) /// this.RenderControl(htmlTextWriter); Response.Write(stringWriter.ToString()); Response.End(); }
protected void grdvwCI_RowDataBound(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { int itemid = Convert.ToInt16(drpitem.SelectedValue); objCategory = objCategory.Get_By_id(itemid); if (objCategory.Categoryid != 0) { e.Row.Cells[1].Text = objCategory.CategoryName.ToString(); } else { e.Row.Cells[2].Text = ""; } } }
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(); } }
//*Start Code added by Shrikant protected void Categorygrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e) { ClearControl(); string name, desc, id; int CategoryId; int FlagCategory; name = ((TextBox)Categorygrdvw.Rows[e.RowIndex].Cells[1].Controls[0].FindControl("txtCategoryName")).Text; desc = ((TextBox)Categorygrdvw.Rows[e.RowIndex].Cells[2].Controls[0].FindControl("txtCategorydesc")).Text; id = Convert.ToString(Categorygrdvw.Rows[e.RowIndex].Cells[0].Text); CategoryId = Convert.ToInt16(id); CategoryObj = CategoryObj.Get_By_id(CategoryId); if (CategoryObj.CategoryName == name) { CategoryObj.Categoryid = CategoryId; CategoryObj.CategoryName = name; CategoryObj.Categorydescription = desc; CategoryObj.Update(); Categorygrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate; } else if (name == "") { lblerrmsg.Text = "Category Nome should not be Empty"; } else { FlagCategory = CategoryObj.Get_By_CategoryName(name); if ((FlagCategory == 0) && (name != "")) { CategoryObj.Categoryid = CategoryId; CategoryObj.CategoryName = name; CategoryObj.Categorydescription = desc; CategoryObj.Update(); Categorygrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate; } else { Categorygrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errCategoryExist.ToString(); } } }
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 grdvwChange_RowDataBound(Object sender, GridViewRowEventArgs e) { //Add Exception handilng try catch change by vishal 21-05-2012 try { if (e.Row.RowType == DataControlRowType.DataRow) { #region Bind Data Row at Run time with requesterid to Requester name int requesterid = Convert.ToInt32(e.Row.Cells[3].Text); objUser = objUser.Get_By_id(requesterid); if (objUser.Userid != 0) { e.Row.Cells[3].Text = objUser.Username.ToString(); } else { e.Row.Cells[3].Text = ""; } #endregion #region Bind Datarow at Run Time with Createdbyid to Created by name int createdbyid = Convert.ToInt32(e.Row.Cells[4].Text); objUser = objUser.Get_By_id(createdbyid); if (objUser.Userid != 0) { e.Row.Cells[4].Text = objUser.Username.ToString(); } else { e.Row.Cells[4].Text = ""; } #endregion #region Bind Datarow at Run Time with technicianid to technician name int technicianid = Convert.ToInt32(e.Row.Cells[5].Text); objUser = objUser.Get_By_id(technicianid); if (objUser.Userid != 0) { e.Row.Cells[5].Text = objUser.Username.ToString(); } else { e.Row.Cells[5].Text = ""; } #endregion #region Bind Datarow at run time with Statusid to Status int statusid = Convert.ToInt32(e.Row.Cells[6].Text); objStatus = objStatus.Get_By_id(statusid); if (objStatus.ChangeStatusid != 0) { e.Row.Cells[6].Text = objStatus.Statusname.ToString(); } else { e.Row.Cells[6].Text = ""; } #endregion #region Bind Datarow at run time with Priorityid to Priority int priorityid = Convert.ToInt32(e.Row.Cells[7].Text); objPriority = objPriority.Get_By_id(priorityid); if (objPriority.Priorityid != 0) { e.Row.Cells[7].Text = objPriority.Name.ToString(); } else { e.Row.Cells[7].Text = ""; } #endregion #region Bind Datarow at run time with CategoryId to Category int categoryid = Convert.ToInt32(e.Row.Cells[8].Text); objCategory = objCategory.Get_By_id(categoryid); if (objCategory.Categoryid != 0) { e.Row.Cells[8].Text = objCategory.CategoryName.ToString(); } else { e.Row.Cells[8].Text = ""; } #endregion } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void Page_Load(object sender, EventArgs e) { //Add Exception handilng try catch change by vishal 21-05-2012 try { string strStatusClose = Resources.MessageResource.strStatusClose.ToString().Trim(); string statusString = ""; int problemid = Convert.ToInt32(Request.QueryString[0]); ObjProbelm = ObjProbelm.Get_By_id(problemid); objrootcause = objrootcause.Get_By_id(problemid); objimpact = objimpact.Get_By_id(problemid); objstatus = objstatus.Get_By_id(ObjProbelm.Statusid); statusString = objstatus.Statusname.ToString(); if (statusString.ToLower() == strStatusClose.ToLower()) { string ii = objimpact.Description.ToString(); string stripped4 = Regex.Replace(ii, @"<(.|\n)*?>", string.Empty); lblserviceeffected.Text = objimpact.Description.ToString(); string rr = objrootcause.Description.ToString(); string stripped1 = Regex.Replace(rr, @"<(.|\n)*?>", string.Empty); lblcause.Text = stripped1.ToString(); objproblemsysmptom = objproblemsysmptom.Get_By_id(problemid); string ss = objproblemsysmptom.Description.ToString(); string stripped3 = Regex.Replace(ss, @"<(.|\n)*?>", string.Empty); lblsymptom.Text = stripped3.ToString(); lbltcktno.Text = ObjProbelm.ProblemId.ToString(); lblcreatedate.Text = ObjProbelm.CreateDatetime.ToString(); if (ObjProbelm.AssginedTime != null) { lblstarttime.Text = ObjProbelm.AssginedTime.ToString(); } lblendtime.Text = ObjProbelm.Closedatetime.ToString(); Objcategory = Objcategory.Get_By_id(ObjProbelm.Categoryid); lblcomponenteffected.Text = Objcategory.CategoryName.ToString(); lbldescription.Text = ObjProbelm.title.ToString(); objproblemtosolution = objproblemtosolution.Get_By_id(ObjProbelm.ProblemId); Objsolution = Objsolution.Get_By_id(objproblemtosolution.Solutionid); string bb = Objsolution.Solution.ToString(); string stripped = Regex.Replace(bb, @"<(.|\n)*?>", string.Empty); lblresolution.Text = stripped.ToString(); //bind data to data bound controls and do other stuff objUser = objUser.Get_By_id(ObjProbelm.Requesterid); lblcustomer.Text = objUser.Username.ToString(); objUser = objUser.Get_By_id(ObjProbelm.Technicianid); lblengineer.Text = objUser.Username.ToString(); lblrcaresult.Text = "Completed"; } Response.Clear(); //this clears the Response of any headers or previous output Response.Buffer = true; //make sure that the entire output is rendered simultaneously /// ///Set content type to MS Excel sheet ///Use "application/msword" for MS Word doc files ///"application/pdf" for PDF files /// Response.ContentType = "application/vnd.ms-excel"; StringWriter stringWriter = new StringWriter(); //System.IO namespace should be used HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter); /// ///Render the entire Page control in the HtmlTextWriter object ///We can render individual controls also, like a DataGrid to be ///exported in custom format (excel, word etc) /// this.RenderControl(htmlTextWriter); Response.Write(stringWriter.ToString()); Response.End(); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
public void Repeter_ItemDataBound(Object Sender, RepeaterItemEventArgs e) { /////Add Exception handilng try catch change by vishal 21-05-2012 try { if (e.Item.ItemType == ListItemType.Item) { int topicid; //topicid = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "topicid")); Label topicidL = (Label)e.Item.FindControl("lbltopicid"); topicid = Convert.ToInt32(topicidL.Text); ObjCategory = ObjCategory.Get_By_id(topicid); topicidL.Text = ObjCategory.CategoryName; topicidL.Visible = true; } else if (e.Item.ItemType == ListItemType.AlternatingItem) { int topicid; //topicid = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "topicid")); Label topicidL = (Label)e.Item.FindControl("lbltopicid"); topicid = Convert.ToInt32(topicidL.Text); ObjCategory = ObjCategory.Get_By_id(topicid); topicidL.Text = ObjCategory.CategoryName; topicidL.Visible = true; } if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { CheckBox ck = (CheckBox)e.Item.FindControl("CheckBox1"); Label lbl = (Label)e.Item.FindControl("lblapprove"); Label solutionid = (Label)e.Item.FindControl("lblsolutionid"); Image imgapprove = (Image)e.Item.FindControl("imgapprove"); Image imgreject = (Image)e.Item.FindControl("Imgunapproved"); int slid = Convert.ToInt32(solutionid.Text); int solid = Convert.ToInt32(solutionid.Text); ObjSolution = ObjSolution.Get_By_id(solid); approvestatus = Convert.ToInt32(ObjSolution.SolutionStatus); if (approvestatus == 1) { lbl.Text = "Approved"; imgapprove.Visible = true; imgreject.Visible = false; } else if (approvestatus == 2) { lbl.Text = "Rejected"; imgapprove.Visible = false; imgreject.Visible = true; } else { lbl.Text = "Unapproved"; imgapprove.Visible = false; imgreject.Visible = false; } } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
public void Repeter_ItemDataBound(Object Sender, RepeaterItemEventArgs e) {/////Add Exception handilng try catch change by vishal 21-05-2012 try { if (e.Item.ItemType == ListItemType.Item) { int topicid; //topicid = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "topicid")); Label topicidL = (Label)e.Item.FindControl("lbltopicid"); topicid = Convert.ToInt32(topicidL.Text); ObjCategory = ObjCategory.Get_By_id(topicid); topicidL.Text = ObjCategory.CategoryName; topicidL.Visible = true; } else if (e.Item.ItemType == ListItemType.AlternatingItem) { int topicid; //topicid = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "topicid")); Label topicidL = (Label)e.Item.FindControl("lbltopicid"); topicid = Convert.ToInt32(topicidL.Text); ObjCategory = ObjCategory.Get_By_id(topicid); topicidL.Text = ObjCategory.CategoryName; topicidL.Visible = true; } if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { CheckBox ck = (CheckBox)e.Item.FindControl("CheckBox1"); Label lbl = (Label)e.Item.FindControl("lblapprove"); Label solutionid = (Label)e.Item.FindControl("lblsolutionid"); Image imgapprove = (Image)e.Item.FindControl("imgapprove"); Image imgreject = (Image)e.Item.FindControl("Imgunapproved"); int slid = Convert.ToInt32(solutionid.Text); int solid = Convert.ToInt32(solutionid.Text); ObjSolution = ObjSolution.Get_By_id(solid); approvestatus = Convert.ToInt32(ObjSolution.SolutionStatus); if (approvestatus == 1) { lbl.Text = "Approved"; imgapprove.Visible = true; imgreject.Visible = false; } else if (approvestatus == 2) { lbl.Text = "Rejected"; imgapprove.Visible = false; imgreject.Visible = true; } else { lbl.Text = "Unapproved"; imgapprove.Visible = false; imgreject.Visible = false; } } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void grdvwProblem_RowDataBound(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { #region Bind Data Row at Run time with requesterid to Requester name int requesterid = Convert.ToInt32(e.Row.Cells[3].Text); objUser = objUser.Get_By_id(requesterid); if (objUser.Userid != 0) { e.Row.Cells[3].Text = objUser.Username.ToString(); } else { e.Row.Cells[3].Text = ""; } #endregion #region Bind Datarow at Run Time with Createdbyid to Created by name int createdbyid = Convert.ToInt32(e.Row.Cells[4].Text); objUser = objUser.Get_By_id(createdbyid); if (objUser.Userid != 0) { e.Row.Cells[4].Text = objUser.Username.ToString(); } else { e.Row.Cells[4].Text = ""; } #endregion #region Bind Datarow at Run Time with technicianid to technician name int technicianid = Convert.ToInt32(e.Row.Cells[5].Text); objUser = objUser.Get_By_id(technicianid); if (objUser.Userid != 0) { e.Row.Cells[5].Text = objUser.Username.ToString(); } else { e.Row.Cells[5].Text = ""; } #endregion #region Bind Datarow at run time with Statusid to Status int statusid = Convert.ToInt32(e.Row.Cells[6].Text); objStatus = objStatus.Get_By_id(statusid); if (objStatus.Statusid != 0) { e.Row.Cells[6].Text = objStatus.Statusname.ToString(); } else { e.Row.Cells[6].Text = ""; } #endregion #region Bind Datarow at run time with Priorityid to Priority int priorityid = Convert.ToInt32(e.Row.Cells[7].Text); objPriority = objPriority.Get_By_id(priorityid); if (objPriority.Priorityid != 0) { e.Row.Cells[7].Text = objPriority.Name.ToString(); } else { e.Row.Cells[7].Text = ""; } #endregion #region Bind Datarow at run time with CategoryId to Category int categoryid = Convert.ToInt32(e.Row.Cells[8].Text); objCategory = objCategory.Get_By_id(categoryid); if (objCategory.Categoryid != 0) { e.Row.Cells[8].Text = objCategory.CategoryName.ToString(); } else { e.Row.Cells[8].Text = ""; } #endregion } }
string GetCategoryName(int categoryid) { string categoryname = ""; objCategory = objCategory.Get_By_id(categoryid); if (objCategory.Categoryid != 0) { categoryname = objCategory.CategoryName; } return categoryname; }
//*Start Code added by Shrikant protected void Categorygrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e) { ClearControl(); string name, desc, id; int CategoryId; int FlagCategory; name = ((TextBox)Categorygrdvw.Rows[e.RowIndex].Cells[1].Controls[0].FindControl("txtCategoryName")).Text; desc = ((TextBox)Categorygrdvw.Rows[e.RowIndex].Cells[2].Controls[0].FindControl("txtCategorydesc")).Text; id = Convert.ToString(Categorygrdvw.Rows[e.RowIndex].Cells[0].Text); CategoryId = Convert.ToInt32(id); CategoryObj = CategoryObj.Get_By_id(CategoryId); if (CategoryObj.CategoryName == name) { CategoryObj.Categoryid = CategoryId; CategoryObj.CategoryName = name; CategoryObj.Categorydescription = desc; CategoryObj.Update(); Categorygrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate; } else if(name == "") { lblerrmsg.Text = "Category Nome should not be Empty"; } else { FlagCategory = CategoryObj.Get_By_CategoryName(name); if ((FlagCategory == 0)&&(name!="")) { CategoryObj.Categoryid = CategoryId; CategoryObj.CategoryName = name; CategoryObj.Categorydescription = desc; CategoryObj.Update(); Categorygrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate; } else { Categorygrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errCategoryExist.ToString(); } } }
protected void ShowPanal1() { panShowdata.Visible = true; panEditData.Visible = false; int Solutionid = Convert.ToInt16(Request.QueryString[0]); ObjSolution = ObjSolution.Get_By_id(Solutionid); ObjSolutionKeyword = ObjSolutionKeyword.Get_By_id(Solutionid); if(ObjCategory.CategoryName==null) { lbltitle.Text = ObjSolution.Title.ToString(); lblcontent.Text = ObjSolution.Content.ToString(); ObjCategory = ObjCategory.Get_By_id(ObjSolution.Topicid); lbltopic.Text = ""; lblkeyword.Text = ObjSolutionKeyword.Keywords.ToString(); lblsolid.Text = Solutionid.ToString(); editsolheader.Visible = false; } else { lbltitle.Text = ObjSolution.Title.ToString(); lblcontent.Text = ObjSolution.Content.ToString(); ObjCategory = ObjCategory.Get_By_id(ObjSolution.Topicid); lbltopic.Text = ObjCategory.CategoryName.ToString(); lblkeyword.Text = ObjSolutionKeyword.Keywords.ToString(); lblsolid.Text = Solutionid.ToString(); editsolheader.Visible = false; } int status=Convert.ToInt16(ObjSolution.SolutionStatus); if (status ==1) { imgapprove.Visible = true; Imgunapproved.Visible = false; lblapprove.Text = "Approve"; } else if (status == 2) { Imgunapproved.Visible = true; imgapprove.Visible = false; lblapprove.Text = "Rejected"; } else { imgapprove.Visible = false; Imgunapproved.Visible = false; lblapprove.Text = "UnApproved"; } ObjSolutionCreator = ObjSolutionCreator.Get_By_id(ObjSolution.Solutionid); int userid = Convert.ToInt16(ObjSolutionCreator.Createdby); objUser = objUser.Get_By_id(userid); lblcreatedby.Text = objUser.Username.ToString(); lblcreatedon.Text = ObjSolutionCreator.CreateDatetime.ToString(); int lastupdateid = Convert.ToInt16(ObjSolutionCreator.LastUpdateBy); if (lastupdateid != 0) { objUser = objUser.Get_By_id(lastupdateid); lbllastupdateon.Text = ObjSolutionCreator.LastUpdateon.ToString(); lbllastupdate.Text = objUser.Username.ToString(); } else { lbllastupdateon.Text = ""; lbllastupdate.Text = ""; } //if (objUser.Username == "") //{ // lbllastupdate.Text = objUser.Username.ToString(); // lbllastupdate.Text = objUser.Username.ToString(); //} //else //{ // lbllastupdate.Text = ""; // lbllastupdateon.Text = ""; //} //if (objUser.Username != "") //{ // lbllastupdate.Text = objUser.Username.ToString(); //} //if (ObjSolutionCreator.LastUpdateon == "") //{ // lbllastupdateon.Text = ObjSolutionCreator.LastUpdateon.ToString(); //} //if (ObjSolutionCreator.LastUpdateon != "") //{ // lbllastupdateon.Text = ObjSolutionCreator.LastUpdateon.ToString(); //} }
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(); }
protected void Page_Load(object sender, EventArgs e) {//Add Exception handilng try catch change by vishal 21-05-2012 try { string strStatusClose = Resources.MessageResource.strStatusClose.ToString().Trim(); string statusString = ""; int problemid = Convert.ToInt32(Request.QueryString[0]); ObjProbelm = ObjProbelm.Get_By_id(problemid); objrootcause = objrootcause.Get_By_id(problemid); objimpact = objimpact.Get_By_id(problemid); objstatus = objstatus.Get_By_id(ObjProbelm.Statusid); statusString = objstatus.Statusname.ToString(); if (statusString.ToLower() == strStatusClose.ToLower()) { string ii = objimpact.Description.ToString(); string stripped4 = Regex.Replace(ii, @"<(.|\n)*?>", string.Empty); lblserviceeffected.Text = objimpact.Description.ToString(); string rr = objrootcause.Description.ToString(); string stripped1 = Regex.Replace(rr, @"<(.|\n)*?>", string.Empty); lblcause.Text = stripped1.ToString(); objproblemsysmptom = objproblemsysmptom.Get_By_id(problemid); string ss = objproblemsysmptom.Description.ToString(); string stripped3 = Regex.Replace(ss, @"<(.|\n)*?>", string.Empty); lblsymptom.Text = stripped3.ToString(); lbltcktno.Text = ObjProbelm.ProblemId.ToString(); lblcreatedate.Text = ObjProbelm.CreateDatetime.ToString(); if (ObjProbelm.AssginedTime != null) { lblstarttime.Text = ObjProbelm.AssginedTime.ToString(); } lblendtime.Text = ObjProbelm.Closedatetime.ToString(); Objcategory = Objcategory.Get_By_id(ObjProbelm.Categoryid); lblcomponenteffected.Text = Objcategory.CategoryName.ToString(); lbldescription.Text = ObjProbelm.title.ToString(); objproblemtosolution = objproblemtosolution.Get_By_id(ObjProbelm.ProblemId); Objsolution = Objsolution.Get_By_id(objproblemtosolution.Solutionid); string bb = Objsolution.Solution.ToString(); string stripped = Regex.Replace(bb, @"<(.|\n)*?>", string.Empty); lblresolution.Text = stripped.ToString(); //bind data to data bound controls and do other stuff objUser = objUser.Get_By_id(ObjProbelm.Requesterid); lblcustomer.Text = objUser.Username.ToString(); objUser = objUser.Get_By_id(ObjProbelm.Technicianid); lblengineer.Text = objUser.Username.ToString(); lblrcaresult.Text = "Completed"; } Response.Clear(); //this clears the Response of any headers or previous output Response.Buffer = true; //make sure that the entire output is rendered simultaneously /// ///Set content type to MS Excel sheet ///Use "application/msword" for MS Word doc files ///"application/pdf" for PDF files /// Response.ContentType = "application/vnd.ms-excel"; StringWriter stringWriter = new StringWriter(); //System.IO namespace should be used HtmlTextWriter htmlTextWriter = new HtmlTextWriter(stringWriter); /// ///Render the entire Page control in the HtmlTextWriter object ///We can render individual controls also, like a DataGrid to be ///exported in custom format (excel, word etc) /// this.RenderControl(htmlTextWriter); Response.Write(stringWriter.ToString()); Response.End(); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void Showproblempanal() { panelProblem.Visible = true; pan1.Visible = true; panelincidentproblem.Visible = false; //panelHistory.Visible = false; panaleditproblem.Visible = false; panalanalysis.Visible = false; btnUpdate.Visible = false; btnCancel.Visible = false; lnkEdit.Visible = true; panalsolution.Visible = false; panelHistory.Visible = false; int problemid = Convert.ToInt16(Request.QueryString[0]); lblProblemId.Text = problemid.ToString(); ObjProblem = ObjProblem.Get_By_id(problemid); if (ObjProblem.title != null) { lblTitle.Text = ObjProblem.title.ToString(); } if (ObjProblem.Description != null) { lblDescription.Text = ObjProblem.Description.ToString(); } int priorityid = Convert.ToInt16(ObjProblem.Priorityid); ObjPriority = ObjPriority.Get_By_id(priorityid); if (priorityid!=0) { lblpriority.Text = ObjPriority.Name.ToString(); } else { lblpriority.Text = ""; } int status = Convert.ToInt16(ObjProblem.Statusid); ObjStatus = ObjStatus.Get_By_id(status); lblStatus.Text = ObjStatus.Statusname.ToString(); int category = Convert.ToInt16(ObjProblem.Categoryid); ObjCategory = ObjCategory.Get_By_id(category); if (category != 0) { lblcategory.Text = ObjCategory.CategoryName.ToString(); } else { lblcategory.Text = ""; } int subcategory = Convert.ToInt16(ObjProblem.Subcategoryid); Objsubcategory = Objsubcategory.Get_By_id(subcategory); if (subcategory != 0) { lblsubcategory.Text = Objsubcategory.Subcategoryname.ToString(); } else { lblsubcategory.Text = ""; } int requesterid = Convert.ToInt16(ObjProblem.Requesterid); ObjUser = ObjUser.Get_By_id(requesterid); lblRequesterDisp.Text = ObjUser.Username; int techid = Convert.ToInt16(ObjProblem.Technicianid); ObjUser = ObjUser.Get_By_id(techid); if (techid != 0) { lbltechid.Text = ObjUser.Username.ToString(); } else { lbltechid.Text = ""; } int creator = Convert.ToInt16(ObjProblem.CreatedByid); ObjUser = ObjUser.Get_By_id(creator); lblCreatedby.Text = ObjUser.Username.ToString(); lblCreatedDate.Text = ObjProblem.CreateDatetime.ToString(); lblDateDisp.Text = ObjProblem.CreateDatetime.ToString(); lblProblemId.Text = ObjProblem.ProblemId.ToString(); if (ObjProblem.Closedatetime != null) { lblCompletedDate.Text = ObjProblem.Closedatetime.ToString(); } else { lblCompletedDate.Text = ""; } }
public CollectionBase GenerateCategory_mstCollection(ref IDataReader returnData) { BLLCollection<Category_mst> col = new BLLCollection<Category_mst>(); while (returnData.Read()) { Category_mst obj = new Category_mst(); obj.Categoryid = (int)returnData["Categoryid"]; obj.CategoryName = (string)returnData["CategoryName"]; obj.Categorydescription = (string)returnData["categorydescription"]; col.Add(obj); } returnData.Close(); returnData.Dispose(); return col; }
public int Insert_Category_mst(Category_mst objCategory) { return (int)ExecuteNonQuery(Sp_Category_Insert, new object[] { objCategory.Categoryid, objCategory.CategoryName, objCategory.Categorydescription }); }
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 ShowPanal1() { panShowdata.Visible = true; panEditData.Visible = false; int Solutionid = Convert.ToInt16(Request.QueryString[0]); ObjSolution = ObjSolution.Get_By_id(Solutionid); ObjSolutionKeyword = ObjSolutionKeyword.Get_By_id(Solutionid); if (ObjCategory.CategoryName == null) { lbltitle.Text = ObjSolution.Title.ToString(); lblcontent.Text = ObjSolution.Content.ToString(); ObjCategory = ObjCategory.Get_By_id(ObjSolution.Topicid); lbltopic.Text = ""; lblkeyword.Text = ObjSolutionKeyword.Keywords.ToString(); lblsolid.Text = Solutionid.ToString(); editsolheader.Visible = false; } else { lbltitle.Text = ObjSolution.Title.ToString(); lblcontent.Text = ObjSolution.Content.ToString(); ObjCategory = ObjCategory.Get_By_id(ObjSolution.Topicid); lbltopic.Text = ObjCategory.CategoryName.ToString(); lblkeyword.Text = ObjSolutionKeyword.Keywords.ToString(); lblsolid.Text = Solutionid.ToString(); editsolheader.Visible = false; } int status = Convert.ToInt16(ObjSolution.SolutionStatus); if (status == 1) { imgapprove.Visible = true; Imgunapproved.Visible = false; lblapprove.Text = "Approve"; } else if (status == 2) { Imgunapproved.Visible = true; imgapprove.Visible = false; lblapprove.Text = "Rejected"; } else { imgapprove.Visible = false; Imgunapproved.Visible = false; lblapprove.Text = "UnApproved"; } ObjSolutionCreator = ObjSolutionCreator.Get_By_id(ObjSolution.Solutionid); int userid = Convert.ToInt16(ObjSolutionCreator.Createdby); objUser = objUser.Get_By_id(userid); lblcreatedby.Text = objUser.Username.ToString(); lblcreatedon.Text = ObjSolutionCreator.CreateDatetime.ToString(); int lastupdateid = Convert.ToInt16(ObjSolutionCreator.LastUpdateBy); if (lastupdateid != 0) { objUser = objUser.Get_By_id(lastupdateid); lbllastupdateon.Text = ObjSolutionCreator.LastUpdateon.ToString(); lbllastupdate.Text = objUser.Username.ToString(); } else { lbllastupdateon.Text = ""; lbllastupdate.Text = ""; } //if (objUser.Username == "") //{ // lbllastupdate.Text = objUser.Username.ToString(); // lbllastupdate.Text = objUser.Username.ToString(); //} //else //{ // lbllastupdate.Text = ""; // lbllastupdateon.Text = ""; //} //if (objUser.Username != "") //{ // lbllastupdate.Text = objUser.Username.ToString(); //} //if (ObjSolutionCreator.LastUpdateon == "") //{ // lbllastupdateon.Text = ObjSolutionCreator.LastUpdateon.ToString(); //} //if (ObjSolutionCreator.LastUpdateon != "") //{ // lbllastupdateon.Text = ObjSolutionCreator.LastUpdateon.ToString(); //} }
protected void grdvwProblem_RowDataBound(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { #region Bind Data Row at Run time with requesterid to Requester name int requesterid = Convert.ToInt16(e.Row.Cells[3].Text); objUser = objUser.Get_By_id(requesterid); if (objUser.Userid != 0) { e.Row.Cells[3].Text = objUser.Username.ToString(); } else { e.Row.Cells[3].Text = ""; } #endregion #region Bind Datarow at Run Time with Createdbyid to Created by name int createdbyid = Convert.ToInt16(e.Row.Cells[4].Text); objUser = objUser.Get_By_id(createdbyid); if (objUser.Userid != 0) { e.Row.Cells[4].Text = objUser.Username.ToString(); } else { e.Row.Cells[4].Text = ""; } #endregion #region Bind Datarow at Run Time with technicianid to technician name int technicianid = Convert.ToInt16(e.Row.Cells[5].Text); objUser = objUser.Get_By_id(technicianid); if (objUser.Userid != 0) { e.Row.Cells[5].Text = objUser.Username.ToString(); } else { e.Row.Cells[5].Text = ""; } #endregion #region Bind Datarow at run time with Statusid to Status int statusid = Convert.ToInt16(e.Row.Cells[6].Text); objStatus = objStatus.Get_By_id(statusid); if (objStatus.Statusid != 0) { e.Row.Cells[6].Text = objStatus.Statusname.ToString(); } else { e.Row.Cells[6].Text = ""; } #endregion #region Bind Datarow at run time with Priorityid to Priority int priorityid = Convert.ToInt16(e.Row.Cells[7].Text); objPriority = objPriority.Get_By_id(priorityid); if (objPriority.Priorityid != 0) { e.Row.Cells[7].Text = objPriority.Name.ToString(); } else { e.Row.Cells[7].Text = ""; } #endregion #region Bind Datarow at run time with CategoryId to Category int categoryid = Convert.ToInt16(e.Row.Cells[8].Text); objCategory = objCategory.Get_By_id(categoryid); if (objCategory.Categoryid != 0) { e.Row.Cells[8].Text = objCategory.CategoryName.ToString(); } else { e.Row.Cells[8].Text = ""; } #endregion } }
public object GenerateCategory_mstObject(ref IDataReader returnData) { Category_mst obj = new Category_mst(); while (returnData.Read()) { obj.CategoryName = (string)returnData["Categoryname"]; obj.Categoryid = (int)returnData["Categoryid"]; obj.Categorydescription = (string)returnData["Categorydescription"]; } returnData.Close(); returnData.Dispose(); return obj; }
//end public int Update_Category_mst_By_id(Category_mst objCategory) { return (int)ExecuteNonQuery(Sp_Category_Update, new object[] { objCategory.Categoryid, objCategory.CategoryName, objCategory.Categorydescription }); }
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; } }