protected void Page_Load(object sender, EventArgs e) { //Add Exception handilng try catch change by vishal 21-05-2012 try { if (!IsPostBack) { int problemid = Convert.ToInt32(Request.QueryString[1]); int flag = Convert.ToInt32(Request.QueryString[0]); Objproblem = Objproblem.Get_By_id(problemid); txtTitle.Text = Objproblem.title.ToString(); BindDrpCategory(); if (flag == 3) { updateSolution(); } if (flag == 4) { updateWorkaround(); } } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
public void SentMailToTechnicianForProblemCall(int problemid, int userid) { string strYourSinscerely = Resources.MessageResource.strYourSinscerely.ToString(); string strContactNumber = Resources.MessageResource.strContactNumber.ToString(); Problem_mst objProblem = new Problem_mst(); objUser = objUser.Get_By_id(userid); ContactInfo_mst objCont_info = new ContactInfo_mst(); objCont_info = objCont_info.Get_By_id(objUser.Userid); objProblem = objProblem.Get_By_id(problemid); objPriority = objPriority.Get_By_id(objProblem.Priorityid); UserLogin_mst objReq = new UserLogin_mst(); objReq = objReq.Get_By_id(objProblem.Requesterid); ContactInfo_mst objReqCont = new ContactInfo_mst(); objReqCont = objReqCont.Get_By_id(objReq.Userid); objSDE = objSDE.Get_By_id(objProblem.CreatedByid); if (objCont_info.Emailid != null) { obj.To = objCont_info.Emailid; obj.From = Resources.MessageResource.strAdminEmail.ToString(); obj.Subject = " New Problem Call Assigned to you. Problem Id : " + problemid; obj.Body = "Dear " + objUser.Username + "," + "<br/> A Call with the following details have been assigned to you.<br/><br/><b>Problem Details : </b> <br/><br/><b>Problem Id :</b>" + objProblem.ProblemId + "<br/><b>Title of Call :</b>" + objProblem.title + " <br/><b>Logged Date & Time   :</b>" + objProblem.CreateDatetime + "<br/><b>Description :</b>" + objProblem.Description + "<br/><b>Priority :</b> " + objPriority.Name + "<br/><b>UserName :</b>" + objReq.Username + "<br/><b>Mobile No. :<b/>" + objReqCont.Mobile + "<br/><b>Landline No. :<b/>" + objReqCont.Landline + "<br/><b>Mail Address :</b>" + objReqCont.Emailid + "<br/><b>Service Desk Executive :</b>" + objSDE.Username + "<br/><br/> For any other support kindly get in touch with us at <b>" + strContactNumber + "</b>.<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/> <b>" + strYourSinscerely + "</b>"; obj.SmtpServer = obj.SmtpServer = Resources.MessageResource.strSMTPServer.ToString(); obj.SentMail(); } }
protected void btnCancell_Click(object sender, EventArgs e) {//Add Exception handilng try catch change by vishal 21-05-2012 try { #region Fetch Each Row from GridView,and Check Which Check Box is Selected foreach (GridViewRow gv in grdvwProblem.Rows) { string gvIDs; #region Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec"); #endregion #region If deleteChkBxItem is Checked then ,mapped Current site to this user if (deleteChkBxItem.Checked) { #region Declare local Variables int Problemid; int varSiteid; int oldtechnicianvalue; #endregion #region Get the Problemid from variable of Label type declare in GridView of grdvwSite gvIDs = ((Label)gv.FindControl("Problemid")).Text.ToString(); #endregion #region Convert to incident id into integer Problemid = Convert.ToInt32(gvIDs); #endregion #region If Incident id in Not Null if (gvIDs != "") { Problem_mst Obj = new Problem_mst(); Obj = ObjProblem.Get_By_id(Problemid); if (Obj.ProblemId != 0) { Obj.Active = false; Obj.Update(); } } #endregion } #endregion } BindGridForAllParameter(); #endregion } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void Showvalues() { int problemid = Convert.ToInt16(Session["problemid"]); ObjProblem = ObjProblem.Get_By_id(problemid); drpTechnician.SelectedValue = ObjProblem.Technicianid.ToString(); drpCategory.SelectedValue = ObjProblem.Categoryid.ToString(); BindDropSubCategory(); drpSubcategory.SelectedValue = ObjProblem.Subcategoryid.ToString(); drpPriority.SelectedValue = ObjProblem.Priorityid.ToString(); txtTitle.Text = ObjProblem.title.ToString(); txtDescription.Text = ObjProblem.Description.ToString(); ObjUserLogin = ObjUserLogin.Get_By_id(ObjProblem.Requesterid); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { int problemid = Convert.ToInt16(Request.QueryString[1]); int flag = Convert.ToInt16(Request.QueryString[0]); Objproblem = Objproblem.Get_By_id(problemid); txtTitle.Text = Objproblem.title.ToString(); BindDrpCategory(); if (flag == 3) { updateSolution(); } if (flag == 4) { updateWorkaround(); } } }
protected void btnCancell_Click(object sender, EventArgs e) { #region Fetch Each Row from GridView,and Check Which Check Box is Selected foreach (GridViewRow gv in grdvwProblem.Rows) { string gvIDs; #region Declare local variable deleteChkBxItem of Checkbox type to get the Checkbox Instance of Grid Row CheckBox deleteChkBxItem = (CheckBox)gv.FindControl("deleteRec"); #endregion #region If deleteChkBxItem is Checked then ,mapped Current site to this user if (deleteChkBxItem.Checked) { #region Declare local Variables int Problemid; int varSiteid; int oldtechnicianvalue; #endregion #region Get the Problemid from variable of Label type declare in GridView of grdvwSite gvIDs = ((Label)gv.FindControl("Problemid")).Text.ToString(); #endregion #region Convert to incident id into integer Problemid = Convert.ToInt16(gvIDs); #endregion #region If Incident id in Not Null if (gvIDs != "") { Problem_mst Obj = new Problem_mst(); Obj = ObjProblem.Get_By_id(Problemid); if (Obj.ProblemId != 0) { Obj.Active = false; Obj.Update(); } } #endregion } #endregion } BindGridForAllParameter(); #endregion }
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; } }