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 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 Statusgrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e) { string name, desc, id; int StatusId = 0; name = ((TextBox)Statusgrdvw.Rows[e.RowIndex].Cells[1].Controls[0]).Text; desc = ((TextBox)Statusgrdvw.Rows[e.RowIndex].Cells[2].Controls[0]).Text; id = Convert.ToString(Statusgrdvw.Rows[e.RowIndex].Cells[0].Text); StatusId = Convert.ToInt32(id); statusnamecount = ObjStatus.Get_By_StatusName(name); ObjStatus = ObjStatus.Get_By_id(StatusId); if ((statusnamecount == 0) && (name != "")) { ObjStatus.Statusid = StatusId; ObjStatus.Statusname = name; ObjStatus.Description = desc; ObjStatus.Update(); Statusgrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else if (name == "") { lblerrmsg.Text = Resources.MessageResource.errnotempty.ToString(); } else if (ObjStatus.Statusname.ToLower() == name.ToLower()) { ObjStatus.Statusid = StatusId; ObjStatus.Statusname = name; ObjStatus.Description = desc; ObjStatus.Update(); Statusgrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else { lblerrmsg.Text = Resources.MessageResource.errStatusExist.ToString(); } }
protected void grdvwRequest_RowDataBound(Object sender, GridViewRowEventArgs e) { /////Add Exception handilng try catch change by vishal 21-05-2012 try { System.Drawing.ColorConverter colConvert = new ColorConverter(); BLLCollection<ColorScheme_mst> colColor = new BLLCollection<ColorScheme_mst>(); if (e.Row.RowType == DataControlRowType.DataRow) { #region Autogenerate Serial number Label lblSerial = (Label)e.Row.FindControl("lblSerial"); lblSerial.Text = i.ToString(); i++; #endregion int TotalTimeSpentonCall; int TotalResolutionTime; int varIncidentid = Convert.ToInt32(((Label)e.Row.FindControl("incidentid")).Text.ToString()); string varCreateDatetime = e.Row.Cells[9].Text; string varStatusOpen = Resources.MessageResource.strStatusOpen.ToString(); string varStatusClose = Resources.MessageResource.strStatusClose.ToString(); string varStatusOnHold = Resources.MessageResource.strStatusOnHold.ToString(); string varStatusResolved = Resources.MessageResource.strStatusResolved.ToString(); #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); objContactmst = objContactmst.Get_By_id(requesterid); //if (objUser.Userid != 0) //{ // e.Row.Cells[3].Text = objUser.Username.ToString(); // //e.Row.Cells[3].Text = objContactmst.Firstname.ToString(); //} //else { e.Row.Cells[3].Text = ""; } //if (objUser.Userid != 0) //{ //e.Row.Cells[3].Text = objUser.Username.ToString(); if (objContactmst.Firstname != null) { e.Row.Cells[3].Text = objContactmst.Firstname.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 Siteid to Site int siteid = Convert.ToInt32(e.Row.Cells[8].Text); objSite = objSite.Get_By_id(siteid); if (objSite.Siteid != 0) { string custSiteName; int custid = 0; colCustToSite = objCustToSite.Get_All_By_siteid(objSite.Siteid); foreach (CustomerToSiteMapping objCuToSite in colCustToSite) { custid = objCuToSite.Custid; } objCustomer = objCustomer.Get_By_id(custid); e.Row.Cells[8].Text = objCustomer.Customer_name + "/" + objSite.Sitename.ToString(); } else { e.Row.Cells[8].Text = ""; } #endregion #region Apply Color Coding to Open Calls,According to define SLA if (varStatusOpen.ToLower() == objStatus.Statusname.ToString().ToLower()) { Incident_mst obj = new Incident_mst(); obj = obj.Get_By_id(varIncidentid); if (obj.Incidentid != 0) { if (obj.Slaid != 0) { #region Declare local variables,and objects of various classes int percent; ProcessEscalateEmail objPro = new ProcessEscalateEmail(); #endregion #region Get Total Resolution time define for particular SLA and Time Spent on Request TotalResolutionTime = objPro.GetResolutionTimeInMins(obj.Slaid); TotalTimeSpentonCall = objIncident.Get_TimeSpentonRequest(varIncidentid, siteid, varCreateDatetime, DateTime.Now.ToString()); if (TotalTimeSpentonCall < 0) { TotalTimeSpentonCall = 0; } #endregion #region Calculate Percent if (TotalResolutionTime != 0) { percent = (TotalTimeSpentonCall * 100) / TotalResolutionTime; } else { percent = 0; } #endregion ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus(varStatusOpen); foreach (ColorScheme_mst objCol in colColor) { if (objCol.Percnt_to != 0) { if (percent >= objCol.Percnt && percent <= objCol.Percnt_to) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(objCol.Colorname); } } else { if (percent >= objCol.Percnt) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(objCol.Colorname); } } } } else { ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus("NonSLA"); foreach (ColorScheme_mst objCol in colColor) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(objCol.Colorname); } } } } #endregion #region Apply Color Coding to Close Calls if (varStatusClose.ToLower() == objStatus.Statusname.ToString().ToLower()) { ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus(varStatusClose); foreach (ColorScheme_mst obj in colColor) { try { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(obj.Colorname); } catch (Exception ex) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("White"); } } } #endregion #region Apply Color Coding to On Hold Calls if (varStatusOnHold.ToLower() == objStatus.Statusname.ToString().ToLower()) { ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus(varStatusOnHold); foreach (ColorScheme_mst obj in colColor) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(obj.Colorname); } } #endregion #region Apply Color Coding to Resolved Calls if (varStatusResolved.ToLower() == objStatus.Statusname.ToString().ToLower()) { ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus(varStatusResolved); foreach (ColorScheme_mst obj in colColor) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(obj.Colorname); } } #endregion } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void Statusgrdvw_RowUpdating(object sender, GridViewUpdateEventArgs e) { string name, desc, id; int StatusId = 0; name = ((TextBox)Statusgrdvw.Rows[e.RowIndex].Cells[1].Controls[0]).Text; desc = ((TextBox)Statusgrdvw.Rows[e.RowIndex].Cells[2].Controls[0]).Text; id = Convert.ToString(Statusgrdvw.Rows[e.RowIndex].Cells[0].Text); StatusId = Convert.ToInt32(id); statusnamecount = ObjStatus.Get_By_StatusName(name); ObjStatus = ObjStatus.Get_By_id(StatusId); if ((statusnamecount == 0)&&(name!="")) { ObjStatus.Statusid = StatusId; ObjStatus.Statusname = name; ObjStatus.Description = desc; ObjStatus.Update(); Statusgrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else if (name == "") { lblerrmsg.Text = Resources.MessageResource.errnotempty.ToString(); } else if (ObjStatus.Statusname.ToLower() == name.ToLower()) { ObjStatus.Statusid = StatusId; ObjStatus.Statusname = name; ObjStatus.Description = desc; ObjStatus.Update(); Statusgrdvw.EditIndex = -1; BindGrid(); lblerrmsg.Text = Resources.MessageResource.errupdate.ToString(); } else { lblerrmsg.Text = Resources.MessageResource.errStatusExist.ToString(); } }
protected void grdvwRequest_RowDataBound(Object sender, GridViewRowEventArgs e) { System.Drawing.ColorConverter colConvert = new ColorConverter(); BLLCollection <ColorScheme_mst> colColor = new BLLCollection <ColorScheme_mst>(); if (e.Row.RowType == DataControlRowType.DataRow) { #region Autogenerate Serial number Label lblSerial = (Label)e.Row.FindControl("lblSerial"); lblSerial.Text = i.ToString(); i++; #endregion int TotalTimeSpentonCall; int TotalResolutionTime; int varIncidentid = Convert.ToInt16(((Label)e.Row.FindControl("incidentid")).Text.ToString()); string varCreateDatetime = e.Row.Cells[9].Text; string varStatusOpen = Resources.MessageResource.strStatusOpen.ToString(); string varStatusClose = Resources.MessageResource.strStatusClose.ToString(); string varStatusOnHold = Resources.MessageResource.strStatusOnHold.ToString(); string varStatusResolved = Resources.MessageResource.strStatusResolved.ToString(); #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 Siteid to Site int siteid = Convert.ToInt16(e.Row.Cells[8].Text); objSite = objSite.Get_By_id(siteid); if (objSite.Siteid != 0) { string custSiteName; int custid = 0; colCustToSite = objCustToSite.Get_All_By_siteid(objSite.Siteid); foreach (CustomerToSiteMapping objCuToSite in colCustToSite) { custid = objCuToSite.Custid; } objCustomer = objCustomer.Get_By_id(custid); e.Row.Cells[8].Text = objCustomer.Customer_name + "/" + objSite.Sitename.ToString(); } else { e.Row.Cells[8].Text = ""; } #endregion #region Apply Color Coding to Open Calls,According to define SLA if (varStatusOpen.ToLower() == objStatus.Statusname.ToString().ToLower()) { Incident_mst obj = new Incident_mst(); obj = obj.Get_By_id(varIncidentid); if (obj.Incidentid != 0) { if (obj.Slaid != 0) { #region Declare local variables,and objects of various classes int percent; ProcessEscalateEmail objPro = new ProcessEscalateEmail(); #endregion #region Get Total Resolution time define for particular SLA and Time Spent on Request TotalResolutionTime = objPro.GetResolutionTimeInMins(obj.Slaid); TotalTimeSpentonCall = objIncident.Get_TimeSpentonRequest(varIncidentid, siteid, varCreateDatetime, DateTime.Now.ToString()); if (TotalTimeSpentonCall < 0) { TotalTimeSpentonCall = 0; } #endregion #region Calculate Percent percent = (TotalTimeSpentonCall * 100) / TotalResolutionTime; #endregion ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus(varStatusOpen); foreach (ColorScheme_mst objCol in colColor) { if (objCol.Percnt_to != 0) { if (percent >= objCol.Percnt && percent <= objCol.Percnt_to) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(objCol.Colorname); } } else { if (percent >= objCol.Percnt) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(objCol.Colorname); } } } } else { ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus("NonSLA"); foreach (ColorScheme_mst objCol in colColor) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(objCol.Colorname); } } } } #endregion #region Apply Color Coding to Close Calls if (varStatusClose.ToLower() == objStatus.Statusname.ToString().ToLower()) { ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus(varStatusClose); foreach (ColorScheme_mst obj in colColor) { try { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(obj.Colorname); } catch (Exception ex) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString("White"); } } } #endregion #region Apply Color Coding to On Hold Calls if (varStatusOnHold.ToLower() == objStatus.Statusname.ToString().ToLower()) { ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus(varStatusOnHold); foreach (ColorScheme_mst obj in colColor) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(obj.Colorname); } } #endregion #region Apply Color Coding to Resolved Calls if (varStatusResolved.ToLower() == objStatus.Statusname.ToString().ToLower()) { ColorScheme_mst objColor = new ColorScheme_mst(); colColor = objColor.Get_All_By_CallStatus(varStatusResolved); foreach (ColorScheme_mst obj in colColor) { e.Row.BackColor = (System.Drawing.Color)colConvert.ConvertFromString(obj.Colorname); } } #endregion } }
protected void grdvwProblem_RowDataBound(Object sender, GridViewRowEventArgs e) { //System.Drawing.ColorConverter colConvert = new ColorConverter(); //BLLCollection<ColorScheme_mst> colColor = new BLLCollection<ColorScheme_mst>(); if (e.Row.RowType == DataControlRowType.DataRow) { #region Autogenerate Serial number //Label lblSerial = (Label)e.Row.FindControl("lblSerial"); //lblSerial.Text = i.ToString(); //i++; #endregion int TotalTimeSpentonCall; int TotalResolutionTime; string varStatusOpen = Resources.MessageResource.strStatusOpen.ToString(); string varStatusClose = Resources.MessageResource.strStatusClose.ToString(); string varStatusOnHold = Resources.MessageResource.strStatusOnHold.ToString(); string varStatusResolved = Resources.MessageResource.strStatusResolved.ToString(); #region Bind Data Row at Run time with requesterid to Requester name int requesterid = Convert.ToInt32(e.Row.Cells[2].Text); objUser = objUser.Get_By_id(requesterid); if (objUser.Userid != 0) { e.Row.Cells[2].Text = objUser.Username.ToString(); } else { e.Row.Cells[2].Text = ""; } #endregion #region Bind Datarow at Run Time with Createdbyid to Created by name int createdbyid = Convert.ToInt32(e.Row.Cells[3].Text); objUser = objUser.Get_By_id(createdbyid); 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 technicianid to technician name int technicianid = Convert.ToInt32(e.Row.Cells[4].Text); objUser = objUser.Get_By_id(technicianid); 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 Statusid to Status int statusid = Convert.ToInt32(e.Row.Cells[5].Text); objStatus = objStatus.Get_By_id(statusid); if (objStatus.Statusid != 0) { e.Row.Cells[5].Text = objStatus.Statusname.ToString(); } else { e.Row.Cells[5].Text = ""; } #endregion #region Bind Datarow at run time with Priorityid to Priority int priorityid = Convert.ToInt32(e.Row.Cells[6].Text); objPriority = objPriority.Get_By_id(priorityid); if (objPriority.Priorityid != 0) { e.Row.Cells[6].Text = objPriority.Name.ToString(); } else { e.Row.Cells[6].Text = ""; } #endregion } }
protected void btnUpdate_Click(object sender, EventArgs e) { //Add Exception handilng try catch change by vishal 21-05-2012 try { # region Declare Local Variable string StrStatusRequested; string StrStatusRejected; string StrStatusApproval; string StrStatusApproved; string StrStatusPlanning; string StrStatusTesting; string StrStatusRelease; string StrStatusImplemented; string StrStatusCompleted; string StrStatusString = ""; int userid = 0; int changeid = Convert.ToInt32(Request.QueryString[0]); string userName = ""; #endregion #region Fetch the Status Value from Resource File StrStatusString = GetChangeStatusString(Convert.ToInt32(drpStatus.SelectedValue)); StrStatusRejected = Resources.MessageResource.StrRejected.ToString(); StrStatusApproval = Resources.MessageResource.StrApproval.ToString(); StrStatusRequested = Resources.MessageResource.StrRequested.ToString(); StrStatusApproved = Resources.MessageResource.StrApproved.ToString(); StrStatusPlanning = Resources.MessageResource.StrPlanning.ToString(); StrStatusTesting = Resources.MessageResource.StrTesting.ToString(); StrStatusRelease = Resources.MessageResource.StrRelease.ToString(); StrStatusImplemented = Resources.MessageResource.StrImplemented.ToString(); StrStatusCompleted = Resources.MessageResource.StrCompleted.ToString(); #endregion MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); #region On the basis of Username ,get Userid by calling Function Get_UserLogin_By_UserName(),via passing parameter Username and organizationid if (userName != "") { Objorganization = Objorganization.Get_Organization(); ObjUser = ObjUser.Get_UserLogin_By_UserName(userName, Objorganization.Orgid); if (ObjUser.Userid != 0) { userid = ObjUser.Userid; } } #endregion #region Insert Historyvalue in Change History Table int result = String.Compare(StrStatusString, StrStatusRequested, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Requested"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusRejected, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Rejected"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusApproval, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Approval"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusApproved, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Approved"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusPlanning, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Planning"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusTesting, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Testing"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusRelease, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Release"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusImplemented, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Implemented"; ObjChangeHistory.Insert(); } result = String.Compare(StrStatusString, StrStatusCompleted, true); if (result == 0) { ObjChangeHistory.Changeid = changeid; ObjChangeHistory.Operationownerid = userid; ObjChangeHistory.Operation = "Completed"; ObjChangeHistory.Insert(); } #endregion #region Get the Current historyid by calling function Get_Current_ProblemHistoryid() int historyid = ObjChangeHistory.Get_Current_ChangeHistoryid(); #endregion #region Find Current value of Problem aBy Calling Function Get_By_id(),via passing problemid ObjChange = ObjChange.Get_By_id(changeid); #endregion #region Insert into ChangeHistoryDiff table ,By Comparing Current value and Updated Values if (ObjChange.Changeid != 0) { #region Declare local variable string columnName; string prev_value; string curnt_value; #endregion #region If Priority value is changed,Insert into ChangeHistoryDiff table if (ObjChange.Priority != Convert.ToInt32(drpPriority.SelectedValue)) { columnName = Resources.MessageResource.strColumnPriorityid.ToString(); prev_value = Convert.ToString(ObjChange.Priority); curnt_value = Convert.ToString(drpPriority.SelectedValue); ObjChangeHistoryDiff.Historyid = historyid; ObjChangeHistoryDiff.Columnname = columnName; ObjChangeHistoryDiff.Current_value = curnt_value; ObjChangeHistoryDiff.Prev_value = prev_value; ObjChangeHistoryDiff.Insert(); } #endregion #region If Technician value is changed,Insert into ChangeHistoryDiff table if (ObjChange.Technician != Convert.ToInt32(drpTechnician.SelectedValue)) { columnName = Resources.MessageResource.strColumnTechnicianid.ToString(); prev_value = Convert.ToString(ObjChange.Technician); curnt_value = Convert.ToString(drpTechnician.SelectedValue); ObjChangeHistoryDiff.Historyid = historyid; ObjChangeHistoryDiff.Columnname = columnName; ObjChangeHistoryDiff.Current_value = curnt_value; ObjChangeHistoryDiff.Prev_value = prev_value; ObjChangeHistoryDiff.Insert(); } #endregion #region If category value is changed,Insert into ChangeHistoryDiff table if (ObjChange.Categoryid != Convert.ToInt32(drpCategory.SelectedValue)) { columnName = Resources.MessageResource.strColumnCategoryid.ToString(); prev_value = Convert.ToString(ObjChange.Categoryid); curnt_value = Convert.ToString(drpCategory.SelectedValue); ObjChangeHistoryDiff.Historyid = historyid; ObjChangeHistoryDiff.Columnname = columnName; ObjChangeHistoryDiff.Current_value = curnt_value; ObjChangeHistoryDiff.Prev_value = prev_value; ObjChangeHistoryDiff.Insert(); } #endregion #region If Subcategory value is changed,Insert into ChangeHistoryDiff table if (ObjChange.Subcategoryid != Convert.ToInt32(drpSubcategory.SelectedValue)) { columnName = Resources.MessageResource.strColumnSubcategoryid.ToString(); prev_value = Convert.ToString(ObjChange.Subcategoryid); curnt_value = Convert.ToString(drpSubcategory.SelectedValue); ObjChangeHistoryDiff.Historyid = historyid; ObjChangeHistoryDiff.Columnname = columnName; ObjChangeHistoryDiff.Current_value = curnt_value; ObjChangeHistoryDiff.Prev_value = prev_value; ObjChangeHistoryDiff.Insert(); } #endregion #region If Changetype value is changed,Insert into ChangeHistoryDiff table if (ObjChange.Changetype != Convert.ToInt32(drpchangetype.SelectedValue)) { columnName = Resources.MessageResource.strColumnChangeType.ToString(); prev_value = Convert.ToString(ObjChange.Changetype); curnt_value = Convert.ToString(drpchangetype.SelectedValue); ObjChangeHistoryDiff.Historyid = historyid; ObjChangeHistoryDiff.Columnname = columnName; ObjChangeHistoryDiff.Current_value = curnt_value; ObjChangeHistoryDiff.Prev_value = prev_value; ObjChangeHistoryDiff.Insert(); } #endregion #region If Changestatus value is changed,Insert into ChangeHistoryDiff table if (ObjChange.Changetype != Convert.ToInt32(drpStatus.SelectedValue)) { columnName = Resources.MessageResource.strColumnstatusid.ToString(); prev_value = Convert.ToString(ObjChange.Statusid); curnt_value = Convert.ToString(drpStatus.SelectedValue); ObjChangeHistoryDiff.Historyid = historyid; ObjChangeHistoryDiff.Columnname = columnName; ObjChangeHistoryDiff.Current_value = curnt_value; ObjChangeHistoryDiff.Prev_value = prev_value; ObjChangeHistoryDiff.Insert(); } #endregion } #endregion #region Update the completed status #endregion #region update the data in change_mst table ObjChange.Technician = Convert.ToInt32(drpTechnician.SelectedValue); ObjChange.Categoryid = Convert.ToInt32(drpCategory.SelectedValue); ObjChange.Subcategoryid = Convert.ToInt32(drpSubcategory.SelectedValue); ObjChange.Priority = Convert.ToInt32(drpPriority.SelectedValue); ObjChange.Changetype = Convert.ToInt32(drpchangetype.SelectedValue); ObjChange.Statusid = Convert.ToInt32(drpStatus.SelectedValue); ObjChange.Changeid = Convert.ToInt32(Request.QueryString[0]); ObjChange.Active = true; #region If Current status is closed,then Assign Completed time result = String.Compare(StrStatusString, StrStatusCompleted, true); if (result == 0) { BLLCollection<Incident_To_Change> colincidentchnage = new BLLCollection<Incident_To_Change>(); colincidentchnage = Objincidenttochange.Get_All_By_Changeid(changeid); int id = 0; foreach (Incident_To_Change objitoc in colincidentchnage) { id = Convert.ToInt32(objitoc.Incidentid); } IncidentStates objstate = new IncidentStates(); objstate = objstate.Get_By_id(id); Status_mst objincidentstats = new Status_mst(); objincidentstats = objincidentstats.Get_By_id(objstate.Statusid); string currentincidentstatus = objincidentstats.Statusname.ToString(); int comparestatus = String.Compare(currentincidentstatus, Resources.MessageResource.strStatusClose.ToString(), true); if (comparestatus == 0) { ObjChange.Completedtime = DateTime.Now.ToString(); Change_mst Objcurrentchange = new Change_mst(); ChangeStatus_mst Objchangestatus = new ChangeStatus_mst(); Objcurrentchange = Objcurrentchange.Get_By_id(changeid); Objchangestatus = Objchangestatus.Get_By_id(Objcurrentchange.Statusid); string status = Objchangestatus.Statusname.ToString(); int result1 = String.Compare(status, StrStatusCompleted, true); if (result1 == 0) { ObjChange.Completedtime = Objcurrentchange.Completedtime; ObjChange.Update(); } else { ObjChange.Completedtime = DateTime.Now.ToString(); ObjChange.Update(); } } else { string myScript; //myScript = "<script language=javascript>javascript:alert('Please Close All the Attached Incident');</script>"; ScriptManager.RegisterStartupScript(this, this.GetType(), "Javascript:alert('Please Close Alll the attached incident');", "Javascript:alert('Please Close Alll the attached incident');", true); ///'''Page.RegisterClientScriptBlock("MyScript", myScript); } } else { #endregion ObjChange.Update(); } #endregion // #region Update Include Assets in Change value in IncludedAssetinchange //objincludeasset.Delete(changeid); //for (int i = lstassetupdate.Items.Count - 1; i >= 0; i--) //{ // if (lstassetupdate.Items[i].Selected == true) // { // objincludeasset.Assetid = Convert.ToInt32(lstassetupdate.Items[i].Value); // objincludeasset.Changeid = changeid; // objincludeasset.Insert(); // } //} //#endregion Showchangeinfo(); btnUpdate.Visible = false; btnCancel.Visible = false; }
public object GenerateStatus_mstObject(ref IDataReader returnData) { Status_mst obj = new Status_mst(); while (returnData.Read()) { obj.Statusid = (int)returnData["Statusid"]; obj.Statusname = (string)returnData["Statusname"]; obj.Description = (string)returnData["Description"]; } returnData.Close(); returnData.Dispose(); return obj; }
string GetStatusString(int statusid) { string statusname = ""; objStatus = objStatus.Get_By_id(statusid); if (objStatus.Statusid != 0) { statusname = objStatus.Statusname; } return statusname; }
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 } }
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 = ""; } }
protected void btnUpdate_Click(object sender, EventArgs e) { #region Get problemid from QueryString int problemid = Convert.ToInt16(Request.QueryString[0]); #endregion #region Declare Local Variable // Declare local Variable int historyid; int varTotalTimeSpentonCall = 0; int SLAid; string userName; int userid = 0; string strCreateDatetime = ""; string statusString; string strStatusOpen; string strStatusClose; string strStatusResolved; string strStatusOnHold; bool FlagTechnicianId; bool FlagCloseStatus; int requesttypeid; string OldStatusString; FlagTechnicianId = false; FlagCloseStatus = false; string oldCompletedTime = ""; Incident_mst objIncidentOld = new Incident_mst(); Problem_mst objproblemstatusold = new Problem_mst(); objproblemstatusold = objproblemstatusold.Get_By_id(problemid); string VarResolutionAdded = ""; #endregion #region Fetch Current User // Fetch Current User and assign to local variable userName MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); #endregion #region Fetch Data from MessageResource file and assign to Local Variable statusString = GetStatusString(Convert.ToInt16(drpStatus.SelectedValue)); strStatusOpen = Resources.MessageResource.strStatusOpen.ToString().Trim(); strStatusClose = Resources.MessageResource.strStatusClose.ToString().Trim(); strStatusResolved = Resources.MessageResource.strStatusResolved.ToString().Trim(); strStatusOnHold = Resources.MessageResource.strStatusOnHold.ToString().Trim(); #endregion #region On the basis of Username ,get Userid by calling Function Get_UserLogin_By_UserName(),via passing parameter Username and organizationid if (userName != "") { Objorganization = Objorganization.Get_Organization(); ObjUser = ObjUser.Get_UserLogin_By_UserName(userName, Objorganization.Orgid); if (ObjUser.Userid != 0) { userid = ObjUser.Userid; } } #endregion #region Insert value in IncidentHistory Table ,for every update of Page if (statusString.ToLower() == strStatusClose.ToLower()) { ObjProblemHistory.Problemid = problemid; ObjProblemHistory.Operationownerid = userid; ObjProblemHistory.Operation = "closed"; ObjProblemHistory.Insert(); } else if (statusString.ToLower() == strStatusResolved.ToLower()) { ObjProblemHistory.Problemid = problemid; ObjProblemHistory.Operationownerid = userid; ObjProblemHistory.Operation = "resolved"; ObjProblemHistory.Insert(); } else { ObjProblemHistory.Problemid = problemid; ObjProblemHistory.Operationownerid = userid; ObjProblemHistory.Operation = "update"; ObjProblemHistory.Insert(); } #endregion #region Get the Current historyid by calling function Get_Current_ProblemHistoryid() historyid = ObjProblemHistory.Get_Current_ProblemHistoryid(); #endregion #region Find Current value of Problem aBy Calling Function Get_By_id(),via passing problemid ObjProblem = ObjProblem.Get_By_id(problemid); #endregion #region Insert into IncidentHistoryDiff table ,By Comparing Current value and Updated Values if (ObjProblem.ProblemId != 0) { #region Declare local variable string columnName; string prev_value; string curnt_value; #endregion #region If Priority value is changed,Insert into IncidentHistoryDiff table if (ObjProblem.Priorityid != Convert.ToInt16(drpPriority.SelectedValue)) { columnName = Resources.MessageResource.strColumnPriorityid.ToString(); prev_value = Convert.ToString(ObjProblem.Priorityid); curnt_value = Convert.ToString(drpPriority.SelectedValue); ObjProblemHistoryDiff.Historyid = historyid; ObjProblemHistoryDiff.Columnname = columnName; ObjProblemHistoryDiff.Current_value = curnt_value; ObjProblemHistoryDiff.Prev_value = prev_value; ObjProblemHistoryDiff.Insert(); } #endregion #region If Category value is changed,Insert into IncidentHistoryDiff table if (ObjProblem.Categoryid != Convert.ToInt16(drpCategory.SelectedValue)) { columnName = Resources.MessageResource.strColumnCategoryid.ToString(); prev_value = Convert.ToString(ObjProblem.Categoryid); curnt_value = Convert.ToString(drpCategory.SelectedValue); ObjProblemHistoryDiff.Historyid = historyid; ObjProblemHistoryDiff.Columnname = columnName; ObjProblemHistoryDiff.Current_value = curnt_value; ObjProblemHistoryDiff.Prev_value = prev_value; ObjProblemHistoryDiff.Insert(); } #endregion #region If SubCategory value is changed,Insert into IncidentHistoryDiff table if (ObjProblem.Subcategoryid != Convert.ToInt16(drpSubcategory.SelectedValue)) { columnName = Resources.MessageResource.strColumnSubcategoryid.ToString(); prev_value = Convert.ToString(ObjProblem.Subcategoryid); curnt_value = Convert.ToString(drpSubcategory.SelectedValue); ObjProblemHistoryDiff.Historyid = historyid; ObjProblemHistoryDiff.Columnname = columnName; ObjProblemHistoryDiff.Current_value = curnt_value; ObjProblemHistoryDiff.Prev_value = prev_value; ObjProblemHistoryDiff.Insert(); } #endregion #region If Status value is changed,Insert into IncidentHistoryDiff table if (ObjProblem.Statusid != Convert.ToInt16(drpStatus.SelectedValue)) { string Statusprev; string StatusCurrent; columnName = Resources.MessageResource.strColumnstatusid.ToString(); prev_value = Convert.ToString(ObjProblem.Statusid); curnt_value = Convert.ToString(drpStatus.SelectedValue); ObjProblemHistoryDiff.Historyid = historyid; ObjProblemHistoryDiff.Columnname = columnName; ObjProblemHistoryDiff.Current_value = curnt_value; ObjProblemHistoryDiff.Prev_value = prev_value; ObjProblemHistoryDiff.Insert(); Statusprev = GetStatusString(Convert.ToInt16(objproblemstatusold.Statusid)); StatusCurrent = GetStatusString(Convert.ToInt16(drpStatus.SelectedValue)); if (Statusprev == strStatusOpen && StatusCurrent == strStatusOnHold) { columnName = Resources.MessageResource.strColumnStarttime.ToString(); prev_value = "0"; curnt_value = DateTime.Now.ToString(); ObjProblemHistoryDiff.Historyid = historyid; ObjProblemHistoryDiff.Columnname = columnName; ObjProblemHistoryDiff.Current_value = curnt_value; ObjProblemHistoryDiff.Prev_value = prev_value; ObjProblemHistoryDiff.Insert(); } if (Statusprev == strStatusOnHold && StatusCurrent != strStatusOnHold) { columnName = Resources.MessageResource.srColumnEndtime.ToString(); prev_value = "0"; curnt_value = DateTime.Now.ToString(); ObjProblemHistoryDiff.Historyid = historyid; ObjProblemHistoryDiff.Columnname = columnName; ObjProblemHistoryDiff.Current_value = curnt_value; ObjProblemHistoryDiff.Prev_value = prev_value; ObjProblemHistoryDiff.Insert(); } } #endregion #region If technician value is changed,Insert into IncidentHistoryDiff table if (ObjProblem.Technicianid != Convert.ToInt16(drpTechnician.SelectedValue)) { columnName = Resources.MessageResource.strColumnTechnicianid.ToString(); prev_value = Convert.ToString(ObjProblem.Technicianid); curnt_value = Convert.ToString(drpTechnician.SelectedValue); ObjProblemHistoryDiff.Historyid = historyid; ObjProblemHistoryDiff.Columnname = columnName; ObjProblemHistoryDiff.Current_value = curnt_value; ObjProblemHistoryDiff.Prev_value = prev_value; ObjProblemHistoryDiff.Insert(); objSentMailToUser.SentMailToTechnicianForProblemCall(problemid, Convert.ToInt16(drpTechnician.SelectedValue)); if (objproblemstatusold.AssginedTime == null) { columnName = Resources.MessageResource.strColumnAssignedTime.ToString(); prev_value = "0"; curnt_value = DateTime.Now.ToString(); ObjProblemHistoryDiff.Historyid = historyid; ObjProblemHistoryDiff.Columnname = columnName; ObjProblemHistoryDiff.Current_value = curnt_value; ObjProblemHistoryDiff.Prev_value = prev_value; ObjProblemHistoryDiff.Insert(); } else { columnName = "AssignedTime"; prev_value = objproblemstatusold.AssginedTime; curnt_value = DateTime.Now.ToString(); ObjProblemHistoryDiff.Historyid = historyid; ObjProblemHistoryDiff.Columnname = columnName; ObjProblemHistoryDiff.Current_value = curnt_value; ObjProblemHistoryDiff.Prev_value = prev_value; ObjProblemHistoryDiff.Insert(); } FlagTechnicianId = true; } #endregion } #endregion #region Update values in Problem Table ObjProblemnew.ProblemId = problemid; ObjProblemnew.Technicianid = Convert.ToInt16(drpTechnician.SelectedValue); ObjProblemnew.Statusid = Convert.ToInt16(drpStatus.SelectedValue); ObjProblemnew.Priorityid = Convert.ToInt16(drpPriority.SelectedValue); ObjProblemnew.Categoryid = Convert.ToInt16(drpCategory.SelectedValue); ObjProblemnew.Subcategoryid = Convert.ToInt16(drpSubcategory.SelectedValue); ObjProblemnew.Active = true; if (ObjProblem.Technicianid != Convert.ToInt16(drpTechnician.SelectedValue)) { ObjProblemnew.AssginedTime = DateTime.Now.ToString(); } else { ObjProblemnew.AssginedTime = ObjProblem.AssginedTime; } #region If Current status is closed,then Assign Completed time if (statusString.ToLower() == strStatusClose.ToLower()) { #region If FlagCloseStatus=flase ie Currrent status is closed ,and old status is not Closed int status = ObjProblem.Statusid; ObjStatus = ObjStatus.Get_By_id(status); if (ObjStatus.Statusname == "closed") { ObjProblemnew.Closedatetime = ObjProblem.Closedatetime; // varTotalTimeSpentonCall = objIncident.Get_TimeSpentonRequest(incidentid, Convert.ToInt16(drpSite.SelectedValue), strCreateDatetime, DateTime.Now.ToString()); //CalculateTotalTimeofRequest(); //varTotalTimeSpentonCall = objIncident.Get_TimeSpentonRequest(strCreateDatetime, DateTime.Now.ToString()); } else { ObjProblemnew.Closedatetime = DateTime.Now.ToString(); //varTotalTimeSpentonCall = objIncident.Get_TimeSpentonRequest(strCreateDatetime, oldCompletedTime); // varTotalTimeSpentonCall = objIncident.Get_TimeSpentonRequest(incidentid, Convert.ToInt16(drpSite.SelectedValue), strCreateDatetime, oldCompletedTime); } #endregion } #endregion ObjProblemnew.Update(); #endregion Showproblempanal(); LogNoteUpdatePanel(); HistoryUpdatePanel(); }
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 int Update_Status_mst_By_id(Status_mst objStatus) { return (int)ExecuteNonQuery(Sp_Status_Update, new object[] { objStatus.Statusname, objStatus.Statusid, objStatus.Description }); }
public int Insert_Status_mst(Status_mst objStatus) { return (int)ExecuteNonQuery(Sp_Status_Insert, new object[] { objStatus.Statusname, objStatus.Statusid, objStatus.Description }); }
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 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 } }
protected void grdvwincidentproblem_RowDataBound(Object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { if (colIncidentToProblem.Count != 0) { int requesterid = Convert.ToInt16(e.Row.Cells[2].Text); ObjUser = ObjUser.Get_By_id(requesterid); if (ObjUser.Userid != 0) { e.Row.Cells[2].Text = ObjUser.Username.ToString(); } else { e.Row.Cells[2].Text = ""; } #region Bind Datarow at Run Time with technicianid to technician name int technicianid = Convert.ToInt16(e.Row.Cells[3].Text); ObjUser = ObjUser.Get_By_id(technicianid); 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 Statusid to Status int statusid = Convert.ToInt16(e.Row.Cells[4].Text); ObjStatus = ObjStatus.Get_By_id(statusid); if (ObjStatus.Statusid != 0) { e.Row.Cells[4].Text = ObjStatus.Statusname.ToString(); } else { e.Row.Cells[4].Text = ""; } #endregion } else { e.Row.Cells[6].Visible = false; e.Row.Cells[3].Text = "No Record Found"; } } }
public CollectionBase GenerateStatus_mstCollection(ref IDataReader returnData) { BLLCollection<Status_mst> col = new BLLCollection<Status_mst>(); while (returnData.Read()) { Status_mst obj = new Status_mst(); obj.Statusid = (int)returnData["statusid"]; obj.Description = (string)returnData["description"]; obj.Statusname = (string)returnData["statusname"]; col.Add(obj); } returnData.Close(); returnData.Dispose(); return col; }