public DataSet GetSelectedProjectDetailsFromProjectID(clsReportIssue objclsReportIssue) { try { SqlParameter[] sqlParams = new SqlParameter[1]; sqlParams[0] = new SqlParameter("@ProjectID", SqlDbType.Int, 6); sqlParams[0].Value = objclsReportIssue.ProjectNameId; sqlParams[0].Direction = ParameterDirection.Input; //string connectionString="database=WSEMDemo_prod;Server=v2toolsdemo\\MSSQL2008;Integrated Security=false;User Id=test;password=test"; string connectionString = ConfigurationSettings.AppSettings["sql_Helpdesk_connection"].ToString(); DataSet dsGetData = SqlHelper.ExecuteDataset(connectionString, CommandType.StoredProcedure, "GetPMSProjectDetails_SP", sqlParams); return(dsGetData); } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "clsDLReportIssue.cs", "getCategorySummary", ex.StackTrace); throw new V2Exceptions(ex.ToString(), ex); } }
public string GetCategoryName(clsReportIssue objclsReportIssue) { try { clsBLReportIssue objClsBLReportIssue = new clsBLReportIssue(); return(objClsBLReportIssue.GetCategoryName(objclsReportIssue)); } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "ReportIssue.aspx", "GetCategoryName", ex.StackTrace); throw new V2Exceptions(); } }
public DataSet GetProjectDates(clsReportIssue objClsReportIssue) { try { clsDLReportIssue objClsDLReportIssue = new clsDLReportIssue(); return(objClsDLReportIssue.GetSelectedProjectDetailsFromProjectID(objClsReportIssue)); } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "clsBLReportIssue.cs", "getCategorySummary", ex.StackTrace); throw new V2Exceptions(ex.ToString(), ex); } }
public DataSet InsertFile(clsReportIssue objClsReportIssue) { try { clsDLReportIssue objClsDLReportIssue = new clsDLReportIssue(); return(objClsDLReportIssue.InsertFile(objClsReportIssue)); } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "clsBLReportIssue.cs", "InsertIssueDetails", ex.StackTrace); throw new V2Exceptions(ex.ToString(), ex); } }
public string GetAssignedToEmailID(clsReportIssue objclsReportIssue) { try { clsDLReportIssue objClsDLReportIssue = new clsDLReportIssue(); return(objClsDLReportIssue.GetAssignedToEmailID(objclsReportIssue)); } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "clsBLReportIssue.cs", "GetAssignedToEmailID", ex.StackTrace); throw new V2Exceptions(ex.ToString(), ex); } }
public DataSet getCategorySummary(clsReportIssue objClsReportIssue) { try { clsDLReportIssue objClsDLReportIssue = new clsDLReportIssue(); return(objClsDLReportIssue.getCategorySummary(objClsReportIssue)); } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "clsBLReportIssue.cs", "getCategorySummary", ex.StackTrace); throw new V2Exceptions(); } }
public static string getDropdomdata(string stringParam) { DataSet dsGetData = new DataSet(); string val = ""; clsBLReportIssue objClsBLReportIssue = new clsBLReportIssue(); clsReportIssue objClsReportIssue = new clsReportIssue(); var categoryissue = stringParam; objClsReportIssue.SubCategoryID = Convert.ToInt32(categoryissue); dsGetData = objClsBLReportIssue.getCategorySummary(objClsReportIssue); if (dsGetData.Tables[0].Rows.Count > 0) { val = dsGetData.Tables[0].Rows[0]["IssueSummary"].ToString(); } else { val = ""; } return(val); }
public DataSet InsertFile(clsReportIssue objClsReportIssue) { try { SqlParameter[] sqlParams = new SqlParameter[3]; sqlParams[0] = new SqlParameter("@ReportIssueID", SqlDbType.Int, 4); sqlParams[0].Value = objClsReportIssue.ReportIssueID; sqlParams[0].Direction = ParameterDirection.Input; sqlParams[1] = new SqlParameter("@UploadedFileName", SqlDbType.VarChar, 100); sqlParams[2] = new SqlParameter("@UploadedFileExtension", SqlDbType.VarChar, 50); if (objClsReportIssue.UploadedFileName == null && objClsReportIssue.UploadedFileExtension == null) { sqlParams[1].Value = 0; sqlParams[2].Value = 0; } else if (objClsReportIssue.UploadedFileName != "") { sqlParams[1].Value = objClsReportIssue.UploadedFileName; sqlParams[2].Value = objClsReportIssue.UploadedFileExtension; } sqlParams[1].Direction = ParameterDirection.Input; sqlParams[2].Direction = ParameterDirection.Input; DataSet InsertFile; InsertFile = SqlHelper.ExecuteDataset(strConnectionString, CommandType.StoredProcedure, "InsertFile", sqlParams); return(InsertFile); } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "clsDLReportIssue.cs", "InsertFile", ex.StackTrace); throw new V2Exceptions(ex.ToString(), ex); } }
public DataSet GetSelectedProjectDetails(clsReportIssue objclsReportIssue) { try { SqlParameter[] sqlParams = new SqlParameter[1]; sqlParams[0] = new SqlParameter("@ProjectId", SqlDbType.Int, 6); sqlParams[0].Value = objclsReportIssue.SubCategoryID; sqlParams[0].Direction = ParameterDirection.Input; DataSet dsGetData = SqlHelper.ExecuteDataset(strConnectionString, CommandType.StoredProcedure, "sp_GetCategorySummary", sqlParams); return(dsGetData); } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "clsDLReportIssue.cs", "getCategorySummary", ex.StackTrace); throw new V2Exceptions(ex.ToString(), ex); } }
public string GetAssignedToEmailID(clsReportIssue objclsReportIssue) { try { SqlParameter[] sqlParams = new SqlParameter[1]; sqlParams[0] = new SqlParameter("@EmployeeID", SqlDbType.Int, 4); sqlParams[0].Value = objclsReportIssue.EmployeeID; sqlParams[0].Direction = ParameterDirection.Input; string AssignedToEmailID = (SqlHelper.ExecuteScalar(strConnectionString, CommandType.StoredProcedure, "GetAssignedToEmailID", sqlParams)).ToString(); return(AssignedToEmailID); } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "clsDLReportIssue.cs", "GetAssignedToEmailID", ex.StackTrace); throw new V2Exceptions(ex.ToString(), ex); } }
public string GetCategoryName(clsReportIssue objclsReportIssue) { try { SqlParameter[] sqlParams = new SqlParameter[1]; sqlParams[0] = new SqlParameter("@SubCatgoryId", SqlDbType.Int, 4); sqlParams[0].Value = objclsReportIssue.SubCategoryID; sqlParams[0].Direction = ParameterDirection.Input; string Category = (SqlHelper.ExecuteScalar(strConnectionString, CommandType.StoredProcedure, "sp_GetCategoryNames", sqlParams)).ToString(); return(Category); } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "clsDLReportIssue.cs", "GetCategoryName", ex.StackTrace); throw new V2Exceptions(); } }
public DataSet InsertIssueDetails(clsReportIssue objClsReportIssue) { try { SqlParameter[] sqlParams = new SqlParameter[20]; //sqlParams[0] = new SqlParameter("@ReportIssueID", SqlDbType.Int, 4); //sqlParams[0].Value = objClsReportIssue.ReportIssueID; //sqlParams[0].Direction = ParameterDirection.Input; sqlParams[0] = new SqlParameter("@Name", SqlDbType.VarChar, 100); sqlParams[0].Value = objClsReportIssue.Name; sqlParams[0].Direction = ParameterDirection.Input; sqlParams[1] = new SqlParameter("@EmailID", SqlDbType.VarChar, 100); sqlParams[1].Value = objClsReportIssue.EmailID; sqlParams[1].Direction = ParameterDirection.Input; sqlParams[2] = new SqlParameter("@CCEmailID", SqlDbType.VarChar, 100); sqlParams[2].Value = objClsReportIssue.CCEmailID; sqlParams[2].Direction = ParameterDirection.Input; sqlParams[3] = new SqlParameter("@PhoneExtension", SqlDbType.VarChar, 100); sqlParams[3].Value = objClsReportIssue.PhoneExtension; sqlParams[3].Direction = ParameterDirection.Input; sqlParams[4] = new SqlParameter("@SeatingLocation", SqlDbType.VarChar, 100); sqlParams[4].Value = objClsReportIssue.SeatingLocation; sqlParams[4].Direction = ParameterDirection.Input; sqlParams[5] = new SqlParameter("@SubCategoryID", SqlDbType.Int, 4); sqlParams[5].Value = objClsReportIssue.SubCategoryID; sqlParams[5].Direction = ParameterDirection.Input; sqlParams[6] = new SqlParameter("@SeverityID", SqlDbType.Int, 4); sqlParams[6].Value = objClsReportIssue.SeverityID; sqlParams[6].Direction = ParameterDirection.Input; // sqlParams[8] = new SqlParameter("@PriorityID", SqlDbType.Int, 4); // sqlParams[8].Value = objClsReportIssue.PriorityID; // sqlParams[8].Direction = ParameterDirection.Input; sqlParams[7] = new SqlParameter("@UploadedFileName", SqlDbType.VarChar, 100); sqlParams[8] = new SqlParameter("@UploadedFileExtension", SqlDbType.VarChar, 50); if (objClsReportIssue.UploadedFileName == null && objClsReportIssue.UploadedFileExtension == null) { sqlParams[7].Value = 0; sqlParams[8].Value = 0; } else if (objClsReportIssue.UploadedFileName != "") { sqlParams[7].Value = objClsReportIssue.UploadedFileName; sqlParams[8].Value = objClsReportIssue.UploadedFileExtension; } sqlParams[7].Direction = ParameterDirection.Input; sqlParams[8].Direction = ParameterDirection.Input; sqlParams[9] = new SqlParameter("@Description", SqlDbType.VarChar, 1000); sqlParams[9].Value = objClsReportIssue.Description; sqlParams[9].Direction = ParameterDirection.Input; sqlParams[10] = new SqlParameter("@StatusID", SqlDbType.Int, 4); sqlParams[10].Value = objClsReportIssue.StatusID; sqlParams[10].Direction = ParameterDirection.Input; sqlParams[11] = new SqlParameter("@TypeID", SqlDbType.Int, 4); sqlParams[11].Value = objClsReportIssue.Type; sqlParams[11].Direction = ParameterDirection.Input; sqlParams[12] = new SqlParameter("@ProjectNameId", SqlDbType.Int, 8); sqlParams[12].Value = objClsReportIssue.ProjectNameId; sqlParams[12].Direction = ParameterDirection.Input; sqlParams[13] = new SqlParameter("@ProjectRoleId", SqlDbType.Int, 8); sqlParams[13].Value = objClsReportIssue.ProjectRoleId; sqlParams[13].Direction = ParameterDirection.Input; sqlParams[14] = new SqlParameter("@WorkHours", SqlDbType.Int, 8); sqlParams[14].Value = objClsReportIssue.WorkHours; sqlParams[14].Direction = ParameterDirection.Input; sqlParams[15] = new SqlParameter("@FromDate", SqlDbType.DateTime); if (objClsReportIssue.FromDate.ToString() == "") { sqlParams[15].Value = null; } else { sqlParams[15].Value = objClsReportIssue.FromDate; } sqlParams[15].Direction = ParameterDirection.Input; sqlParams[16] = new SqlParameter("@ToDate", SqlDbType.DateTime); if (objClsReportIssue.ToDate.ToString() == "") { sqlParams[16].Value = null; } else { sqlParams[16].Value = objClsReportIssue.ToDate; } sqlParams[16].Direction = ParameterDirection.Input; sqlParams[17] = new SqlParameter("@NumberOfResources", SqlDbType.Int, 8); sqlParams[17].Value = objClsReportIssue.NumberOfResources; sqlParams[17].Direction = ParameterDirection.Input; sqlParams[18] = new SqlParameter("@ResourcePoolId", SqlDbType.Int, 8); sqlParams[18].Value = objClsReportIssue.ResourcePoolId; sqlParams[18].Direction = ParameterDirection.Input; sqlParams[19] = new SqlParameter("@ReportingToId", SqlDbType.Int, 8); sqlParams[19].Value = objClsReportIssue.ReportingToId; sqlParams[19].Direction = ParameterDirection.Input; DataSet IssueSubmitResult; IssueSubmitResult = SqlHelper.ExecuteDataset(strConnectionString, CommandType.StoredProcedure, "sp_InsertIssueDetails", sqlParams); return(IssueSubmitResult); } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "clsDLReportIssue.cs", "InsertIssueDetails", ex.StackTrace); throw new V2Exceptions(ex.ToString(), ex); } }
private void InsertIssueDetails() { try { clsBLReportIssue objClsBLReportIssue = new clsBLReportIssue(); clsReportIssue objClsReportIssue = new clsReportIssue(); IssueStatus objIssueStatus = new IssueStatus(); intIssueID = 0; objClsReportIssue.Name = txtName.Text.ToString(); if (objClsReportIssue.Name == "") { objClsReportIssue.Name = null; } objClsReportIssue.EmailID = txtEmailID.Text.ToString(); objClsReportIssue.CCEmailID = txtCCEmailID.Text.ToString(); objClsReportIssue.PhoneExtension = txtPhoneExtension.Text.ToString(); objClsReportIssue.Type = Convert.ToInt32(ddltype.SelectedItem.Value); objClsReportIssue.SeatingLocation = txtSeatingLocation.Text.ToString(); objClsReportIssue.SubCategoryID = Convert.ToInt32(ddlCategories.Items[ddlCategories.SelectedIndex].Value); objClsReportIssue.SeverityID = Convert.ToInt32(ddlSeverity.SelectedItem.Value); //objClsReportIssue.PriorityID = Convert.ToInt32(ddlPriority.SelectedItem.Value); objClsReportIssue.Description = txtDescription.Value.ToString(); //objClsReportIssue.StatusID = Convert.ToInt32(IssueStatus.New); objClsReportIssue.StatusID = 1; if ((uploadFiles.PostedFile != null) && (uploadFiles.PostedFile.ContentLength > 0)) { fn = System.IO.Path.GetFileNameWithoutExtension(uploadFiles.PostedFile.FileName); fnExt = System.IO.Path.GetExtension(uploadFiles.PostedFile.FileName); objClsReportIssue.UploadedFileName = fn.ToString(); objClsReportIssue.UploadedFileExtension = fnExt.ToString(); } IssueSubmitResult = objClsBLReportIssue.InsertIssueDetails(objClsReportIssue); if (IssueSubmitResult.Tables[0].Rows.Count > 0) { intIssueID = Convert.ToInt32(IssueSubmitResult.Tables[0].Rows[0]["IssueId"].ToString()); lblMessage.Visible = true; lblMessage.CssClass = "success"; lblMessage.Text = "Issue Successfully recorded."; ShouldSendMail = 1; ShouldUploadFile = 1; } else { lblMessage.Visible = true; lblMessage.CssClass = "Error"; lblMessage.Text = "Error occured in saving the Issue ,Please try again"; ShouldSendMail = 0; ShouldUploadFile = 0; } //if (dsIssueIDAndMemberEmailID.Tables[0].Rows.Count > 0) //{ // if (dsIssueIDAndMemberEmailID.Tables[0].Rows[0][0].ToString() == "0") // { // lblMessage.Visible = true; // lblMessage.CssClass = "Error"; // lblMessage.Text = "This Category is not yet assigned to any of the members of HelpDesk."; // ShouldSendMail = 0; // ShouldUploadFile = 0; // } // else // { // lblMessage.Visible = true; // lblMessage.CssClass = "success"; // lblMessage.Text = "Issue Successfully recorded."; // ShouldSendMail = 1; // ShouldUploadFile = 1; // // To get the IssueID and Email ID of the helpdesk member to whom the issue is assigned; and mail is to be sent. // intIssueID = Convert.ToInt32(dsIssueIDAndMemberEmailID.Tables[0].Rows[0]["ReportIssueID"]); // strMemberEmailID = dsIssueIDAndMemberEmailID.Tables[0].Rows[0]["EmployeeEmailID"].ToString(); // strAssignedTo = dsIssueIDAndMemberEmailID.Tables[0].Rows[0]["EmployeeName"].ToString(); // } //} } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "ReportIssue.aspx", "InsertIssueDetails", ex.StackTrace); throw new V2Exceptions(); } }
//private void SendMail() //{ // try // { // //To send mail to the user // clsReportIssue objClsReportIssue = new clsReportIssue(); // objClsReportIssue.SubCategoryID = Convert.ToInt32(ddlCategories.Items[ddlCategories.SelectedIndex].Value); // string Category = GetCategoryName(objClsReportIssue); // SmtpClient SmtpMail = new SmtpClient(ConfigurationSettings.AppSettings["SMTPServerName"].ToString()); // if (Category == "") // { // strDeptEmailID = ConfigurationSettings.AppSettings["IT_Dept_EmailID"].ToString(); // } // else // { // //Category= Category.ToUpper(); // strDeptEmailID = ConfigurationSettings.AppSettings[Category].ToString(); // } // //string strDeptEmailID = ConfigurationSettings.AppSettings["IT_Dept_EmailID"].ToString(); // string strPath = ConfigurationSettings.AppSettings["Mail_Path"].ToString(); // MailMessage sendMailToDept = new MailMessage(); // sendMailToDept.To.Add(new MailAddress(txtEmailID.Text)); // if (txtCCEmailID.Text != "") // { // sendMailToDept.CC.Add(txtCCEmailID.Text); // } // sendMailToDept.From = new MailAddress(strDeptEmailID);//"*****@*****.**"; // //sendMailToDept.From = new MailAddress("*****@*****.**"); // sendMailToDept.Subject = "HelpDesk : IssueRecorded"; // sendMailToDept.Body = "Hi " + Server.HtmlEncode(txtName.Text) + "<br>" + "<br>" + // "Your issue has been recorded successfully with the following contents:" + "<br>" + // "Your Issue ID is " + "<b>" + intIssueID + "</b>" + "<br>" + // //"Assigned To: " + strAssignedTo + "<br>" + // Code written by Mohan on 16/04/07 // "<b>" + "Description: " + "</b>" + Server.HtmlEncode(txtDescription.Value.ToString()) + "."; // ///sendMailToDept.Priority = MailPriority.Normal; // sendMailToDept.IsBodyHtml = true; // if (txtCCEmailID.Text != "") // { // MailMessage sentToTL = new MailMessage(); // sentToTL.To.Add(new MailAddress(txtCCEmailID.Text)); // sentToTL.From = new MailAddress(strDeptEmailID);//"*****@*****.**"; // sentToTL.Subject = "HelpDesk : Issue Recorded"; // sentToTL.Body = "This mail is regarding the issue of:" + "<br>" + // "Name: " + Server.HtmlEncode(txtName.Text) + " sent to HelpDesk." + "<br>" + // "The contents of the issue are as follows:" + "<br>" + // "Problem Severity: " + ddlSeverity.SelectedItem.Text + "<br>" + // //// "Priority:"+ddlPriority.SelectedItem.Text+"<br>"+ // "Description: " + Server.HtmlEncode(txtDescription.Value.ToString()) + "<br>" + // "Issue Id: " + "<b>" + intIssueID + "</b>" + "<br>"; // //// sentToTL.Priority = MailPriority.Normal; // sentToTL.IsBodyHtml = true; // // SmtpMai.SmtpServer = ConfigurationSettings.AppSettings["SMTPServerName"].ToString(); // //Followin Code is Commented by Amit Thakkar on 11/july/2007 // //SmtpMail.Send(sentToTL); // } // //Following is the code to send the mail to employee whom issue has been asigned (AutoAssign) // //MailMessage sentToHelpDeskMember = new MailMessage(); // //sentToHelpDeskMember.To.Add(new MailAddress(strMemberEmailID)); // //if (txtCCEmailID.Text != "") // //{ // // sentToHelpDeskMember.CC.Add(txtCCEmailID.Text); // //} // //sentToHelpDeskMember.From = new MailAddress(txtEmailID.Text); // //sentToHelpDeskMember.Subject = "HelpDesk : New Issue Recorded."; // //sentToHelpDeskMember.Body = "A new issue has been recorded with the following content:" + "<br>" + // // "Name: " + Server.HtmlEncode(txtName.Text) + "<br>" + // // "Phone Extension: " + txtPhoneExtension.Text + "<br>" + // // "Seating Location: " + txtSeatingLocation.Text + "<br>" + // // "ProblemSeverity: " + ddlSeverity.SelectedItem.Text + "<br>" + // // "Issue ID: " + intIssueID; // //sentToHelpDeskMember.IsBodyHtml = true; // //Old Code // //Remove the Test part from the message sent to the Help Desk Member. // // MailMessage sentToHelpDeskMember = new MailMessage(); // // sentToHelpDeskMember.To.Add(new MailAddress(strMemberEmailID)); // // if (txtCCEmailID.Text != "") // // { // // sentToHelpDeskMember.CC.Add(txtCCEmailID.Text); // // } // //// sentToHelpDeskMember.CC.Add(new MailAddress(txtCCEmailID.Text)); // // sentToHelpDeskMember.From = new MailAddress(txtEmailID.Text); // // //sentToHelpDeskMember.From = new MailAddress("*****@*****.**"); // // sentToHelpDeskMember.Subject = "HelpDesk : New Issue Recorded."; // // // sentToHelpDeskMember.Subject = "TEST"; // // // sentToHelpDeskMember.Body = "This is a Test Mail. Please Ignore it."+"<br><br>"+ // // sentToHelpDeskMember.Body = "A new issue has been recorded with the following content:" + "<br>" + // // "Name: " + Server.HtmlEncode(txtName.Text) + "<br>" + // // "Phone Extension: " + txtPhoneExtension.Text + "<br>" + // // "Seating Location: " + txtSeatingLocation.Text + "<br>" + // // "ProblemSeverity: " + ddlSeverity.SelectedItem.Text + "<br>" + // // //// "Priority: "+ddlPriority.SelectedItem.Value+"<br>"+ // // "Description: " + Server.HtmlEncode(txtDescription.Value.ToString()) + "<br>" + // // //"Path: <a href='http://intranet/HelpDesk/admin/AssignTask.aspx?id='"+ intIssueID +">"+intIssueID+"</a> <br>" + // // //"Path: Path "+ intIssueID +""+intIssueID+" <br>" + // // //"Issue id: "+intIssueID; // // //"Issue ID: <a href= '"+Path="'"+ intIssueID +">"+intIssueID; // // "Issue ID: " + intIssueID; // //// sentToHelpDeskMember.Priority = MailPriority.Normal; // SmtpMail.UseDefaultCredentials = false; // // SmtpMail.Credentials = new System.Net.NetworkCredential("v2system", "mail_123"); // SmtpMail.Credentials = new System.Net.NetworkCredential("username", "password"); // //sentToHelpDeskMember.IsBodyHtml = true; // // Make sure you have appropriate replying permissions from your local system // //SmtpMail.SmtpServer = "localhost"; // //SmtpMail.SmtpServer = ConfigurationSettings.AppSettings["SMTPServerName"].ToString(); // //sendMailToDept.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); // //sendMailToDept.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "v2system"); // //sendMailToDept.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "mail_123"); // //sentToHelpDeskMember.Fields.Add("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate", "1"); // //sentToHelpDeskMember.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendusername", "v2system"); // //sentToHelpDeskMember.Fields.Add("http://schemas.microsoft.com/cdo/configuration/sendpassword", "mail_123"); // SmtpMail.Send(sendMailToDept); // //SmtpMail.Send(sentToHelpDeskMember); // // lblMessage.CssClass // resetAll(); // lblMessage.Visible = true; // lblMessage.Text = "An email will be sent to you confirming the recording of the issue."; // //Response.Write("Your Email has been sent sucessfully - Thank You"); // } // catch (V2Exceptions ex) // { // throw; // } // catch (System.Exception ex) // { // FileLog objFileLog = FileLog.GetLogger(); // objFileLog.WriteLine(LogType.Error, ex.Message, "ReportIssue.aspx", "SendMail", ex.StackTrace); // throw new V2Exceptions(); // } //} private void SendMail() { try { //To send mail to the Dept under which issue falls. clsReportIssue objClsReportIssue = new clsReportIssue(); objClsReportIssue.SubCategoryID = Convert.ToInt32(ddlCategories.Items[ddlCategories.SelectedIndex].Value); string subCategoryName = ddlCategories.Items[ddlCategories.SelectedIndex].Text; string severity = ddlSeverity.Items[ddlSeverity.SelectedIndex].Text; string Category = GetCategoryName(objClsReportIssue).TrimStart(' ').TrimEnd(' '); SmtpClient SmtpMail = new SmtpClient(ConfigurationSettings.AppSettings["SMTPServerName"].ToString()); if (Category == "") { strDeptEmailID = ConfigurationSettings.AppSettings["IT_Dept_EmailID"].ToString(); } else { //Category= Category.ToUpper(); strDeptEmailID = ConfigurationSettings.AppSettings[Category].ToString(); string CCCateory = Category + "CC"; strDeptCCEmailID = ConfigurationSettings.AppSettings[CCCateory].ToString(); } //string strDeptEmailID = ConfigurationSettings.AppSettings["IT_Dept_EmailID"].ToString(); string strPath = ConfigurationSettings.AppSettings["Mail_Path"].ToString(); string arrow = "→"; MailMessage sendMailToDept = new MailMessage(); //Loop to seperate email id's of CC peoples if (strDeptCCEmailID.Contains(",")) { string[] CCEmailId = strDeptCCEmailID.Split(','); foreach (string email in CCEmailId) { sendMailToDept.To.Add(new MailAddress(email)); } } //If there is a manager in CC while logging an issue , then in mail CC part there will be user & manager if (txtCCEmailID.Text != "") { string User_ManagerEmail = txtEmailID.Text + "," + txtCCEmailID.Text; if (User_ManagerEmail.Contains(",")) { string[] CCEmailId = User_ManagerEmail.Split(','); foreach (string email in CCEmailId) { sendMailToDept.CC.Add(new MailAddress(email)); } } } //else only user will be there. else { sendMailToDept.CC.Add(new MailAddress(txtEmailID.Text)); } sendMailToDept.From = new MailAddress(txtEmailID.Text); sendMailToDept.Subject = "HelpDesk : Issue " + intIssueID + " under " + Category + " : " + subCategoryName + " has been logged."; sendMailToDept.Body = "Hi, " + "<br>" + "<br>" + "This is to inform you that, a new issue has been logged. " + "<br>" + " Issue details are as follows :" + "<br>" + "<br>" + "<b>" + "Issue ID : " + "</b>" + "<b>" + intIssueID + "</b>" + "<br>" + "<br>" + "<b>" + "Department Name : " + "</b>" + Category + "<br>" + "<br>" + "<b>" + "Category Name : " + "</b>" + subCategoryName + "<br>" + "<br>" + "<b>" + "Issue Severity : " + "</b>" + severity + "<br>" + "<br>" + "<b>" + "Current Status : " + "</b>" + "Open" + "<br>" + "<br>" + "<b>" + "Description : " + "</b>" + Server.HtmlEncode(txtDescription.Value.ToString()) + "." + "<br>" + "<br>" + "Please take the necessary action." + "<br>" + "<br>" + "<br>" + "Regards," + "<br>" + Server.HtmlEncode(txtName.Text.ToString()); sendMailToDept.IsBodyHtml = true; SmtpMail.UseDefaultCredentials = false; SmtpMail.Credentials = new System.Net.NetworkCredential("username", "password"); SmtpMail.Send(sendMailToDept); resetAll(); lblMessage.Visible = true; lblMessage.Text = "An email will be sent to you confirming the recording of the issue."; } catch (V2Exceptions ex) { throw; } catch (System.Exception ex) { lblMailError.Text = ex.Message; FileLog objFileLog = FileLog.GetLogger(); objFileLog.WriteLine(LogType.Error, ex.Message, "ReportIssue.aspx", "SendMail", ex.StackTrace); //throw new V2Exceptions(); } }