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(); }
public void SentmailUser(int userid, int incidentid, string status) { objIncident = objIncident.Get_By_id(incidentid); //added by lalit 02 nov to get resolution and show it to user when call closed mail goes to user objIncidentResolution = objIncidentResolution.Get_By_id(incidentid); //end objSite = objSite.Get_By_id(objIncident.Siteid); objAreaManager = objAreaManager.Get_By_id(objSite.Siteid); objIncidentStates = objIncidentStates.Get_By_id(incidentid); objPriority = objPriority.Get_By_id(objIncidentStates.Priorityid); objUser = objUser.Get_By_id(objIncident.Requesterid); objC_info = objC_info.Get_By_id(userid); objtech = objtech.Get_By_id(objIncidentStates.Technicianid); colemailid = objemail.Get_All_userid(userid); string strStatusOpen = Resources.MessageResource.strStatusOpen.ToString(); string strStatusClose = Resources.MessageResource.strStatusClose.ToString(); string strYourSinscerely = Resources.MessageResource.strYourSinscerely.ToString(); string strContactNumber = Resources.MessageResource.strContactNumber.ToString(); if (strStatusOpen.ToLower() == status.ToLower()) { foreach (UserEmail obj1 in colemailid) { if (obj1.Emailid != null) { obj.From = Resources.MessageResource.strAdminEmail.ToString(); obj.To = obj1.Emailid; obj.CC = objAreaManager.Email; obj.Subject = "Call Logged. Ticket Id : " + incidentid; obj.Body = "Dear " + objC_info.Firstname + ",<br/><br/> Thank you for contacting IT Service desk, please find below the new Ticket Id details for your future reference.<br/><br/><b>Incident Details : </b> <br/><br/><b>Ticket Id :</b> " + incidentid + "<br/><b>Site :</b> " + objSite.Sitename + "<br/><b>Logged Date & Time :</b> " + objIncident.Createdatetime + "<br/><b>Description :</b> " + objIncident.Description + "<br/><b>Priority :</b> " + objPriority.Name + "<br/><b>Username :</b> " + objUser.Username + "<br/><b>EstimatedResolutionTime :</b> " + GetResolutionTimeInHours(objIncident.Slaid) + "<br/><b>Email Address :</b> " + objC_info.Emailid + "<br/><br/> For any other support, kindly get in touch with us at " + strContactNumber + ".<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> " + strYourSinscerely + "</b>"; obj.SmtpServer = Resources.MessageResource.strSMTPServer.ToString(); obj.SentMail(); string varPriority = Resources.MessageResource.strPriorityHigh.ToString(); if (objPriority.Priorityid != 0) { if (objPriority.Name.ToLower() == varPriority.ToLower()) { SentMailToSDM(objSite.Siteid, incidentid, objUser.Userid); } } } } //if (objC_info.Emailid != null) //{ // obj.From = Resources.MessageResource.strAdminEmail.ToString(); // obj.To = objC_info.Emailid; // obj.Subject = " New Call Logged. Ticket Id : " + incidentid; // obj.Body = "Dear User,<br/> Thank you for contacting Service desk, please find below the Ticket Id details for your future reference.<br/><br/><b>Complaints Details : </b> <br/><br/><b>Ticket Id :</b>" + incidentid + "<br/><b>Title of Call :</b>" + objIncident.Title + " <br/><b>Site :</b>" + objSite.Sitename + "<br/><b>Logged Date & Time   :</b>" + objIncident.Createdatetime + "<br/><b>Description :</b>" + objIncident.Description + "<br/><b>Priority :</b> " + objPriority.Name + "<br/><b>UserName :</b>" + objUser.Username + "<br/><b>Mail Address :</b>" + objC_info.Emailid + "<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 = Resources.MessageResource.strSMTPServer.ToString(); // //obj.SentMail(); // string varPriority = Resources.MessageResource.strPriorityHigh.ToString(); // if (objPriority.Priorityid != 0) // { // if (objPriority.Name.ToLower() == varPriority.ToLower()) // { // SentMailToSDM(objSite.Siteid, incidentid, objUser.Userid); // } // } //} } if (strStatusClose.ToLower() == status.ToLower()) { foreach (UserEmail obj1 in colemailid) { if (obj1.Emailid != null) { int id = Convert.ToInt16(objIncident.Incidentid); string varServerName1; string varfeedbackmode; varServerName1 = Resources.MessageResource.serverNameForChangePage.ToString(); //added by lalit to check feedback mode. feedback should add in mail or not. //fetching value from resouce file which is from appsettting page. varfeedbackmode = Resources.MessageResource.UserFeedbackmode.ToString(); string url11; url11 = "http://" + varServerName1 + "/" + getpath() + "/LoginPageAccess/CustomerFeedback.aspx?userid=" + userid + "&Clid=" + objIncident.Incidentid; //url11 = "../LoginPageAccess/CustomerFeedback.aspx?userid=" + userid + "&Clid=" + objIncident.Incidentid; if (objC_info.Emailid != null) { // string url; // url = "<a href=" + url11 + "&userid=" + objC_info.Firstname + " ' onclick=window.open()>Your Feedback</a>"; string url = "<a href=" + url11 + " ' onclick=window.open()>Your Feedback</a>"; obj.From = Resources.MessageResource.strAdminEmail.ToString(); obj.To = obj1.Emailid; obj.CC = objAreaManager.Email; obj.Subject = "Call Closed Ticket id : " + incidentid; //added by lalit if (varfeedbackmode == "0") //0 means default mode where user will not recieve link in mail to give feedback { obj.Body = "Dear " + objC_info.Firstname + ",<br/><br/> <b>Incident Status:</b> Issue Resolved and call closed by <b>" + objtech.Username + "</b> on <b>" + objIncident.Completedtime + ".<br/><br/></b>We are pleased to confirm that the Service Call reported by you has been attended and resolved, should there be any further questions or queries, please do not hesitate to contact the Service Desk." + "<br/><br/><b>Incident Details : </b> <br/><br/><b>Ticket Id :</b> " + incidentid + "<br/><b>Site :</b> " + objSite.Sitename + "<br/><b>Logged Date & Time :</b> " + objIncident.Createdatetime + "<br/><b>Closed Date & Time :</b> " + objIncident.Completedtime + "<br/><b>Description :</b> " + objIncident.Description + "<br/><b>Resolution :</b> " + objIncidentResolution.Resolution + "<br/><b>Priority :</b> " + objPriority.Name + "<br/><b>Username :</b> " + objUser.Username + "<br/><b>Email Address :</b> " + objC_info.Emailid + "<br/><br/> For any other support, kindly get in touch with us at " + strContactNumber + ".<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b>" + strYourSinscerely + "</b>"; } else { obj.Body = "Dear " + objC_info.Firstname + ",<br/><br/> <b>Incident Status:</b> Issue Resolved and call closed by <b>" + objtech.Username + "</b> on <b>" + objIncident.Completedtime + ".<br/><br/></b>We are pleased to confirm that the Service Call reported by you has been attended and resolved, should there be any further questions or queries, please do not hesitate to contact the Service Desk." + "<br/><br/><b>Incident Details : </b> <br/><br/><b>Ticket Id :</b> " + incidentid + "<br/><b>Site :</b> " + objSite.Sitename + "<br/><b>Logged Date & Time :</b> " + objIncident.Createdatetime + "<br/><b>Closed Date & Time :</b> " + objIncident.Completedtime + "<br/><b>Description :</b> " + objIncident.Description + "<br/><b>Resolution :</b> " + objIncidentResolution.Resolution + "<br/><b>Priority :</b> " + objPriority.Name + "<br/><b>Username :</b> " + objUser.Username + "<br/><b>Email Address :</b> " + objC_info.Emailid + "<br/><br/> For any other support, kindly get in touch with us at " + strContactNumber + ".<br/><br/>To give feedback click on " + url + ".<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b>" + strYourSinscerely + "</b>"; } obj.SmtpServer = Resources.MessageResource.strSMTPServer.ToString(); obj.SentMail(); } } } //int id = Convert.ToInt16(objIncident.Incidentid); //string varServerName1; //varServerName1 = Resources.MessageResource.serverNameForChangePage.ToString(); //// varServerName = "10.80.0.15"; //string url11; //url11 = "http://" + varServerName1 + "/BESTN/LoginPageAccess/CustomerFeedback.aspx?incident=" + id; //if (objC_info.Emailid != null) //{ // string url; // url = "<a href=" + url11 + "&userid=" + objC_info.Firstname + " ' onclick=window.open()>Your Feedback</a>"; // obj.From = Resources.MessageResource.strAdminEmail.ToString(); // obj.To = objC_info.Emailid; // obj.Subject = "Call Closed Ticket id : " + incidentid; // obj.Body = "Dear User,<br/> <b>Complaint Status:</b>Problem solved and call closed by <b>" + objtech.Username + "</b> on <b>" + objIncident.Completedtime + "</b>.We are pleased to inform you that your reported Service Call has been attended and problem solved as informed by our engineer.<br/>Should there be any further questions or queries, please do not hesitate to contact the Service Desk on 0120 4393941, quoting your Ticket Reference Number. " + "<br/><br/><b>Complaints Details : </b> <br/><br/><b>Ticket Id :</b>" + incidentid + "<br/><b>Title of Call :</b>" + objIncident.Title + " <br/><b>Site :</b>" + objSite.Sitename + "</br><b>Logged Date & Time   :</b>" + objIncident.Createdatetime + "<br/><b>Description :</b>" + objIncident.Description + "<br/><b>Priority :</b> " + objPriority.Name + "<br/><b>UserName :</b>" + objUser.Username + "<br/><b>Mail Address :</b>" + objC_info.Emailid + "<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>Your Feedback</b><br/><br/>" + url + "<br/><br/><b>Yours sincerely,</b><br/> <b>" + strYourSinscerely + "</b>"; // obj.SmtpServer = obj.SmtpServer = Resources.MessageResource.strSMTPServer.ToString(); // // obj.SentMail(); //} } }
protected void btnResolution_Click(object sender, EventArgs e) { /////Add Exception handilng try catch change by vishal 21-05-2012 try { int userid = 0; string userName; MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); if (userName != "") { objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { userid = objUser.Userid; } } IncidentResolution objIncidentResolution = new IncidentResolution(); #region Get incidentid from QueryString int incidentid = Convert.ToInt32(Request.QueryString[0]); #endregion #region Check Is Resolution Exist in Database objIncidentResolution = objIncidentResolution.Get_By_id(incidentid); #endregion #region Add Resolution in Database string varResolution; varResolution = Editor.Text; objIncidentResolution.Incidentid = incidentid; objIncidentResolution.Lastupdatetime = DateTime.Now.ToString(); objIncidentResolution.Resolution = varResolution; objIncidentResolution.Userid = userid; objIncidentResolution.Insert(); Editor.Text = ""; ShowResolution(); #endregion } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void btnResolution_Click(object sender, EventArgs e) { int userid = 0; string userName; MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); if (userName != "") { objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { userid = objUser.Userid; } } IncidentResolution objIncidentResolution = new IncidentResolution(); #region Get incidentid from QueryString int incidentid = Convert.ToInt16(Request.QueryString[0]); #endregion #region Check Is Resolution Exist in Database objIncidentResolution = objIncidentResolution.Get_By_id(incidentid); #endregion #region Add Resolution in Database string varResolution; varResolution = Editor.Text; objIncidentResolution.Incidentid = incidentid; objIncidentResolution.Lastupdatetime = DateTime.Now.ToString(); objIncidentResolution.Resolution = varResolution; objIncidentResolution.Userid = userid; objIncidentResolution.Insert(); Editor.Text = ""; ShowResolution(); #endregion }