protected void Page_Load(object sender, EventArgs e) { //Add Exception handilng try catch change by vishal 21-05-2012 try { if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } } XmlDataSource ds = new XmlDataSource(); ds.EnableCaching = false; ds.DataFile = Server.MapPath("../Files/Admin.xml"); TreeView1.DataSource = ds; TreeView1.DataBind(); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
public void SentmailTechnician(int technicianid, int incidentid) { string strYourSinscerely = Resources.MessageResource.strYourSinscerely.ToString(); string strContactNumber = Resources.MessageResource.strContactNumber.ToString(); objIncident = objIncident.Get_By_id(incidentid); objSite = objSite.Get_By_id(objIncident.Siteid); objIncidentStates = objIncidentStates.Get_By_id(incidentid); objPriority = objPriority.Get_By_id(objIncidentStates.Priorityid); objUser = objUser.Get_By_id(objIncident.Requesterid); objtech = objtech.Get_By_id(technicianid); objSDE = objSDE.Get_By_id(objIncident.Createdbyid); objC_info = objC_info.Get_By_id(technicianid); objUserInfo = objUserInfo.Get_By_id(objIncident.Requesterid); if (objC_info.Emailid != null) { obj.To = objC_info.Emailid; obj.From = Resources.MessageResource.strAdminEmail.ToString(); obj.Subject = " New Call Assigned to you. Ticket id : " + incidentid; obj.Body = "Dear " + objtech.Username + "," + "<br/> A Call with the following details have been assigned to you.<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>Mobile No. :<b/>" + objUserInfo.Mobile + "<br/><b>Landline No. :<b/>" + objUserInfo.Landline + "<br/><b>Mail Address :</b>" + objC_info.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 Page_Load(object sender, EventArgs e) {///Add Exception handilng try catch change by vishal 21-05-2012 try { //lblUser.Text = Session["User"].ToString(); if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void GetUserDetail() { string userName = ""; MembershipUser User = Membership.GetUser(); if (User != null) { userName = User.UserName.ToString(); txtUsername.Text = User.UserName.ToString(); } if (userName != "") { int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { ContactInfo_mst objConInfo = new ContactInfo_mst(); userid = objUser.Userid; IncidentToAsset(userid); objConInfo = objConInfo.Get_By_id(userid); txtEmail.Text = objConInfo.Emailid; txtassignasset.Text = compname; } } }
protected void Page_Load(object sender, EventArgs e) { //lblUser.Text = Session["User"].ToString(); if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } //added by lalit to view Mail link only to SDE. checking here SDE is logged on. if (Roles.IsUserInRole(User.UserName.ToString(), "SDE")) { trautocall.Visible = true; //trRejectedcall.Visible = true; } if (Roles.IsUserInRole(User.UserName.ToString(), "admin")) { //trautocall.Visible = true; trRejectedcall.Visible = true; } //if (Roles.IsUserInRole(User.UserName.ToString(), "SDE")) //{ // //trautocall.Visible = true; // trRejectedcall.Visible = true; //} } }
//function to check user exist or not protected void CheckUserExist() { lblerrmsg.Text = ""; // BindDropSite(); // BindDropDept(); #region Find Userid of User who is Requesting to log a call objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(txtUsername.Text.Trim().ToString().Trim(), objOrganization.Orgid); int usrid = Convert.ToInt16(objUser.Userid); int tempuser = 0; if (objUser.Userid == 0) { string myScript; tempuser = 1; myScript = "<script language=javascript>function __doPostBack(eventTarget, eventArgument){var theForm = document.forms['aspnetForm']; if (theForm){ theForm.__EVENTTARGET.value = eventTarget;theForm.__EVENTARGUMENT.value = eventArgument;theForm.submit(); }} var Flag= confirm('User Does not Exist,Do You Want to Create User');if(Flag==true){ __doPostBack('callPostBack', 'create');}if(Flag==false){ __doPostBack('callPostBack', 'notcreate');}</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); Session["tempuser"] = tempuser; //txtassignasset.Text = ""; } else { IncidentToAsset(usrid); ContactInfo_mst objConInfo = new ContactInfo_mst(); objConInfo = objConInfo.Get_By_id(usrid); txtEmail.Text = objConInfo.Emailid; //txtassignasset.Text = assetid.ToString(); //txtassignasset.Text = compname; Session["assignassetid"] = assetid; Session["UserCreate"] = "Exist"; } string username1 = txtUsername.Text.Trim().ToString(); Session["Username"] = username1; Session["Email"] = txtEmail.Text; #endregion }
protected void Page_Load(object sender, EventArgs e) { ////Add Exception handilng try catch change by vishal 21-05-2012 try { if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { string userName; userName = User.UserName.ToString(); if (Roles.IsUserInRole(userName, "admin")) { panel1.Visible = true; } objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; // Bind_Tree(); BindRepeater(); } } } 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 txtUsername_TextChanged(object sender, EventArgs e) { #region Find Userid of User who is Requesting to log a call /////Add Exception handilng try catch change by vishal 21-05-2012 try { objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); if (ObjUserLogin.Userid == 0) { string myScript; myScript = "<script language=javascript>function __doPostBack(eventTarget, eventArgument){var theForm = document.forms['aspnetForm']; if (theForm){ theForm.__EVENTTARGET.value = eventTarget;theForm.__EVENTARGUMENT.value = eventArgument;theForm.submit(); }} var Flag= confirm('User Does not Exist,Do You Want to Create User');if(Flag==true){ __doPostBack('callPostBack', 'create');}if(Flag==false){ __doPostBack('callPostBack', 'notcreate');}</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } else { ViewState["UserCreate"] = "Exist"; ContactInfo_mst objCont = new ContactInfo_mst(); objCont = objCont.Get_By_id(ObjUserLogin.Userid); txtEmail.Text = objCont.Emailid; } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } #endregion }
public void SentMailToPManager(int solutionid) { string strYourSinscerely = Resources.MessageResource.strYourSinscerely.ToString(); string strContactNumber = Resources.MessageResource.strContactNumber.ToString(); Solution_mst objSolution = new Solution_mst(); SolutionCreator objSolutionCreator = new SolutionCreator(); objSolution = objSolution.Get_By_id(solutionid); objSolutionCreator = objSolutionCreator.Get_By_id(solutionid); UserLogin_mst objUserCreator = new UserLogin_mst(); objUserCreator = objUserCreator.Get_By_id(objSolutionCreator.Createdby); int FlagUser; string varRole = Resources.MessageResource.strPManagerRole.ToString(); int roleid; roleid = objRole.Get_By_RoleName(varRole); colUser = objUser.Get_All_By_Role(roleid); foreach (UserLogin_mst objusr in colUser) { objC_info = objC_info.Get_By_id(objusr.Userid); obj.From = Resources.MessageResource.strAdminEmail.ToString(); obj.To = objC_info.Emailid; obj.Subject = "New Solution Added. Solution Id : " + solutionid; obj.Body = "Dear Sir/Madam,<br/>A New Solution has been Added.Please find the New Solution details .<br/><br/><b>Solution Details : </b> <br/><br/><b>Solution Id :</b>" + objSolution.Solutionid + "<br/><b>Title :</b>" + objSolution.Title + " <br/><b>Added By :</b>" + objUserCreator.Username + "<br/><b>Created Date   :</b>" + objSolutionCreator.CreateDatetime + "<br/><b>Content :</b>" + objSolution.Content + "<br/><br/>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(); } }
protected void Page_Load(object sender, EventArgs e) { ///Add Exception handilng try catch change by vishal 21-05-2012 try { #region Get Current User and his Role MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } #endregion }
protected void Showvalues() { int incidentid = Convert.ToInt32(Session["incidentid"]); ObjIncident = ObjIncident.Get_By_id(incidentid); ObjIncidentStates = ObjIncidentStates.Get_By_id(incidentid); // drpTechnician.SelectedValue = ObjIncidentStates.Technicianid.ToString(); drpCategory.SelectedValue = ObjIncidentStates.Categoryid.ToString(); BindDropSubCategory(); drpSubcategory.SelectedValue = ObjIncidentStates.Subcategoryid.ToString(); // drpPriority.SelectedValue = ObjIncidentStates.Priorityid.ToString(); txtTitle.Text = ObjIncident.Title.ToString(); if (ObjIncident.Description != null) { txtDescription.Text = ObjIncident.Description.ToString(); } UserLogin_mst objUsr = new UserLogin_mst(); ContactInfo_mst objInfo = new ContactInfo_mst(); objInfo = objInfo.Get_By_id(ObjIncident.Requesterid); objUsr = objUsr.Get_By_id(ObjIncident.Requesterid); txtUsername.Text = objUsr.Username; txtEmail.Text = objInfo.Emailid; ViewState["UserCreate"] = "Exist"; }
protected void Page_Load(object sender, EventArgs e) {//Add Exception handilng try catch change by vishal 21-05-2012 try { if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } } XmlDataSource ds = new XmlDataSource(); ds.EnableCaching = false; ds.DataFile = Server.MapPath("../Files/Admin.xml"); TreeView1.DataSource = ds; TreeView1.DataBind(); } 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) { if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } } }
protected void GetUserDetail() { string userName = ""; MembershipUser User = Membership.GetUser(); if (User != null) { userName = User.UserName.ToString(); txtUsername.Text = User.UserName.ToString(); } if (userName != "") { int userid; objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); //objRole = objRole.Get_By_id(roleid); if (objUser.Userid != 0) { ContactInfo_mst objConInfo = new ContactInfo_mst(); userid = objUser.Userid; IncidentToAsset(userid); objConInfo = objConInfo.Get_By_id(userid); txtEmail.Text = objConInfo.Emailid; txtassignasset.Text = compname; //priorityid = Convert.ToInt32(objConInfo.userpriority); //BindDropPriority(int priorityid); //ContactInfo_mst objcnt = new ContactInfo_mst(); //if (objRole.roleid != 1) //{ if (objConInfo.userpriority == 1) { priorityid = objPriority.Get_By_PriorityName("High"); } else { priorityid = objPriority.Get_By_PriorityName("Medium"); } //} Priority_mst objP = new Priority_mst(); objP = objPriority.Get_By_id(priorityid); colPriority.Add(objP); drpPriority.DataTextField = "name"; drpPriority.DataValueField = "priorityid"; drpPriority.DataSource = colPriority; drpPriority.DataBind(); } } }
protected void Page_Load(object sender, EventArgs e) { #region Get Current User and his Role MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } #endregion }
protected void Page_Load(object sender, EventArgs e) {///Add Exception handilng try catch change by vishal 21-05-2012 try { //lblUser.Text = Session["User"].ToString(); if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } //added by lalit to view Mail link only to SDE. checking here SDE is logged on. string AutoCalls = Resources.MessageResource.strAutoCalls.ToString(); if (Roles.IsUserInRole(User.UserName.ToString(), "SDE")) { if (AutoCalls == "1") { trautocall.Visible = true; trRejectedcall.Visible = true; } } if (Roles.IsUserInRole(User.UserName.ToString(), "admin")) { //trautocall.Visible = true; if (AutoCalls == "1") { trRejectedcall.Visible = true; } } } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void BindIncidentToProblem() { if (Session["IncidentToProblem"] != null) { int incidentid = Convert.ToInt32(Session["IncidentToProblem"].ToString()); Incident_mst objIncident = new Incident_mst(); IncidentStates objIncidentStates = new IncidentStates(); objIncident = objIncident.Get_By_id(incidentid); objIncidentStates = objIncidentStates.Get_By_id(incidentid); objuser = objuser.Get_By_id(objIncident.Requesterid); if (objIncidentStates.Priorityid != 0) { drpPriority.SelectedValue = Convert.ToString(objIncidentStates.Priorityid); } if (objIncidentStates.Categoryid != 0) { drpCategory.SelectedValue = Convert.ToString(objIncidentStates.Categoryid); BindDropSubCategory(); } if (objIncidentStates.Subcategoryid != 0) { drpSubcategory.SelectedValue = Convert.ToString(objIncidentStates.Subcategoryid); } if (objIncidentStates.Technicianid != 0) { drpTechnician.SelectedValue = Convert.ToString(objIncidentStates.Technicianid); } txtDescription.Text = objIncident.Description; txtTitle.Text = objIncident.Title; if (objuser.Userid != 0) { ContactInfo_mst objInfo = new ContactInfo_mst(); objInfo = objInfo.Get_By_id(objuser.Userid); txtUsername.Text = objuser.Username; txtEmail.Text = objInfo.Emailid; ViewState["UserCreate"] = "Exist"; } } }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } } XmlDataSource ds = new XmlDataSource(); ds.EnableCaching = false; ds.DataFile = Server.MapPath("../Files/Admin.xml"); TreeView1.DataSource = ds; TreeView1.DataBind(); }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { MembershipUser User = Membership.GetUser(); objOrganization = objOrganization.Get_Organization(); int userid = objUser.Get_By_UserName(User.UserName.ToString(), objOrganization.Orgid); if (userid != 0) { string userName; userName = User.UserName.ToString(); if (Roles.IsUserInRole(userName, "admin")) { panel1.Visible = true; } objContact = objContact.Get_By_id(userid); lblUser.Text = objContact.Firstname + " " + objContact.Lastname; } } Bind_Tree(); }
public void SentMailToSDM(int siteid, int incidentid, int requesterid) { string strYourSinscerely = Resources.MessageResource.strYourSinscerely.ToString(); string strContactNumber = Resources.MessageResource.strContactNumber.ToString(); int FlagUser; string varRole = Resources.MessageResource.strSDMRole.ToString(); int roleid; roleid = objRole.Get_By_RoleName(varRole); colUser = objUser.Get_All_By_Role(roleid); foreach (UserLogin_mst objusr in colUser) { FlagUser = objUserToSiteMapping.Get_By_Id(objusr.Userid, siteid); if (FlagUser != 0) { objIncident = objIncident.Get_By_id(incidentid); objSite = objSite.Get_By_id(objIncident.Siteid); objIncidentStates = objIncidentStates.Get_By_id(incidentid); objPriority = objPriority.Get_By_id(objIncidentStates.Priorityid); UserLogin_mst obju = new UserLogin_mst(); UserLogin_mst objReq = new UserLogin_mst(); obju = obju.Get_By_id(objUserToSiteMapping.Userid); objC_info = objC_info.Get_By_id(objusr.Userid); objReq = objReq.Get_By_id(requesterid); ContactInfo_mst objReqContInfo = new ContactInfo_mst(); objReqContInfo = objReqContInfo.Get_By_id(objReq.Userid); obj.From = Resources.MessageResource.strAdminEmail.ToString(); obj.To = objC_info.Emailid; obj.Subject = "High Priority Call. Ticket Id: " + incidentid; obj.Body = "Dear Sir/Madam,<br/>High Priority Call has been logged, please find below the Complaint details .<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>" + objReq.Username + "<br/><b>Mail Address :</b>" + objReqContInfo.Emailid + "<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(); } } }
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 txtUsername_TextChanged(object sender, EventArgs e) { #region Find Userid of User who is Requesting to log a call objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); if (ObjUserLogin.Userid == 0) { string myScript; myScript = "<script language=javascript>function __doPostBack(eventTarget, eventArgument){var theForm = document.forms['aspnetForm']; if (theForm){ theForm.__EVENTTARGET.value = eventTarget;theForm.__EVENTARGUMENT.value = eventArgument;theForm.submit(); }} var Flag= confirm('User Does not Exist,Do You Want to Create User');if(Flag==true){ __doPostBack('callPostBack', 'create');}if(Flag==false){ __doPostBack('callPostBack', 'notcreate');}</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } else { ViewState["UserCreate"] = "Exist"; ContactInfo_mst objCont = new ContactInfo_mst(); objCont = objCont.Get_By_id(ObjUserLogin.Userid); txtEmail.Text = objCont.Emailid; } #endregion }
protected void buttonadd_click(object sender, EventArgs e) { /////Add Exception handilng try catch change by vishal 21-05-2012 try { #region Find Userid of User who is Requesting to log a call #region If User Already Exist if (ViewState["UserCreate"].ToString() == "Exist") { objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); if (ObjUserLogin.Userid != 0) { requesterid = ObjUserLogin.Userid; } } #endregion #region If New User is to be Created else if (ViewState["UserCreate"].ToString() == "create") { string varEmail = ""; string varRoleName = Resources.MessageResource.BasicUserRole.ToString(); if (txtEmail.Text == "") { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } else { varEmail = txtEmail.Text; } int roleid = objRole.Get_By_RoleName(varRoleName); int status; objOrganization = objOrganization.Get_Organization(); objuser.Username = txtUsername.Text.ToString(); objuser.Password = Resources.MessageResource.strDefaultPassword.ToString(); objuser.Roleid = roleid; objuser.Orgid = objOrganization.Orgid; objuser.ADEnable = false; objuser.Enable = true; objuser.Createdatetime = DateTime.Now.ToString(); status = objuser.Insert(); if (status == 1) { // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(txtUsername.Text.ToString().Trim(), Resources.MessageResource.strDefaultPassword.ToString(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(txtUsername.Text.ToString().Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user // Create Object objUserLogin of UserLogin_mst()Class objuser = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName requesterid = objuser.Get_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = requesterid; objContactInfo.Emailid = varEmail; objContactInfo.Firstname = txtUsername.Text.ToString(); objContactInfo.Lastname = txtUsername.Text.ToString(); objContactInfo.Insert(); } } #endregion #region If User is Not to be Created else if (ViewState["UserCreate"].ToString() == "notcreate") { // FlagUserStatus = false; } #endregion #endregion ObjChange.Active = true; ObjChange.Statusid = Convert.ToInt32(drpStatus.SelectedValue); ObjChange.Categoryid = Convert.ToInt32(drpCategory.SelectedValue); ObjChange.Subcategoryid = Convert.ToInt32(drpSubcategory.SelectedValue); ///ObjChange.Technician = ""; ObjChange.Title = txtTitle.Text; ObjChange.Description = txtDescription.Text; ObjChange.Createdtime = DateTime.Now.ToString(); ObjChange.Changetype = Convert.ToInt32(drpchangetype.SelectedValue); ObjChange.Approvalstatus = "Send For Approval"; MembershipUser user = Membership.GetUser(); string username = user.UserName.ToString(); objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(username, objOrganization.Orgid); int userid = Convert.ToInt32(ObjUserLogin.Userid); ObjChange.CreatedByID = userid; //////////change doneby meenakshi objservice = objservice.Get_By_id(Convert.ToInt32(drpservices.SelectedValue)); if (objservice.servicename != null) { ObjChange.servicename = objservice.servicename; } else { ObjChange.servicename = ""; } ////////end ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text, objOrganization.Orgid); ObjChange.Requestedby = ObjUserLogin.Userid; //ObjChange.Priority = Convert.ToInt32(drpPriority.SelectedValue); ObjChange.Insert(); int changeid = ObjChange.Get_Current_Changeid(); for (int i = ListAsset.Items.Count - 1; i >= 0; i--) { if (ListAsset.Items[i].Selected == true) { Objincludeaasetchange.Assetid = Convert.ToInt32(ListAsset.Items[i].Value); Objincludeaasetchange.Changeid = changeid; Objincludeaasetchange.Insert(); } } objIncidentToChange.Changeid = changeid; objIncidentToChange.Incidentid = Convert.ToInt32(Session["incidentid"]); objIncidentToChange.Insert(); int changetype = Convert.ToInt32(ObjChange.Changetype); objSentEmailToChange.SentMailToChangeCommittee(changeid, changetype); ScriptManager.RegisterStartupScript(this, this.GetType(), "Close()", "Close();", true); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
string GetUsername(int userid) { string username = ""; // objUser = objUser.Get_By_id(userid); objcontactinfo = objcontactinfo.Get_By_id(userid); //if (objUser.Userid != 0) //{ // username = objUser.Username; username = objcontactinfo.Firstname; //} return username; }
public int Insert_ContactInfo_mst(ContactInfo_mst objContactInfo) { return((int)ExecuteNonQuery(Sp_ContactInfo_Insert, new object[] { objContactInfo.Userid, objContactInfo.Mobile, objContactInfo.Lastname, objContactInfo.Landline, objContactInfo.Firstname, objContactInfo.Empid, objContactInfo.Emailid, objContactInfo.Description, objContactInfo.Siteid, objContactInfo.Deptid })); }
protected void BindIncidentToProblem() { if (Session["IncidentToProblem"] != null) { int incidentid = Convert.ToInt16(Session["IncidentToProblem"].ToString()); Incident_mst objIncident = new Incident_mst(); IncidentStates objIncidentStates = new IncidentStates(); objIncident = objIncident.Get_By_id(incidentid); objIncidentStates = objIncidentStates.Get_By_id(incidentid); objuser = objuser.Get_By_id(objIncident.Requesterid); if (objIncidentStates.Priorityid != 0) { drpPriority.SelectedValue = Convert.ToString(objIncidentStates.Priorityid); } if (objIncidentStates.Categoryid != 0) { drpCategory.SelectedValue = Convert.ToString(objIncidentStates.Categoryid); BindDropSubCategory(); } if (objIncidentStates.Subcategoryid != 0) { drpSubcategory.SelectedValue = Convert.ToString(objIncidentStates.Subcategoryid); } if (objIncidentStates.Technicianid != 0) { drpTechnician.SelectedValue = Convert.ToString(objIncidentStates.Technicianid); } txtDescription.Text = objIncident.Description; txtTitle.Text = objIncident.Title; if (objuser.Userid != 0) { ContactInfo_mst objInfo = new ContactInfo_mst(); objInfo = objInfo.Get_By_id(objuser.Userid); txtUsername.Text = objuser.Username; txtEmail.Text = objInfo.Emailid; ViewState["UserCreate"] = "Exist"; } } }
public int Update_ContactInfo_mst_By_id(ContactInfo_mst objContactInfo) { return (int)ExecuteNonQuery(Sp_ContactInfo_Update, new object[] { objContactInfo.Userid, objContactInfo.Mobile, objContactInfo.Lastname, objContactInfo.Landline, objContactInfo.Firstname, objContactInfo.Empid, objContactInfo.Emailid, objContactInfo.Description, objContactInfo.Siteid, objContactInfo.Deptid }); }
protected void buttonadd_click(object sender, EventArgs e) { #region Find Userid of User who is Requesting to log a call #region If User Already Exist if (ViewState["UserCreate"].ToString() == "Exist") { objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); if (ObjUserLogin.Userid != 0) { requesterid = ObjUserLogin.Userid; } } #endregion #region If New User is to be Created else if (ViewState["UserCreate"].ToString() == "create") { string varEmail = ""; string varRoleName = Resources.MessageResource.BasicUserRole.ToString(); if (txtEmail.Text == "") { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } else { varEmail = txtEmail.Text; } int roleid = objRole.Get_By_RoleName(varRoleName); int status; objOrganization = objOrganization.Get_Organization(); objuser.Username = txtUsername.Text.ToString(); objuser.Password = Resources.MessageResource.strDefaultPassword.ToString(); objuser.Roleid = roleid; objuser.Orgid = objOrganization.Orgid; objuser.ADEnable = false; objuser.Enable = true; objuser.Createdatetime = DateTime.Now.ToString(); status = objuser.Insert(); if (status == 1) { // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(txtUsername.Text.ToString().Trim(), Resources.MessageResource.strDefaultPassword.ToString(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(txtUsername.Text.ToString().Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user // Create Object objUserLogin of UserLogin_mst()Class objuser = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName requesterid = objuser.Get_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = requesterid; objContactInfo.Emailid = varEmail; objContactInfo.Firstname = txtUsername.Text.ToString(); objContactInfo.Lastname = txtUsername.Text.ToString(); objContactInfo.Insert(); } } #endregion #region If User is Not to be Created else if (ViewState["UserCreate"].ToString() == "notcreate") { // FlagUserStatus = false; } #endregion #endregion ObjChange.Active = true; ObjChange.Statusid = Convert.ToInt16(drpStatus.SelectedValue); ObjChange.Categoryid = Convert.ToInt16(drpCategory.SelectedValue); ObjChange.Subcategoryid = Convert.ToInt16(drpSubcategory.SelectedValue); ObjChange.Technician = Convert.ToInt16(drpTechnician.SelectedValue); ObjChange.Title = txtTitle.Text; ObjChange.Description = txtDescription.Text; ObjChange.Createdtime = DateTime.Now.ToString(); ObjChange.Changetype = Convert.ToInt16(drpchangetype.SelectedValue); ObjChange.Approvalstatus = "Send For Approval"; MembershipUser user = Membership.GetUser(); string username = user.UserName.ToString(); objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(username, objOrganization.Orgid); int userid = Convert.ToInt16(ObjUserLogin.Userid); ObjChange.CreatedByID = userid; ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text, objOrganization.Orgid); ObjChange.Requestedby = ObjUserLogin.Userid; ObjChange.Priority = Convert.ToInt16(drpPriority.SelectedValue); ObjChange.Insert(); int changeid = ObjChange.Get_Current_Changeid(); for (int i = ListAsset.Items.Count - 1; i >= 0; i--) { if (ListAsset.Items[i].Selected == true) { Objincludeaasetchange.Assetid = Convert.ToInt16(ListAsset.Items[i].Value); Objincludeaasetchange.Changeid = changeid; Objincludeaasetchange.Insert(); } } ObjProblemToChange.Changeid = changeid; ObjProblemToChange.Problemid = Convert.ToInt16(Session["problemid"]); ObjProblemToChange.Insert(); ScriptManager.RegisterStartupScript(this, this.GetType(), "Close()", "Close();", true); }
protected void txtUsername_TextChanged(object sender, EventArgs e) { lblerrmsg.Text = ""; BindDropSite(); BindDropDept(); #region Find Userid of User who is Requesting to log a call objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(txtUsername.Text.Trim().ToString().Trim(), objOrganization.Orgid); int usrid = Convert.ToInt16(objUser.Userid); int tempuser = 0; if (objUser.Userid == 0) { string myScript; tempuser = 1; myScript = "<script language=javascript>function __doPostBack(eventTarget, eventArgument){var theForm = document.forms['aspnetForm']; if (theForm){ theForm.__EVENTTARGET.value = eventTarget;theForm.__EVENTARGUMENT.value = eventArgument;theForm.submit(); }} var Flag= confirm('User Does not Exist,Do You Want to Create User');if(Flag==true){ __doPostBack('callPostBack', 'create');}if(Flag==false){ __doPostBack('callPostBack', 'notcreate');}</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); Session["tempuser"] = tempuser; //txtassignasset.Text = ""; } else { IncidentToAsset(usrid); ContactInfo_mst objConInfo = new ContactInfo_mst(); objConInfo = objConInfo.Get_By_id(usrid); txtEmail.Text = objConInfo.Emailid; //txtassignasset.Text = assetid.ToString(); //txtassignasset.Text = compname; Session["assignassetid"] = assetid; Session["UserCreate"] = "Exist"; } string username1 = txtUsername.Text.Trim().ToString(); Session["Username"] = username1; Session["Email"] = txtEmail.Text; #endregion }
protected void btnAdd_Click(object sender, EventArgs e) { #region Declaration of Local Variables int siteid, priorityid; int SLAid = 0; int createdbyid = 0; int requesterid = 0; int FlagInsert; int requesttypeid; string userName; bool FlagUserStatus; FlagUserStatus = true; FlagInsert = 0; #endregion #region Fetch Current User MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); #endregion #region Get Current Site and Priority id siteid = Convert.ToInt16(drpSite.SelectedValue); priorityid = Convert.ToInt16(drpPriority.SelectedValue); #endregion #region Get SLAid on the basis of siteid and Priority id if (siteid != 0 && priorityid != 0) { SLAid = objIncident.Get_By_SLAid(siteid, priorityid); requesttypeid = Convert.ToInt16(Resources.MessageResource.strRequestTypeId.ToString()); if (requesttypeid == Convert.ToInt16(drpRequestType.SelectedValue)) { SLAid = 0; } } #endregion if (userName != "") { #region Find Userid of User who Created this Request objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { createdbyid = objUser.Userid; } #endregion #region Find Userid of User who is Requesting to log a call #region If User Already Exist if (Session["UserCreate"].ToString() == "Exist") { objUser = objUser.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); if (objUser.Userid != 0) { requesterid = objUser.Userid; } } #endregion #region If New User is to be Created else if (Session["UserCreate"].ToString() == "create") { string varEmail = ""; string varRoleName = Resources.MessageResource.BasicUserRole.ToString(); if (txtEmail.Text == "") { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } else { varEmail = txtEmail.Text; } int roleid = objRole.Get_By_RoleName(varRoleName); int status; objOrganization = objOrganization.Get_Organization(); UserLogin_mst objUserLogin = new UserLogin_mst(); objUserLogin.Username = txtUsername.Text.Trim().ToString(); objUserLogin.Password = Resources.MessageResource.strDefaultPassword.ToString(); objUserLogin.Roleid = roleid; objUserLogin.Orgid = objOrganization.Orgid; objUserLogin.ADEnable = false; objUserLogin.Enable = true; objUserLogin.Createdatetime = DateTime.Now.ToString(); status = objUserLogin.Insert(); if (status == 1) { // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(txtUsername.Text.ToString().Trim(), Resources.MessageResource.strDefaultPassword.ToString(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(txtUsername.Text.ToString().Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user // Create Object objUserLogin of UserLogin_mst()Class objUserLogin = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName requesterid = objUserLogin.Get_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = requesterid; objContactInfo.Emailid = varEmail; objContactInfo.Firstname = txtUsername.Text.ToString(); objContactInfo.Lastname = txtUsername.Text.ToString(); objContactInfo.Insert(); } } #endregion #region If User is Not to be Created else if (Session["UserCreate"].ToString() == "notcreate") { FlagUserStatus = false; } #endregion #endregion } objIncident.Title = txtTitle.Text.Trim(); //objIncident.Title = drpTitle.SelectedItem.Text; objIncident.Slaid = SLAid; objIncident.Createdbyid = createdbyid; objIncident.Requesterid = requesterid; objIncident.Siteid = siteid; objIncident.Description = txtDescription.Text.ToString().Trim(); objIncident.Deptid = Convert.ToInt16(drpDepartment.SelectedValue); objIncident.Createdatetime = DateTime.Now.ToString(); IFormatProvider provider = new System.Globalization.CultureInfo("en-CA", true); String datetime = txtReportedDate.Text.Trim(); DateTime dt = DateTime.Parse(datetime, provider, System.Globalization.DateTimeStyles.NoCurrentDateDefault); //changed by prachi //objIncident.Reporteddatetime = dt.ToShortDateString() + " " + DateTime.Now.ToShortTimeString(); DateTime dtNowForTime = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day, Convert.ToInt32(drpTimeHours.SelectedItem.Text), Convert.ToInt32(drpTimeMin.SelectedItem.Text), 0); //end prachi objIncident.Reporteddatetime = dt.ToShortDateString() + " " + dtNowForTime.ToShortTimeString(); objIncident.Modeid = Convert.ToInt16(drpMode.SelectedValue); //objIncident.ExternalTicketNo = txtExternalTicket.Text.ToString().Trim(); if (FlagUserStatus == true) { FlagInsert = objIncident.Insert(); #region Save Assetid and incident id in incidenttoassetmaaping // Get Asset and Incident Id for incidenttoassetmaaping objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(txtUsername.Text.Trim().ToString().Trim(), objOrganization.Orgid); int userid = Convert.ToInt16(objUser.Userid); int tempuser1 = Convert.ToInt16(Session["tempuser1"]); if (tempuser1 == 1) { assetid = Convert.ToInt16(Session["assetid"]); } else { assetid = Convert.ToInt16(objusertoasset.Get_AssetId_By_UserId(userid)); } int incid = Convert.ToInt16(objIncident.Get_TopIncidentId()); //if (txtassignasset.Text != "") { //assetid = Convert.ToInt16(txtassignasset.Text); if (assetid != 0) { objincidenttoasset.Insert(incid, assetid); objusertoasset.Insert(userid, assetid); Session.Abandon(); } } #endregion } if (FlagInsert == 1) { int FlagIncdStatesInsert; int incidentid; incidentid = objIncident.Get_Current_Incidentid(); objIncidentStates.Incidentid = incidentid; objIncidentStates.Priorityid = Convert.ToInt16(drpPriority.SelectedValue); objIncidentStates.Categoryid = Convert.ToInt16(drpCategory.SelectedValue); objIncidentStates.Statusid = Convert.ToInt16(drpStatus.SelectedValue); objIncidentStates.Subcategoryid = Convert.ToInt16(drpSubcategory.SelectedValue); objIncidentStates.Technicianid = Convert.ToInt16(drpTechnician.SelectedValue); if (Convert.ToInt16(drpTechnician.SelectedValue) != 0) { objIncidentStates.AssignedTime = DateTime.Now.ToString(); } objIncidentStates.Requesttypeid = Convert.ToInt16(drpRequestType.SelectedValue); FlagIncdStatesInsert = objIncidentStates.Insert(); if (FlagIncdStatesInsert == 1) { objIncidentHistory.Incidentid = incidentid; objIncidentHistory.Operation = "create"; objIncidentHistory.Operationownerid = createdbyid; objIncidentHistory.Insert(); objSentmailtoUser.SentmailUser(requesterid, incidentid, "open"); if (Convert.ToInt16(drpTechnician.SelectedValue) != 0) { objSentmailtoUser.SentmailTechnician(Convert.ToInt16(drpTechnician.SelectedValue), incidentid); } ////////////////////Added by lalit 28nov to ///////////////////////////////////////////////////// if (Session["id"] != null) { int id = Convert.ToInt32(Session["id"].ToString()); SqlConnection con; SqlCommand cmd; string connection = ConfigurationManager.ConnectionStrings["CSM_DB"].ConnectionString; con = new SqlConnection(connection); cmd = new SqlCommand(); con.Open(); cmd.Connection = con; cmd.CommandText = "update storemail set IsActive=2 where id='" + id + "'"; cmd.ExecuteNonQuery(); } Response.Redirect("~/Incident/IncidentRequestUpdate.aspx?" + incidentid + ""); } } }
protected void btnSave_Click(object sender, EventArgs e) { // Save User to Database on Button Save click Event // Start objOrganization = objOrganization.Get_Organization(); //Declare Local Variables - Flag,varRolename,FlagMembership int Flag; string varRoleName; bool FlagMembership; // Use Asp.Net Membership Validator Control Membership.ValidateUser to check User Exist in aspnet Database FlagMembership = Membership.ValidateUser(txtUserName.Text.ToString().Trim(), txtPassword.Text.ToString().Trim()); // Create Object of UserLogin_mst Class to Check User Exist in Database UserLogin_mst table UserLogin_mst objUserLogin = new UserLogin_mst(); // Declare local Variable Flag to Check Status User Exist in databse Flag = objUserLogin.Get_By_UserName(txtUserName.Text.ToString().Trim(), objOrganization.Orgid); // If User Does'nt exist in Database and in aspnet databse then flag value will 0 and FlagMembership value will be False if (Flag == 0 && FlagMembership == false) { // Declare status local variable int status; // Create Object objUserLogin of UserLogin_mst() Class to insert record in table objUserLogin = new UserLogin_mst(); objUserLogin.Username = txtUserName.Text.ToString().Trim(); objUserLogin.Password = txtPassword.Text.ToString().Trim(); objUserLogin.Company = txtCompany.Text.ToString().Trim(); objUserLogin.City = txtCity.Text.ToString().Trim(); objUserLogin.Roleid = Convert.ToInt32(dropRole.SelectedValue); objUserLogin.Orgid = objOrganization.Orgid; objUserLogin.ADEnable = false; objUserLogin.Enable = true; objUserLogin.Createdatetime = DateTime.Now.ToString(); // Call Insert function to insert record in UserLogin_mst table // Check status whether Record inserted Successfully or Not,If status=1 then Success otherwise Operation Fail status = objUserLogin.Insert(); if (status == 1) { // Declare local variable varEmail to fetch email of user from textbox string varEmail; //If Email field is Not Empty then Assign value to varEmail Local Variable if (txtEmailId.Text != "") { varEmail = txtEmailId.Text.Trim(); } // Else Assign value define in MessagesResources.resx file in errMemshipCreateUserEmail field else { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } // Assign selected text from droprole down to local variable field varRoleName varRoleName = dropRole.SelectedItem.Text.ToString().Trim(); // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(txtUserName.Text.ToString().Trim(), txtPassword.Text.ToString().Trim(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(txtUserName.Text.ToString().Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user int userid; // Create Object objUserLogin of UserLogin_mst()Class objUserLogin = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName userid = objUserLogin.Get_By_UserName(txtUserName.Text.ToString().Trim(), objOrganization.Orgid); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured UserToSiteMapping objusertositemapping = new UserToSiteMapping(); if (userid != 0) { // Create Object objContactInfo of ContactInfo_mst class to Store User Contact Information in Contact_info table ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = userid; objContactInfo.Firstname = txtFname.Text.ToString().Trim(); objContactInfo.Lastname = txtLname.Text.ToString().Trim(); objContactInfo.Description = txtDesc.Text.ToString().Trim(); objContactInfo.Empid = txtEmpId.Text; objContactInfo.Emailid = txtEmailId.Text.ToString().Trim(); objContactInfo.Landline = txtLandline.Text.ToString().Trim(); objContactInfo.Mobile = txtMobile.Text.ToString().Trim(); objContactInfo.Siteid = Convert.ToInt32(DrpSite.SelectedValue); //if (DrpDepartment.SelectedItem.ToString() != null) //{ objContactInfo.Deptid = Convert.ToInt32(DrpDepartment.SelectedValue); //} // Call objContactInfo.Insert function to Insert record in Contact_info table objContactInfo.Insert(); // Show Message Operation perform successfully //lblMessage.Text = Resources.MessageResource.errDataSave.ToString(); // Calling Function Clear() to Clear all controls on Form objusertositemapping.Userid = userid; objusertositemapping.Siteid = Convert.ToInt32(DrpSite.SelectedValue); objusertositemapping.Insert(); Clear(); Response.Redirect("~/admin/ViewUser.aspx"); } else { // Show Message Error Occured due to some Reason lblMessage.Text = Resources.MessageResource.errOccured.ToString(); } } else { // Show Message Error Occured due to some Reason lblMessage.Text = Resources.MessageResource.errOccured.ToString(); } } else { // Show Message User Already Exist lblMessage.Text = Resources.MessageResource.errUserExist.ToString(); } // End Save button Click }
protected void txtUsername_TextChanged(object sender, EventArgs e) { /////Add Exception handilng try catch change by vishal 21-05-2012 try { lblerrmsg.Text = ""; BindDropSite(); BindDropDept(); #region Find Userid of User who is Requesting to log a call objOrganization = objOrganization.Get_Organization(); string usern = txtUsername.Text.ToString(); objUser = objUser.Get_UserLogin_By_UserName_Ex(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); int usrid = Convert.ToInt32(objUser.Userid); int tempuser = 0; if (objUser.Userid == 0) { string myScript; tempuser = 1; myScript = "<script language=javascript>function __doPostBack(eventTarget, eventArgument){var theForm = document.forms['aspnetForm']; if (theForm){ theForm.__EVENTTARGET.value = eventTarget;theForm.__EVENTARGUMENT.value = eventArgument;theForm.submit(); }} var Flag= confirm('User Does not Exist,Do You Want to Create User');if(Flag==true){ __doPostBack('callPostBack', 'create');}if(Flag==false){ __doPostBack('callPostBack', 'notcreate');}</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); Session["tempuser"] = tempuser; txtassignasset.Text = ""; BindDropPriority(); } else { IncidentToAsset(usrid); ContactInfo_mst objConInfo = new ContactInfo_mst(); objConInfo = objConInfo.Get_By_id(usrid); txtEmail.Text = objConInfo.Emailid; //txtassignasset.Text = assetid.ToString(); txtassignasset.Text = compname; Session["assignassetid"] = assetid; Session["UserCreate"] = "Exist"; //changed by shrikant colPriority = objPriority.Get_All(); drpPriority.DataTextField = "name"; drpPriority.DataValueField = "priorityid"; drpPriority.DataSource = colPriority; drpPriority.DataBind(); ListItem item = new ListItem(); item.Text = "-------------Select-------------"; if (objConInfo.userpriority == 1) { item.Value = "0"; drpPriority.Items.Add(item); drpPriority.SelectedValue = "8"; } else { item.Value = "0"; drpPriority.Items.Add(item); drpPriority.SelectedValue = "0"; } //end } string username1 = txtUsername.Text.ToString(); Session["Username"] = username1; Session["Us"] = username1; Session["USName"] = username1; Session["Email"] = txtEmail.Text; // ViewState["Name"] = username1; // change by meenakshi #endregion } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
public object GenerateContact_mstObject(ref IDataReader returnData) { ContactInfo_mst obj = new ContactInfo_mst(); while (returnData.Read()) { obj.Userid = (int)returnData["Userid"]; obj.Deptid = (int)returnData["Deptid"]; obj.userpriority = (int)returnData["userpriority"]; if (returnData["description"] != DBNull.Value) { obj.Description = (string)returnData["description"]; } if (returnData["emailid"] != DBNull.Value) { obj.Emailid = (string)returnData["emailid"]; } if (returnData["empid"] != DBNull.Value) { obj.Empid = (string)returnData["empid"]; } if (returnData["firstname"] != DBNull.Value) { obj.Firstname = (string)returnData["firstname"]; } if (returnData["lastname"] != DBNull.Value) { obj.Lastname = (string)returnData["lastname"]; } if (returnData["landline"] != DBNull.Value) { obj.Landline = (string)returnData["landline"]; } if (returnData["mobile"] != DBNull.Value) { obj.Mobile = (string)returnData["mobile"]; } if (returnData["siteid"] != DBNull.Value) { obj.Siteid = (int)returnData["siteid"]; } } returnData.Close(); returnData.Dispose(); return obj; }
public CollectionBase GenerateContactInfo_mstCollection(ref IDataReader returnData) { BLLCollection<ContactInfo_mst> col = new BLLCollection<ContactInfo_mst>(); while (returnData.Read()) { ContactInfo_mst obj = new ContactInfo_mst(); //obj.Emailid=(string)returnData["emailid"]; //obj.Userid=(int)returnData["userid"]; //obj.Firstname=(string)returnData["firstname"]; //obj.Lastname = (string)returnData["lastname"]; //start changed by prachi 14th feb 2012 if (returnData["emailid"].ToString().Length > 0) obj.Emailid = returnData["emailid"].ToString(); else obj.Emailid = ""; obj.Userid = (int)returnData["userid"]; if (returnData["firstname"].ToString().Length > 0) obj.Firstname = returnData["firstname"].ToString(); else obj.Firstname = ""; if (returnData["lastname"].ToString().Length > 0) obj.Lastname = returnData["lastname"].ToString(); else obj.Lastname = ""; //end col.Add(obj); } returnData.Close(); returnData.Dispose(); return col; }
protected void btnSave_Click(object sender, EventArgs e) { // Save User to Database on Button Save click Event // Start objOrganization = objOrganization.Get_Organization(); //Declare Local Variables - Flag,varRolename,FlagMembership int Flag; string varRoleName; bool FlagMembership; // Use Asp.Net Membership Validator Control Membership.ValidateUser to check User Exist in aspnet Database FlagMembership = Membership.ValidateUser(txtUserName.Text.ToString().Trim(), txtPassword.Text.ToString().Trim()); // Create Object of UserLogin_mst Class to Check User Exist in Database UserLogin_mst table UserLogin_mst objUserLogin = new UserLogin_mst(); // Declare local Variable Flag to Check Status User Exist in databse Flag = objUserLogin.Get_By_UserName(txtUserName.Text.ToString().Trim(), objOrganization.Orgid ); // If User Does'nt exist in Database and in aspnet databse then flag value will 0 and FlagMembership value will be False if (Flag == 0 && FlagMembership==false) { // Declare status local variable int status; // Create Object objUserLogin of UserLogin_mst() Class to insert record in table objUserLogin = new UserLogin_mst(); objUserLogin.Username = txtUserName.Text.ToString().Trim(); objUserLogin.Password = txtPassword.Text.ToString().Trim(); objUserLogin.Roleid = Convert.ToInt16(dropRole.SelectedValue); objUserLogin.Orgid = objOrganization.Orgid ; objUserLogin.ADEnable = false; objUserLogin.Enable = true; objUserLogin.Createdatetime = DateTime.Now.ToString(); // Call Insert function to insert record in UserLogin_mst table // Check status whether Record inserted Successfully or Not,If status=1 then Success otherwise Operation Fail status = objUserLogin.Insert(); if (status == 1) { // Declare local variable varEmail to fetch email of user from textbox string varEmail; //If Email field is Not Empty then Assign value to varEmail Local Variable if (txtEmailId.Text != "") { varEmail = txtEmailId.Text.Trim(); } // Else Assign value define in MessagesResources.resx file in errMemshipCreateUserEmail field else { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } // Assign selected text from droprole down to local variable field varRoleName varRoleName = dropRole.SelectedItem.Text.ToString().Trim(); // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(txtUserName.Text.ToString().Trim(), txtPassword.Text.ToString().Trim(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(txtUserName.Text.ToString().Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user int userid; // Create Object objUserLogin of UserLogin_mst()Class objUserLogin = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName userid = objUserLogin.Get_By_UserName(txtUserName.Text.ToString().Trim(), objOrganization.Orgid ); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured UserToSiteMapping objusertositemapping = new UserToSiteMapping(); if (userid != 0) { // Create Object objContactInfo of ContactInfo_mst class to Store User Contact Information in Contact_info table ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = userid; objContactInfo.Firstname = txtFname.Text.ToString().Trim(); objContactInfo.Lastname = txtLname.Text.ToString().Trim(); objContactInfo.Description = txtDesc.Text.ToString().Trim(); objContactInfo.Empid = txtEmpId.Text; objContactInfo.Emailid = txtEmailId.Text.ToString().Trim(); objContactInfo.Landline = txtLandline.Text.ToString().Trim(); objContactInfo.Mobile = txtMobile.Text.ToString().Trim(); objContactInfo.Siteid = Convert.ToInt16(DrpSite.SelectedValue); //if (DrpDepartment.SelectedItem.ToString() != null) //{ objContactInfo.Deptid = Convert.ToInt16(DrpDepartment.SelectedValue); //} // Call objContactInfo.Insert function to Insert record in Contact_info table objContactInfo.Insert(); // Show Message Operation perform successfully //lblMessage.Text = Resources.MessageResource.errDataSave.ToString(); // Calling Function Clear() to Clear all controls on Form objusertositemapping.Userid = userid; objusertositemapping.Siteid = Convert.ToInt16(DrpSite.SelectedValue); objusertositemapping.Insert(); Clear(); Response.Redirect("~/admin/ViewUser.aspx"); } else { // Show Message Error Occured due to some Reason lblMessage.Text = Resources.MessageResource.errOccured.ToString(); } } else { // Show Message Error Occured due to some Reason lblMessage.Text = Resources.MessageResource.errOccured.ToString(); } } else { // Show Message User Already Exist lblMessage.Text = Resources.MessageResource.errUserExist.ToString(); } // End Save button Click }
protected void txtUsername_TextChanged(object sender, EventArgs e) { /////Add Exception handilng try catch change by vishal 21-05-2012 try { lblerrmsg.Text = ""; BindDropSite(); BindDropDept(); #region Find Userid of User who is Requesting to log a call objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName_Ex(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); int usrid = Convert.ToInt32(objUser.Userid); int tempuser = 0; if (objUser.Userid == 0) { string myScript; tempuser = 1; myScript = "<script language=javascript>function __doPostBack(eventTarget, eventArgument){var theForm = document.forms['aspnetForm']; if (theForm){ theForm.__EVENTTARGET.value = eventTarget;theForm.__EVENTARGUMENT.value = eventArgument;theForm.submit(); }} var Flag= confirm('User Does not Exist,Do You Want to Create User');if(Flag==true){ __doPostBack('callPostBack', 'create');}if(Flag==false){ __doPostBack('callPostBack', 'notcreate');}</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); Session["tempuser"] = tempuser; txtassignasset.Text = ""; BindDropPriority(); } else { IncidentToAsset(usrid); ContactInfo_mst objConInfo = new ContactInfo_mst(); objConInfo = objConInfo.Get_By_id(usrid); txtEmail.Text = objConInfo.Emailid; //txtassignasset.Text = assetid.ToString(); txtassignasset.Text = compname; Session["assignassetid"] = assetid; Session["UserCreate"] = "Exist"; //changed by shrikant colPriority = objPriority.Get_All(); drpPriority.DataTextField = "name"; drpPriority.DataValueField = "priorityid"; drpPriority.DataSource = colPriority; drpPriority.DataBind(); ListItem item = new ListItem(); item.Text = "-------------Select-------------"; if (objConInfo.userpriority == 1) { item.Value = "0"; drpPriority.Items.Add(item); drpPriority.SelectedValue = "8"; } else { item.Value = "0"; drpPriority.Items.Add(item); drpPriority.SelectedValue = "0"; } //end } string username1 = txtUsername.Text.ToString(); Session["Username"] = username1; Session["Email"] = txtEmail.Text; // change by meenakshi #endregion } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void btnAdd_Click(object sender, EventArgs e) { /////Add Exception handilng try catch change by vishal 21-05-2012 try { #region Declaration of Local Variables int siteid, priorityid; int SLAid = 0; int createdbyid = 0; int requesterid = 0; int FlagInsert; int requesttypeid; string userName; bool FlagUserStatus; FlagUserStatus = true; FlagInsert = 0; #endregion #region Fetch Current User MembershipUser User = Membership.GetUser(); userName = User.UserName.ToString(); #endregion #region Get Current Site and Priority id siteid = Convert.ToInt32(drpSite.SelectedValue); priorityid = Convert.ToInt32(drpPriority.SelectedValue); #endregion #region Get SLAid on the basis of siteid and Priority id if (siteid != 0 && priorityid != 0) { SLAid = objIncident.Get_By_SLAid(siteid, priorityid); requesttypeid = Convert.ToInt32(Resources.MessageResource.strRequestTypeId.ToString()); if (requesttypeid == Convert.ToInt32(drpRequestType.SelectedValue)) { SLAid = 0; } } #endregion if (userName != "") { #region Find Userid of User who Created this Request objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); if (objUser.Userid != 0) { createdbyid = objUser.Userid; } #endregion #region Find Userid of User who is Requesting to log a call #region If User Already Exist if (Session["UserCreate"].ToString() == "Exist") { objUser = objUser.Get_UserLogin_By_UserName_Ex(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); if (objUser.Userid != 0) { requesterid = objUser.Userid; } } #endregion #region If New User is to be Created else if (Session["UserCreate"].ToString() == "create") { string varEmail = ""; string varRoleName = Resources.MessageResource.BasicUserRole.ToString(); if (txtEmail.Text == "") { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } else { varEmail = txtEmail.Text; } int roleid = objRole.Get_By_RoleName(varRoleName); int status; objOrganization = objOrganization.Get_Organization(); UserLogin_mst objUserLogin = new UserLogin_mst(); objUserLogin.Username = txtUsername.Text.ToString(); objUserLogin.Password = Resources.MessageResource.strDefaultPassword.ToString(); objUserLogin.Roleid = roleid; objUserLogin.Orgid = objOrganization.Orgid; objUserLogin.ADEnable = false; objUserLogin.Enable = true; objUserLogin.Createdatetime = DateTime.Now.ToString(); status = objUserLogin.Insert(); if (status == 1) { // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(txtUsername.Text.ToString().Trim(), Resources.MessageResource.strDefaultPassword.ToString(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(txtUsername.Text.ToString().Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user // Create Object objUserLogin of UserLogin_mst()Class objUserLogin = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName requesterid = objUserLogin.Get_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = requesterid; objContactInfo.Emailid = varEmail; objContactInfo.Firstname = txtUsername.Text.ToString(); objContactInfo.Lastname = txtUsername.Text.ToString(); objContactInfo.Insert(); /// added by vishal 18-05-2012 Session["UserCreate"] = ""; } } #endregion #region If User is Not to be Created else if (Session["UserCreate"].ToString() == "notcreate") { FlagUserStatus = false; } #endregion #endregion } objIncident.Title = txtTitle.Text.Trim(); //objIncident.Title = drpTitle.SelectedItem.Text; // objIncident.Title = txtTitle.Text.Trim() + "-" + Txtextension.Text.Trim(); //objIncident.Title = txtTitle.Text.Trim(); if (Txtextension.Text != "") { string extension = Txtextension.Text; Int64 vOut = Convert.ToInt64(extension); //int vOut = Convert.ToInt32(extension); objIncident.Extension = vOut; } //start changed by prachi-19thmarch if (drpAMCcall.SelectedItem.Text == "NO") { objIncident.AMCCall = false; } else if (drpAMCcall.SelectedItem.Text == "YES") { objIncident.AMCCall = true; } //end objIncident.Slaid = SLAid; objIncident.Createdbyid = createdbyid; objIncident.Requesterid = requesterid; objIncident.Siteid = siteid; objIncident.Description = txtDescription.Text.ToString().Trim(); objIncident.Deptid = Convert.ToInt32(drpDepartment.SelectedValue); objIncident.Createdatetime = DateTime.Now.ToString(); objIncident.Modeid = Convert.ToInt32(drpMode.SelectedValue); //objIncident.ExternalTicketNo = txtExternalTicket.Text.ToString().Trim(); if (FlagUserStatus == true) { FlagInsert = objIncident.Insert(); #region Save Assetid and incident id in incidenttoassetmaaping // Get Asset and Incident Id for incidenttoassetmaaping objOrganization = objOrganization.Get_Organization(); objUser = objUser.Get_UserLogin_By_UserName_Ex(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); int userid = Convert.ToInt32(objUser.Userid); int tempuser1 = Convert.ToInt32(Session["tempuser1"]); if (tempuser1 == 1) { assetid = Convert.ToInt32(Session["assetid"]); } else { assetid = Convert.ToInt32(objusertoasset.Get_AssetId_By_UserId(userid)); } int incid = Convert.ToInt32(objIncident.Get_TopIncidentId()); if (txtassignasset.Text != "") { //assetid = Convert.ToInt32(txtassignasset.Text); if (assetid != 0) { objincidenttoasset.Insert(incid, assetid); objusertoasset.Insert(userid, assetid, objUser.City, objUser.Company); Session.Abandon(); } } #endregion } if (FlagInsert == 1) { int FlagIncdStatesInsert; int incidentid; incidentid = objIncident.Get_Current_Incidentid(); objIncidentStates.Incidentid = incidentid; objIncidentStates.Priorityid = Convert.ToInt32(drpPriority.SelectedValue); objIncidentStates.Categoryid = Convert.ToInt32(drpCategory.SelectedValue); objIncidentStates.Statusid = Convert.ToInt32(drpStatus.SelectedValue); objIncidentStates.Subcategoryid = Convert.ToInt32(drpSubcategory.SelectedValue); objIncidentStates.Technicianid = Convert.ToInt32(drpTechnician.SelectedValue); if (Convert.ToInt32(drpTechnician.SelectedValue) != 0) { objIncidentStates.AssignedTime = DateTime.Now.ToString(); } objIncidentStates.Requesttypeid = Convert.ToInt32(drpRequestType.SelectedValue); FlagIncdStatesInsert = objIncidentStates.Insert(); if (FlagIncdStatesInsert == 1) { objIncidentHistory.Incidentid = incidentid; objIncidentHistory.Operation = "create"; objIncidentHistory.Operationownerid = createdbyid; objIncidentHistory.Insert(); objSentmailtoUser.SentmailUser(requesterid, incidentid, "open"); // change code///////////////////////////////////////////////////////////////// if (FileUpload1.HasFile) { string filepath = Server.MapPath("~/FileAttach/"); string[] filenameupd = FileUpload1.FileName.Split(new char[] { '.' }); string filenew = Convert.ToString(incidentid) + "." + filenameupd[1]; FileUpload1.PostedFile.SaveAs(filepath + filenew); } /////////////////////////////////////////////////////////////////////////////// if (Convert.ToInt32(drpTechnician.SelectedValue) != 0) { objSentmailtoUser.SentmailTechnician(Convert.ToInt32(drpTechnician.SelectedValue), incidentid); } Response.Redirect("~/Incident/IncidentRequestUpdate.aspx?incidentid=" + incidentid + ""); } } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
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(); //} } }
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); 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.Subject = "Call Logged. Ticket Id : " + incidentid; LogMessage("Call Open TicketId" + incidentid); ///////////////////////////////////////////////////commented by meenakshi 2nd july 2013 // 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>ResolutionTime :</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>"; ////////////////////////////////////////////////////end string strBody = "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 ; strBody = strBody + "<br/><b>Site :</b> " + objSite.Sitename ; strBody = strBody + "<br/><b>Logged Date & Time :</b> " + objIncident.Createdatetime; strBody = strBody + "<br/><b>Description</b> :" + objIncident.Description; strBody = strBody + "<br/><b>Priority :</b> " + objPriority.Name; strBody = strBody + "<br/><b>Username :</b>" + objUser.Username; strBody = strBody + "<br/><b>Email Address :</b> " + objC_info.Emailid; strBody = strBody + "<br/><b>ResolutionTime :</b> " + GetResolutionTimeInHours(objIncident.Slaid); if (objIncident.Siteid ==1) { //location = "1"; //contactnum = "9811801977"; //mailid = "*****@*****.**"; //techid = "16"; //cmd.CommandText = "insert into Incident_mst(Title, Timespentonreq, Slaid, Siteid, Requesterid, Modeid, Description, Deptid, Createdbyid, Createdatetime,Extension,Completedtime, ExternalTicketNo, VendorId,active,AMCCall ,Reporteddatetime)values(@Title, 0, 3, '" + location + "', 2, 5, @Description, 0, 2, @Createdatetime,0,null, null, 0,1, 0 ,@Reporteddatetime)"; //// SentMail("*****@*****.**", "*****@*****.**", subject, body); //strBody = strBody + "<br/><br/>For any other support kindly get in touch with us at 9811801977.<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>"; strBody = strBody + "<br/><br/> <b>For any other support, kindly get in touch with us at +911123890505, Extn:2180 / 2181 or at +911123906180/81.<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>1st Level : [email protected], Ext: 2259 or +919999969434</b><br/><b>2nd Level : [email protected], Ext: 2178 or +919871164411</b><br/><b>3rd Level : [email protected], Ext: 2175 or +919810079140</b><br/>"; strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>"; } else if (objIncident.Siteid ==2) { strBody = strBody + "<br/><br/><b>For any other support, kindly get in touch with us at +912266326582 and 6587 or +91 9820831745 (24/7)<br/><br/> In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>Name & Contact Details</b><br/><br/><b>Maruti Aldar : 6587</b><br/><b>Ranjana Kamle : 6587</b><br/><b>Brijesh Singh: 6587</b><br/>"; strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident NarimanPoint IT Support Desk, Ext. 6587 </b>"; } else if (objIncident.Siteid == 3) { strBody = strBody + "<br/><br/><b>For any other support kindly get in touch with us at +919930455789 and Extn:7411 / 7412, +917875551291 or at +912266727411/12<br/><br/> In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>Tier 1: Darshan Trivedi – (+91 9819404011)</b><br/><b>Tier 2: Sudhir Nate (+91 9930455714), Jignesh Patel (+91 9987228227)</b><br/><b>Tier 3: Apurv Sharma (+91 9930455781)</b>"; strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident BandraKurla IT Support, Ext. 7411 / 7412 </b>"; } else if (objIncident.Siteid == 4) { strBody = strBody + "<br/><br/><b>For any other support kindly get in touch with us at +918041358518, Extn:8516 / 8517 or email at [email protected]<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>Chethan Kumar. J</b><br/><b>[email protected]</b><br/><b>System Administrator</b>"; strBody = strBody + "<br/><b>91-9916033777</b><br/><br/><b>Yunus Khatib</b><br/><b>[email protected]</b><br/><b>Systems Manager</b><br/><b>91-9886058585</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> The Oberoi Bangalore IT Support, Ext. 8546 / 8517 </b>"; } else if (objIncident.Siteid == 5) { strBody = strBody + "<br/><br/> <b>For any other support kindly get in touch with us at +91 33 2249 2323 2323 or at +919831519900/ [email protected]<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>Arindam Banerjee </b><br/><b>Systems Manager</b><br/><b>The Oberoi Grand</b>"; strBody = strBody + "<br/><b>Email: [email protected]</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> The Oberoi Grand Kolkata IT Support </b>"; } else if (objIncident.Siteid == 6) { //strBody = strBody + "<br/><br/> <b>For any other support kindly get in touch with the </b><br/><br/><b>IT Support team on Extension 6252,Direct Number +91 40 6603 6252,Mobile Number + 91 88860 48662</b><br/><br/><b>Telephone Support staff on Extension 6253, Direct Number +91 40 6603 6253, Mobile Number +91 88860 48663</b><br/><br/><b>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b>"; //strBody = strBody + "<br/><b>IT Supervisor on extension 6251 (or) +91 40 6603 6251</b><br/><b>IT Manager on extension 6250 (or) +91 40 6603 6250 </b>"; // //<br/><br/><b>Name of Contact</b><br/><br/><b>Manoj Kumar</b><br/><b>Shashikanth. J</b><br/><b>Vivekanand Kaatpally</b><br/><br/><b>All the above engineers are available in the above extension number only except</b>"; ////strBody = strBody + "<br/><br/><b>Dasani Malla Reddy</b><br/><br/><b>Extension 6253 </b><br/><b>Direct Number +91 40 6603 6253 </b><br/><br/><b>Mobile Number + 91 88860 48663</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident Hyderabad IT Support </b>"; //strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident Hyderabad IT Support </b>"; strBody = strBody + "<br/><br/> For any other support kindly get in touch with the <br/><br/>IT Support team      on Extension 6252,Direct Number +91 40 6603 6252,Mobile Number + 91 88860 48662<br/><br/>Telephone Support staff      on Extension 6253, Direct Number +91 40 6603 6253, Mobile Number +91 88860 48663<br/><br/>If your queries are unresolved, please call us at the following extension / mobile numbers:"; strBody = strBody + "<br/><br/>IT Supervisor       on extension 6251 (or) +91 40 6603 6251<br/>IT Manager      on extension 6250 (or) +91 40 6603 6250 "; strBody = strBody + "<br/><br/>Yours sincerely,<br/><br/> Trident Hyderabad IT Support "; } else if (objIncident.Siteid == 7) { //strBody = strBody + "<br/><br/>For any other support kindly get in touch with us at 9811801977.<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>"; strBody = strBody + "<br/><br/> <b>For any other support, kindly get in touch with us at +911123890505, Extn:2180 / 2181 or at +911123906180/81.<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>1st Level : [email protected], Ext: 2259 or +919999969434</b><br/><b>2nd Level : [email protected], Ext: 2178 or +919871164411</b><br/><b>3rd Level : [email protected], Ext: 2175 or +919810079140</b><br/>"; strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>"; } else if (objIncident.Siteid == 8) { strBody = strBody + "<br/><br/><b>For any other support kindly get in touch with us at Extn:8271 or at +919962218422/ [email protected]<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>Satheesh Kumar.S,</b><br/><b>Extn: 8270</b><br/><b>Mobile: +919884398638</b><br/><b>Email: [email protected]</b>"; strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident Chennai IT Support, Ext. 8271 </b>"; } else if (objIncident.Siteid == 9) { strBody = strBody + "<br/><br/><b>For any other support kindly get in touch with us at +911123890505, Extn:2370 or at +911123906180/81<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>Pawan Suman & Contact Details +91 7838651733 with email address [email protected]</b>"; strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> Maidens Hotel IT Support, Ext, 2370 </b>"; } else { strBody = strBody + "<br/><br/> <b>For any other support, kindly get in touch with us at +911123890505, Extn:2180 / 2181 or at +911123906180/81.<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>1st Level : [email protected], Ext: 2259 or +919999969434</b><br/><b>2nd Level : [email protected], Ext: 2178 or +919871164411</b><br/><b>3rd Level : [email protected], Ext: 2175 or +919810079140</b><br/>"; strBody = strBody + "<br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>"; //strBody = strBody + "<br/><br/>For any other support kindly get in touch with us at 9811801977.<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>"; } LogMessage("Before mail send(Call Open)"); obj.Body = strBody; 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.ToInt32(objIncident.Incidentid); string varServerName1; string varfeedbackmode="0"; varServerName1 = Resources.MessageResource.serverNameForChangePage.ToString(); //added by lalit to check feedback mode. feedback should add in mail or not. 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; /////////////////////////////////////////added on 04July13 02:18PM #region Define Regards and ContactNo for differenct Sites string Regards = ""; string Contactno = ""; if (objIncident.Siteid == 1) { Regards = "EIH Central Helpdesk"; Contactno = "+911123890505, Extn:2180 / 2181"; } if (objIncident.Siteid == 2) { Regards = "Trident NarimanPoint IT Support Desk, Ext. 6587"; Contactno = "+912266326582 and 6587 or +91 9820831745 (24/7)"; } if (objIncident.Siteid == 3) { Regards = "Trident BandraKurla IT Support, Ext. 7411 / 7412"; Contactno = "+919930455789 and Extn:7411 / 7412, +917875551291 or at +912266727411/12"; } if (objIncident.Siteid == 4) { Regards = "The Oberoi Bangalore IT Support, Ext. 8546 / 8517 "; Contactno = "+918041358518, Extn:8516 / 8517"; } if (objIncident.Siteid == 5) { Regards = "The Oberoi Grand Kolkata IT Support"; Contactno = "+91 33 2249 2323 2323 or at +919831519900"; } if (objIncident.Siteid == 6) { Regards = "Trident Hyderabad IT Support"; Contactno = "+91 40 6603 6252 and 6252 or + 91 88860 48662"; } if (objIncident.Siteid == 7) { Regards = "EIH Central Helpdesk"; Contactno = "9811801977"; } if (objIncident.Siteid == 8) { Regards = "Trident Chennai IT Support, Ext. 8271"; Contactno = "Extn:8271 or at +919962218422"; } if (objIncident.Siteid == 9) { Regards = "Maidens Hotel IT Support, Ext, 2370"; Contactno = "+911123890505, Extn:2370 or at +911123906180/81"; } #endregion ///////////////////////////////////////////end obj.Subject = "Call Closed Ticket id : " + incidentid; LogMessage("Call Closed TicketId" + 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; if (objIncident.Siteid == 1) { obj.Body = obj.Body + @"<br/><br/> <b>For any other support, kindly get in touch with us at +911123890505, Extn:2180 / 2181 or at +911123906180/81.<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>1st Level : [email protected], Ext: 2259 or +919999969434</b><br/><b>2nd Level : [email protected], Ext: 2178 or +919871164411</b><br/><b>3rd Level : [email protected], Ext: 2175 or +919810079140</b><br/> <br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>"; } else if (objIncident.Siteid == 2) { obj.Body = obj.Body + @"<br/><br/> <b>For any other support, kindly get in touch with us at +912266326582 and 6587 or +91 9820831745 (24/7)<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>Name & Contact Details</b><br/><br/><b>Maruti Aldar : 6587</b><br/><b>Ranjana Kamle : 6587</b><br/><b>Brijesh Singh: 6587</b><br/> <br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident NarimanPoint IT Support Desk, Ext. 6587 </b>"; } else if (objIncident.Siteid == 3) { obj.Body = obj.Body + @"<br/><br/><b>For any other support kindly get in touch with us at +919930455789 and Extn:7411 / 7412, +917875551291 or at +912266727411/12<br/><br/> <b>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/>Tier 1: Darshan Trivedi – (+91 9819404011)</b><br/><b>Tier 2: Sudhir Nate (+91 9930455714), Jignesh Patel (+91 9987228227)</b><br/><b>Tier 3: Apurv Sharma (+91 9930455781)</b> <br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident BandraKurla IT Support, Ext. 7411 / 7412 </b>"; } else if (objIncident.Siteid == 4) { obj.Body = obj.Body + @"<br/><br/> <b>For any other support kindly get in touch with us at +918041358518, Extn:8516 / 8517 or email at [email protected]<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>Chethan Kumar. J</b><br/><b>[email protected]</b><br/><b>System Administrator</b> <br/><b>91-9916033777</b><br/><br/><b>Yunus Khatib</b><br/><b>[email protected]</b><br/><b>Systems Manager</b><br/><b>91-9886058585</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> The Oberoi Bangalore IT Support, Ext. 8546 / 8517 </b>"; } else if (objIncident.Siteid == 5) { obj.Body = obj.Body + @"<br/><br/><b>For any other support kindly get in touch with us at +91 33 2249 2323 2323 or at +919831519900/ [email protected]<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>Arindam Banerjee </b><br/><b>Systems Manager</b><br/><b>The Oberoi Grand</b> <br/><b>Email: [email protected]</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> The Oberoi Grand Kolkata IT Support </b>"; } else if (objIncident.Siteid == 6) { // obj.Body = obj.Body + @"<br/><br/> <b>For any other support kindly get in touch with the IT Support team on <br/><br/>Extension 6252 </b><br/><br/><b>Direct Number +91 40 6603 6252 </b><br/><b>Mobile Number + 91 88860 48662</b><br/><br/><b>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b> // <br/><b>IT Supervisor on extension 6251 (or) +91 40 6603 6251</b><br/><b>IT Manager on extension 6250 (or) +91 40 6603 6250 </b><br/><br/><b>Name of Contact</b> <br/><br/><b>Manoj Kumar</b><br/><b>Shashikanth. J</b><br/><b>Vivekanand Kaatpally</b><br/><br/><b>All the above engineers are available in the above extension number only except</b> // <br/><br/><b>Dasani Malla Reddy</b><br/><br/><b>Extension 6253 </b><br/><b>Direct Number +91 40 6603 6253 </b><br/><br/><b>Mobile Number + 91 88860 48663</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident Hyderabad IT Support </b>"; obj.Body = obj.Body + @"<br/><br/> For any other support kindly get in touch with the <br/><br/>IT Support team      on Extension 6252,Direct Number +91 40 6603 6252,Mobile Number + 91 88860 48662<br/><br/>Telephone Support staff      on Extension 6253, Direct Number +91 40 6603 6253, Mobile Number +91 88860 48663<br/><br/>If your queries are unresolved, please call us at the following extension / mobile numbers: <br/><br/>IT Supervisor       on extension 6251 (or) +91 40 6603 6251<br/>IT Manager      on extension 6250 (or) +91 40 6603 6250 <br/><br/>Yours sincerely,<br/><br/> Trident Hyderabad IT Support "; } else if (objIncident.Siteid == 7) { obj.Body = obj.Body + @"<br/><br/> <b>For any other support, kindly get in touch with us at +911123890505, Extn:2180 / 2181 or at +911123906180/81.<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>1st Level : [email protected], Ext: 2259 or +919999969434</b><br/><b>2nd Level : [email protected], Ext: 2178 or +919871164411</b><br/><b>3rd Level : [email protected], Ext: 2175 or +919810079140</b><br/> <br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>"; } else if (objIncident.Siteid == 8) { obj.Body = obj.Body + @"<br/><br/><b>For any other support kindly get in touch with us at Extn:8271 or at +919962218422/ [email protected]<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>Satheesh Kumar.S,</b><br/><b>Extn: 8270</b><br/><b>Mobile: +919884398638</b><br/><b>Email: [email protected]</b> <br/><br/><b>Yours sincerely,</b><br/><br/> <b> Trident Chennai IT Support, Ext. 8271 </b>"; } else if (objIncident.Siteid == 9) { obj.Body = obj.Body + @"<br/><br/><b>For any other support kindly get in touch with us at +911123890505, Extn:2370 or at +911123906180/81<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>Pawan Suman & Contact Details +91 7838651733 with email address [email protected]</b> <br/><br/><b>Yours sincerely,</b><br/><br/> <b> Maidens Hotel IT Support, Ext, 2370 </b>"; } else { obj.Body = obj.Body + @"<br/><br/> <b>For any other support, kindly get in touch with us at +911123890505, Extn:2180 / 2181 or at +911123906180/81.<br/><br/>In case your queries unresolved or not satisfactory kindly reach to below escalation matrix:</b><br/><br/><b>1st Level : [email protected], Ext: 2259 or +919999969434</b><br/><b>2nd Level : [email protected], Ext: 2178 or +919871164411</b><br/><b>3rd Level : [email protected], Ext: 2175 or +919810079140</b><br/> <br/><br/><b>Yours sincerely,</b><br/><br/> <b> EIH Central Helpdesk </b>"; } //+ "<br/><br/> For any other support, kindly get in touch with us at " //+ Contactno + ".<br/><br/> <b>This is an auto generated mail. Please do not reply.</b><br/><br/><b>Yours sincerely,</b><br/><br/> <b>" //+ Regards + "</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 " + Contactno + ".<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>" + Regards + "</b>"; } LogMessage("Before mail send(Call Closed)"); obj.SmtpServer = Resources.MessageResource.strSMTPServer.ToString(); obj.SentMail(); } } } //int id = Convert.ToInt32(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 buttonadd_click(object sender, EventArgs e) { /////Add Exception handilng try catch change by vishal 21-05-2012 try { #region Find Userid of User who is Requesting to log a call #region If User Already Exist if (ViewState["UserCreate"].ToString() == "Exist") { objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); if (ObjUserLogin.Userid != 0) { requesterid = ObjUserLogin.Userid; } } #endregion #region If New User is to be Created else if (ViewState["UserCreate"].ToString() == "create") { string varEmail = ""; string varRoleName = Resources.MessageResource.BasicUserRole.ToString(); if (txtEmail.Text == "") { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } else { varEmail = txtEmail.Text; } int roleid = objRole.Get_By_RoleName(varRoleName); int status; objOrganization = objOrganization.Get_Organization(); objuser.Username = txtUsername.Text.ToString(); objuser.Password = Resources.MessageResource.strDefaultPassword.ToString(); objuser.Roleid = roleid; objuser.Orgid = objOrganization.Orgid; objuser.ADEnable = false; objuser.Enable = true; objuser.Createdatetime = DateTime.Now.ToString(); status = objuser.Insert(); if (status == 1) { // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(txtUsername.Text.ToString().Trim(), Resources.MessageResource.strDefaultPassword.ToString(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(txtUsername.Text.ToString().Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user // Create Object objUserLogin of UserLogin_mst()Class objuser = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName requesterid = objuser.Get_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = requesterid; objContactInfo.Emailid = varEmail; objContactInfo.Firstname = txtUsername.Text.ToString(); objContactInfo.Lastname = txtUsername.Text.ToString(); objContactInfo.Insert(); } } #endregion #region If User is Not to be Created else if (ViewState["UserCreate"].ToString() == "notcreate") { // FlagUserStatus = false; } #endregion #endregion ObjChange.Active = true; ObjChange.Statusid = Convert.ToInt32(drpStatus.SelectedValue); ObjChange.Categoryid = Convert.ToInt32(drpCategory.SelectedValue); ObjChange.Subcategoryid = Convert.ToInt32(drpSubcategory.SelectedValue); // ObjChange.Technician =Convert.ToInt32(drpTechnician.SelectedValue); ObjChange.Title = txtTitle.Text; ObjChange.Description = txtDescription.Text; ObjChange.Createdtime = DateTime.Now.ToString(); ObjChange.Changetype = Convert.ToInt32(drpchangetype.SelectedValue); ObjChange.Approvalstatus = "Send For Approval"; MembershipUser user = Membership.GetUser(); string username = user.UserName.ToString(); objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(username, objOrganization.Orgid); int userid = Convert.ToInt32(ObjUserLogin.Userid); ObjChange.CreatedByID = userid; ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text, objOrganization.Orgid); ObjChange.Requestedby = ObjUserLogin.Userid; // ObjChange.Priority = Convert.ToInt32(drpPriority.SelectedValue); ObjChange.Insert(); int changeid = ObjChange.Get_Current_Changeid(); for (int i = ListAsset.Items.Count - 1; i >= 0; i--) { if (ListAsset.Items[i].Selected == true) { Objincludeaasetchange.Assetid = Convert.ToInt32(ListAsset.Items[i].Value); Objincludeaasetchange.Changeid = changeid; Objincludeaasetchange.Insert(); } } ObjChangeHistory.Changeid = changeid; // ObjChangeHistory.Description = "create"; ObjChangeHistory.Operation = "create"; ObjChangeHistory.Operationownerid = ObjUserLogin.Userid; ObjChangeHistory.Insert(); int changetype = Convert.ToInt32(drpchangetype.SelectedValue); objSentEmailToChange.SentMailToChangeCommittee(changeid, changetype); Response.Redirect("~/Change/EditChange.aspx?" + changeid + " "); } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
protected void btnAdd_Click(object sender, EventArgs e) {//Add Exception handilng try catch change by vishal 21-05-2012 try { bool FlagUserStatus = true; #region Find Userid of User who is Requesting to log a call #region If User Already Exist if (ViewState["UserCreate"].ToString() == "Exist") { objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); if (ObjUserLogin.Userid != 0) { requesterid = ObjUserLogin.Userid; } } #endregion #region If New User is to be Created else if (ViewState["UserCreate"].ToString() == "create") { string varEmail = ""; string varRoleName = Resources.MessageResource.BasicUserRole.ToString(); if (txtEmail.Text == "") { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } else { varEmail = txtEmail.Text; } int roleid = objRole.Get_By_RoleName(varRoleName); int status; objOrganization = objOrganization.Get_Organization(); objuser.Username = txtUsername.Text.ToString(); objuser.Password = Resources.MessageResource.strDefaultPassword.ToString(); objuser.Roleid = roleid; objuser.Orgid = objOrganization.Orgid; objuser.ADEnable = false; objuser.Enable = true; objuser.Createdatetime = DateTime.Now.ToString(); status = objuser.Insert(); if (status == 1) { // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(txtUsername.Text.ToString().Trim(), Resources.MessageResource.strDefaultPassword.ToString(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(txtUsername.Text.ToString().Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user // Create Object objUserLogin of UserLogin_mst()Class objuser = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName requesterid = objuser.Get_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = requesterid; objContactInfo.Emailid = varEmail; objContactInfo.Firstname = txtUsername.Text.ToString(); objContactInfo.Lastname = txtUsername.Text.ToString(); objContactInfo.Insert(); } } #endregion #region If User is Not to be Created else if (ViewState["UserCreate"].ToString() == "notcreate") { FlagUserStatus = false; } #endregion #endregion MembershipUser User = Membership.GetUser(); string userName; userName = User.UserName.ToString(); if (FlagUserStatus == true) { objOrganization = objOrganization.Get_Organization(); objuser = objuser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); ObjProblem.CreatedByid = objuser.Userid; ObjProblem.Requesterid = requesterid; ObjProblem.Categoryid = Convert.ToInt32(drpCategory.SelectedValue); ObjProblem.Subcategoryid = Convert.ToInt32(drpSubcategory.SelectedValue); ObjProblem.Priorityid = Convert.ToInt32(drpPriority.SelectedValue); ObjProblem.Statusid = Convert.ToInt32(drpStatus.SelectedValue); ObjProblem.Technicianid = Convert.ToInt32(drpTechnician.SelectedValue); ObjProblem.title = txtTitle.Text; ObjProblem.Description = txtDescription.Text; if (Convert.ToInt32(drpTechnician.SelectedValue) != 0) { ObjProblem.AssginedTime = DateTime.Now.ToString(); } ObjProblem.Insert(); int problemid = ObjProblem.Get_Current_Problemid(); ObjProblemHistory.Operationtime = DateTime.Now.ToString(); ObjProblemHistory.Problemid = problemid; ObjProblemHistory.Operation = "create"; ObjProblemHistory.Operationownerid = objuser.Userid; if (Session["IncidentToProblem"] != null) { int incidentid = Convert.ToInt32(Session["IncidentToProblem"].ToString()); Incident_To_Problem objIncToprob = new Incident_To_Problem(); objIncToprob.Incidentid = incidentid; objIncToprob.Problemid = problemid; objIncToprob.Insert(); } if (Convert.ToInt32(drpTechnician.SelectedValue) != 0) { objSentMailToUser.SentMailToTechnicianForProblemCall(problemid, Convert.ToInt32(drpTechnician.SelectedValue)); } ObjProblemHistory.Insert(); //ResetControls(); string myScript; myScript = "<script language=javascript>javascript:window.close();</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
public string UserCreate(string UName, string Password, string Company, string city, string roleid, string UserEmailId, string RoleName, string Description, string EmployeeId, string LandLineNo, string MobileNo, string Location, string DepartmentId) { objOrganization = objOrganization.Get_Organization(); //Declare Local Variables - Flag,varRolename,FlagMembership int Flag; string varRoleName; bool FlagMembership; // Use Asp.Net Membership Validator Control Membership.ValidateUser to check User Exist in aspnet Database FlagMembership = Membership.ValidateUser(UName, Password); // Create Object of UserLogin_mst Class to Check User Exist in Database UserLogin_mst table UserLogin_mst objUserLogin = new UserLogin_mst(); // Declare local Variable Flag to Check Status User Exist in databse Flag = objUserLogin.Get_By_UserName(UName, objOrganization.Orgid); // If User Does'nt exist in Database and in aspnet databse then flag value will 0 and FlagMembership value will be False if (Flag == 0 && FlagMembership == false) { // Declare status local variable int status; // Create Object objUserLogin of UserLogin_mst() Class to insert record in table objUserLogin = new UserLogin_mst(); objUserLogin.Username = UName; objUserLogin.Password = Password; objUserLogin.Company = Company; objUserLogin.City = city; objUserLogin.Roleid = Convert.ToInt32(roleid); objUserLogin.Orgid = objOrganization.Orgid; objUserLogin.ADEnable = false; objUserLogin.Enable = true; objUserLogin.Createdatetime = DateTime.Now.ToString(); // Call Insert function to insert record in UserLogin_mst table // Check status whether Record inserted Successfully or Not,If status=1 then Success otherwise Operation Fail status = objUserLogin.Insert(); if (status == 1) { // Declare local variable varEmail to fetch email of user from textbox string varEmail; //If Email field is Not Empty then Assign value to varEmail Local Variable if (UserEmailId != "") { varEmail = UserEmailId.Trim(); } // Else Assign value define in MessagesResources.resx file in errMemshipCreateUserEmail field else { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } // Assign selected text from droprole down to local variable field varRoleName varRoleName = RoleName.Trim(); // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(UName.Trim(), Password.Trim(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(UName.Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user int userid; // Create Object objUserLogin of UserLogin_mst()Class objUserLogin = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName userid = objUserLogin.Get_By_UserName(UName.Trim(), objOrganization.Orgid); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured UserToSiteMapping objusertositemapping = new UserToSiteMapping(); if (userid != 0) { // Create Object objContactInfo of ContactInfo_mst class to Store User Contact Information in Contact_info table ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = userid; objContactInfo.Firstname = UName.Trim(); objContactInfo.Lastname = UName.Trim(); objContactInfo.Description = Description; objContactInfo.Empid = EmployeeId; objContactInfo.Emailid = UserEmailId; objContactInfo.Landline = LandLineNo; objContactInfo.Mobile = MobileNo; objContactInfo.Siteid = Convert.ToInt32(Location); //if (DrpDepartment.SelectedItem.ToString() != null) //{ objContactInfo.Deptid = Convert.ToInt32(DepartmentId); //} // Call objContactInfo.Insert function to Insert record in Contact_info table objContactInfo.Insert(); // Show Message Operation perform successfully //lblMessage.Text = Resources.MessageResource.errDataSave.ToString(); // Calling Function Clear() to Clear all controls on Form objusertositemapping.Userid = userid; objusertositemapping.Siteid = Convert.ToInt32(Location); objusertositemapping.Insert(); return("Created"); } else { return("Error"); } } else { return("Error"); } } else { return("Already Exist"); } }
protected void UpdateUser() { int Custid = 0; int userid = Convert.ToInt32(Request.QueryString[0]); ObjUserLogin = ObjUserLogin.Get_By_id(userid); ObjContactInfo = ObjContactInfo.Get_By_id(userid); if (ObjUserLogin.Userid != 0 && ObjContactInfo.Userid != 0) { txtUserName.Text = ObjUserLogin.Username.ToString().Trim(); txtPassword.Attributes.Add("value", ObjUserLogin.Password.ToString()); if (ObjUserLogin.City != null) { txtCity.Text = ObjUserLogin.City.ToString().Trim(); } if (ObjUserLogin.Company != null) { txtCompany.Text = ObjUserLogin.Company.ToString().Trim(); } txtRetypePassword.Attributes.Add("value", ObjUserLogin.Password.ToString()); dropRole.SelectedValue = ObjUserLogin.Roleid.ToString().Trim(); ViewState["Roleid"] = ObjUserLogin.Roleid; if (ObjUserLogin.ADEnable == true) { lblAdUser.Text = "Yes"; } else { lblAdUser.Text = "No"; } txtFname.Text = ObjContactInfo.Firstname.ToString().Trim(); txtLname.Text = ObjContactInfo.Lastname.ToString().Trim(); if (ObjContactInfo.Landline != null) { txtLandline.Text = ObjContactInfo.Landline.ToString().Trim(); } if (ObjContactInfo.Emailid != null) { txtEmailId.Text = ObjContactInfo.Emailid.ToString().Trim(); } if (ObjContactInfo.Empid != null) { txtEmpId.Text = ObjContactInfo.Empid.ToString().Trim(); } if (ObjContactInfo.Emailid != null) { txtEmailId.Text = ObjContactInfo.Emailid.ToString(); } if (ObjContactInfo.Mobile != null) { txtMobile.Text = ObjContactInfo.Mobile.ToString(); } if (ObjContactInfo.Description != null) { txtDesc.Text = ObjContactInfo.Description.ToString(); } colCustToSite = objCustToSite.Get_All_By_siteid(ObjContactInfo.Siteid); foreach (CustomerToSiteMapping obj in colCustToSite) { Custid = obj.Custid; } ViewState["CustId"] = Custid; drpCustomer.SelectedValue = Convert.ToString(Custid); BindDrpsite(); DrpSite.SelectedValue = ObjContactInfo.Siteid.ToString(); //DrpOrg.SelectedValue = ObjUserLogin.Orgid.ToString(); BindDrpDepartment(); DrpDepartment.SelectedValue = ObjContactInfo.Deptid.ToString(); if (ObjUserLogin.Enable == true) { DropEnable.SelectedValue = "1"; } else { DropEnable.SelectedValue = "0"; } } }
protected void Page_Load(object sender, EventArgs e) { /////Add Exception handilng try catch change by vishal 21-05-2012 try { this.ClientScript.GetPostBackEventReference(this, "arg"); // Values for SelectAsset Page after select the asset for a particular user int flag = Convert.ToInt32(Session["flag"]); if (flag == 1) { assetid = Convert.ToInt32(Session["assetid"]); compname = (string)(Session["compname"]); txtassignasset.Text = compname.ToString(); if (Session["username"] != null) { username = (string)(Session["username"]); } if(Session["Username"] != null) { username = (string)(Session["Username"]); } // ViewState["Name"] = txtUsername.Text; txtUsername.Text = (string)username; //txtEmail.Text = Session["Email"].ToString(); //flag = 0; ///////////////////////////////////////////////////////////////change done by meenakshi if (Session["mail"] != null) { txtEmail.Text = Session["mail"].ToString(); } if (Session["Email"] != null) { txtEmail.Text = Session["Email"].ToString(); } if (Session["Subject"] != null) { txtTitle.Text = Session["Subject"].ToString(); } if (Session["Body"] != null) { txtDescription.Text = Session["Body"].ToString(); } flag = 0; ///////////////////////////////////////////////////////////////end } if (!IsPostBack) { #region Disable Reported DateTime string CallReportingTime = Resources.MessageResource.strCallReportingTime.ToString(); if (CallReportingTime == "0") { trreporteddate.Visible = false; trreportedtime.Visible = false; } #endregion txtReportedDate.Text = DateTime.Today.ToString("dd/MM/yyyy"); #region Declaration of Binding Drop Down Function BindDropCustomer(); BindDropSite(); BindDropDept(); BindDropCategory(); BindDropStatus(); BindDropMode(); BindDropPriority(); //uncomment later lalit BindDropTechnician(); BindDropSubCategory(); BindDropRequestType(); #region added by lalit to integrate automail if (techmapping == "1") { if (Session["Body"] != null) { txtDescription.Text = Session["Body"].ToString(); //changed by shrikant colPriority = objPriority.Get_All(); drpPriority.DataTextField = "name"; drpPriority.DataValueField = "priorityid"; drpPriority.DataSource = colPriority; drpPriority.DataBind(); ContactInfo_mst objConInfo = new ContactInfo_mst(); ListItem item = new ListItem(); item.Text = "-------------Select-------------"; if (objConInfo.userpriority == 1) { item.Value = "0"; drpPriority.Items.Add(item); //drpPriority.SelectedValue = "8"; drpPriority.SelectedItem.Text = "High"; } else { item.Value = "0"; drpPriority.Items.Add(item); drpPriority.SelectedValue = "0"; } //end } if (Session["Subject"] != null) { /////////////////////////////////////////////////////////////////////////////////////change done by meenakshi drpMode.Items.FindByValue("0").Selected = false; drpMode.Items.FindByText("Email").Selected = true; drpPriority.Items.FindByValue("0").Selected = false; drpPriority.Items.FindByText("Normal").Selected = true; drpPriority.Items.FindByText("-------------Select-------------").Selected = true; txtTitle.Text = Session["Subject"].ToString(); /////////////////////////////////////////////////////////////////////////////////////////////end BindCategoryAndSubCategoryAndTechnician(Session["Subject"].ToString()); } if (Session["mail"] != null) { txtEmail.Text = Session["mail"].ToString(); } if (Session["RegardsName"] != null) { txtUsername.Text = (string)(Session["RegardsName"]); } //txtUsername.Focus(); //added by lalit to get email id of user on basis of userid if (Session["RegardsName"] != null) { CheckUserExist(); } //end } #endregion end #endregion PopulateTimeDropDown(); } #region Page is Postback by Javascript,and get eventArgument to check user is to be created or not if (IsPostBack) { string eventTarget = this.Request["__EVENTTARGET"]; string eventArgument = this.Request["__EVENTARGUMENT"]; if (eventTarget != string.Empty && eventTarget == "callPostBack") { if (eventArgument != string.Empty) { Session["UserCreate"] = eventArgument.ToString(); } } #region when autocall is enabled if (techmapping == "1") { if (Session["mail"] != null) { txtEmail.Text = Session["mail"].ToString(); } //if (Session["Subject"] != null) //{ // txtTitle.Text = Session["Subject"].ToString(); //} /////////////////////////////////////////////////////////////////////////////change done by meenakshi if (Session["Subject"] != null) { if (txtTitle.Text.Trim().Length > 0) { } else { txtTitle.Text = Session["Subject"].ToString(); } } else if (Session["Subject"] == null && txtTitle.Text.Length > 0) { Session["Subject"] = txtTitle.Text; } ///////////////////////////////////////////////////////////////////////////////////////////////////end if (Session["Body"] != null) { if (txtDescription.Text.Trim().Length > 0) { } else { txtDescription.Text = Session["Body"].ToString(); } } else if (Session["Body"] == null && txtDescription.Text.Length > 0) { Session["Body"] = txtDescription.Text; } ///////////////////////////commented on 28.12.12 //BindTechnician(); ///////////////////////////end } #endregion } #endregion } catch (Exception ex) { string myScript; myScript = "<script language=javascript>alert('Exception - '" + ex + "');</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); return; } }
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 UpdateUser() { int Custid = 0; int userid = Convert.ToInt16(Request.QueryString[0]); ObjUserLogin = ObjUserLogin.Get_By_id(userid); ObjContactInfo = ObjContactInfo.Get_By_id(userid); if (ObjUserLogin.Userid != 0 && ObjContactInfo.Userid !=0) { txtUserName.Text = ObjUserLogin.Username.ToString().Trim(); txtPassword.Attributes.Add("value",ObjUserLogin.Password.ToString()); txtRetypePassword.Attributes.Add("value", ObjUserLogin.Password.ToString()); dropRole.SelectedValue = ObjUserLogin.Roleid.ToString().Trim(); ViewState["Roleid"] = ObjUserLogin.Roleid; if (ObjUserLogin.ADEnable == true) { lblAdUser.Text = "Yes"; } else { lblAdUser.Text = "No"; } txtFname.Text = ObjContactInfo.Firstname.ToString().Trim(); txtLname.Text = ObjContactInfo.Lastname.ToString().Trim(); if (ObjContactInfo.Landline != null ) { txtLandline.Text = ObjContactInfo.Landline.ToString().Trim(); } if (ObjContactInfo.Emailid != null ) { txtEmailId.Text = ObjContactInfo.Emailid.ToString().Trim(); } if (ObjContactInfo.Empid != null ) { txtEmpId.Text = ObjContactInfo.Empid.ToString().Trim(); } if (ObjContactInfo.Emailid != null) { txtEmailId.Text = ObjContactInfo.Emailid.ToString(); } if (ObjContactInfo.Mobile != null) { txtMobile.Text = ObjContactInfo.Mobile.ToString(); } if (ObjContactInfo.Description != null) { txtDesc.Text = ObjContactInfo.Description.ToString(); } colCustToSite = objCustToSite.Get_All_By_siteid(ObjContactInfo.Siteid); foreach (CustomerToSiteMapping obj in colCustToSite) { Custid = obj.Custid; } ViewState["CustId"] = Custid; drpCustomer.SelectedValue = Convert.ToString(Custid); BindDrpsite(); DrpSite.SelectedValue = ObjContactInfo.Siteid.ToString(); //DrpOrg.SelectedValue = ObjUserLogin.Orgid.ToString(); BindDrpDepartment(); DrpDepartment.SelectedValue = ObjContactInfo.Deptid.ToString(); if(ObjUserLogin.Enable==true) {DropEnable.SelectedValue="1";} else{DropEnable.SelectedValue="0";} } }
protected void btnAdd_Click(object sender, EventArgs e) { bool FlagUserStatus = true; #region Find Userid of User who is Requesting to log a call #region If User Already Exist if (ViewState["UserCreate"].ToString() == "Exist") { objOrganization = objOrganization.Get_Organization(); ObjUserLogin = ObjUserLogin.Get_UserLogin_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); if (ObjUserLogin.Userid != 0) { requesterid = ObjUserLogin.Userid; } } #endregion #region If New User is to be Created else if (ViewState["UserCreate"].ToString() == "create") { string varEmail = ""; string varRoleName = Resources.MessageResource.BasicUserRole.ToString(); if (txtEmail.Text == "") { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } else { varEmail = txtEmail.Text; } int roleid = objRole.Get_By_RoleName(varRoleName); int status; objOrganization = objOrganization.Get_Organization(); objuser.Username = txtUsername.Text.ToString(); objuser.Password = Resources.MessageResource.strDefaultPassword.ToString(); objuser.Roleid = roleid; objuser.Orgid = objOrganization.Orgid; objuser.ADEnable = false; objuser.Enable = true; objuser.Createdatetime = DateTime.Now.ToString(); status = objuser.Insert(); if (status == 1) { // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(txtUsername.Text.ToString().Trim(), Resources.MessageResource.strDefaultPassword.ToString(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(txtUsername.Text.ToString().Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user // Create Object objUserLogin of UserLogin_mst()Class objuser = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName requesterid = objuser.Get_By_UserName(txtUsername.Text.ToString().Trim(), objOrganization.Orgid); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = requesterid; objContactInfo.Emailid = varEmail; objContactInfo.Firstname = txtUsername.Text.ToString(); objContactInfo.Lastname = txtUsername.Text.ToString(); objContactInfo.Insert(); } } #endregion #region If User is Not to be Created else if (ViewState["UserCreate"].ToString() == "notcreate") { FlagUserStatus = false; } #endregion #endregion MembershipUser User = Membership.GetUser(); string userName; userName = User.UserName.ToString(); if (FlagUserStatus == true) { objOrganization = objOrganization.Get_Organization(); objuser = objuser.Get_UserLogin_By_UserName(userName, objOrganization.Orgid); ObjProblem.CreatedByid = objuser.Userid; ObjProblem.Requesterid = requesterid; ObjProblem.Categoryid = Convert.ToInt16(drpCategory.SelectedValue); ObjProblem.Subcategoryid = Convert.ToInt16(drpSubcategory.SelectedValue); ObjProblem.Priorityid = Convert.ToInt16(drpPriority.SelectedValue); ObjProblem.Statusid = Convert.ToInt16(drpStatus.SelectedValue); ObjProblem.Technicianid = Convert.ToInt16(drpTechnician.SelectedValue); ObjProblem.title = txtTitle.Text; ObjProblem.Description = txtDescription.Text; if (Convert.ToInt16(drpTechnician.SelectedValue) != 0) { ObjProblem.AssginedTime = DateTime.Now.ToString(); } ObjProblem.Insert(); int problemid = ObjProblem.Get_Current_Problemid(); ObjProblemHistory.Operationtime = DateTime.Now.ToString(); ObjProblemHistory.Problemid = problemid; ObjProblemHistory.Operation = "create"; ObjProblemHistory.Operationownerid = objuser.Userid; if (Session["IncidentToProblem"] != null) { int incidentid = Convert.ToInt16(Session["IncidentToProblem"].ToString()); Incident_To_Problem objIncToprob = new Incident_To_Problem(); objIncToprob.Incidentid = incidentid; objIncToprob.Problemid = problemid; objIncToprob.Insert(); } if (Convert.ToInt16(drpTechnician.SelectedValue) != 0) { objSentMailToUser.SentMailToTechnicianForProblemCall(problemid, Convert.ToInt16(drpTechnician.SelectedValue)); } ObjProblemHistory.Insert(); //ResetControls(); string myScript; myScript = "<script language=javascript>javascript:window.close();</script>"; Page.RegisterClientScriptBlock("MyScript", myScript); } }
public string UserCreate(string UName, string Password, string Company, string city, string roleid, string UserEmailId, string RoleName, string Description, string EmployeeId, string LandLineNo, string MobileNo, string Location, string DepartmentId) { objOrganization = objOrganization.Get_Organization(); //Declare Local Variables - Flag,varRolename,FlagMembership int Flag; string varRoleName; bool FlagMembership; // Use Asp.Net Membership Validator Control Membership.ValidateUser to check User Exist in aspnet Database FlagMembership = Membership.ValidateUser(UName, Password); // Create Object of UserLogin_mst Class to Check User Exist in Database UserLogin_mst table UserLogin_mst objUserLogin = new UserLogin_mst(); // Declare local Variable Flag to Check Status User Exist in databse Flag = objUserLogin.Get_By_UserName(UName, objOrganization.Orgid); // If User Does'nt exist in Database and in aspnet databse then flag value will 0 and FlagMembership value will be False if (Flag == 0 && FlagMembership == false) { // Declare status local variable int status; // Create Object objUserLogin of UserLogin_mst() Class to insert record in table objUserLogin = new UserLogin_mst(); objUserLogin.Username = UName; objUserLogin.Password = Password; objUserLogin.Company = Company; objUserLogin.City = city; objUserLogin.Roleid = Convert.ToInt32(roleid); objUserLogin.Orgid = objOrganization.Orgid; objUserLogin.ADEnable = false; objUserLogin.Enable = true; objUserLogin.Createdatetime = DateTime.Now.ToString(); // Call Insert function to insert record in UserLogin_mst table // Check status whether Record inserted Successfully or Not,If status=1 then Success otherwise Operation Fail status = objUserLogin.Insert(); if (status == 1) { // Declare local variable varEmail to fetch email of user from textbox string varEmail; //If Email field is Not Empty then Assign value to varEmail Local Variable if (UserEmailId != "") { varEmail = UserEmailId.Trim(); } // Else Assign value define in MessagesResources.resx file in errMemshipCreateUserEmail field else { varEmail = Resources.MessageResource.errMemshipCreateUserEmail.ToString(); } // Assign selected text from droprole down to local variable field varRoleName varRoleName = RoleName.Trim(); // Create Mstatus field to send in Membership.CreateUser function as Out Variable for creating Membership User database MembershipCreateStatus Mstatus = default(MembershipCreateStatus); // Call Membership.CreateUser function to create Membership user Membership.CreateUser(UName.Trim(), Password.Trim(), varEmail, "Project Name", "Helpdesk", true, out Mstatus); // Call Roles.AddUserToRole Function to Add User To Role Roles.AddUserToRole(UName.Trim(), varRoleName); // Declare Local Variable Userid to fetch userid of newly created user int userid; // Create Object objUserLogin of UserLogin_mst()Class objUserLogin = new UserLogin_mst(); // Fetch userid of Newly created user and assign to local variable userid by calling function objUserLogin.Get_By_UserName userid = objUserLogin.Get_By_UserName(UName.Trim(), objOrganization.Orgid); // If userid not equal to 0 then we get userid of Newly created user otherwise error Occured UserToSiteMapping objusertositemapping = new UserToSiteMapping(); if (userid != 0) { // Create Object objContactInfo of ContactInfo_mst class to Store User Contact Information in Contact_info table ContactInfo_mst objContactInfo = new ContactInfo_mst(); objContactInfo.Userid = userid; objContactInfo.Firstname = UName.Trim(); objContactInfo.Lastname = UName.Trim(); objContactInfo.Description = Description; objContactInfo.Empid = EmployeeId; objContactInfo.Emailid = UserEmailId; objContactInfo.Landline = LandLineNo; objContactInfo.Mobile = MobileNo; objContactInfo.Siteid = Convert.ToInt32(Location); //if (DrpDepartment.SelectedItem.ToString() != null) //{ objContactInfo.Deptid = Convert.ToInt32(DepartmentId); //} // Call objContactInfo.Insert function to Insert record in Contact_info table objContactInfo.Insert(); // Show Message Operation perform successfully //lblMessage.Text = Resources.MessageResource.errDataSave.ToString(); // Calling Function Clear() to Clear all controls on Form objusertositemapping.Userid = userid; objusertositemapping.Siteid = Convert.ToInt32(Location); objusertositemapping.Insert(); return "Created"; } else { return "Error"; } } else { return "Error"; } } else { return "Already Exist"; } }