protected void SendEmailForRework(int fbmid, int requesterid, int approverid) { int crewfbmidout = 0; BLL_Infra_UserCredentials ojbInfra = new BLL_Infra_UserCredentials(); DataTable dtRequesterDetails = ojbInfra.Get_UserDetails(requesterid); DataTable dtapprovalDetails = ojbInfra.Get_UserDetails(approverid); DataSet ds = BLL_FBM_Report.FBMReportList(Convert.ToInt32(fbmid)); StringBuilder sbEmailbody = new StringBuilder(); string subject = "Rework - FBM Number :" + ds.Tables[0].Rows[0]["FBM_NUMBER"].ToString(); sbEmailbody.Append("Dear "); sbEmailbody.Append(dtRequesterDetails.Rows[0]["First_Name"].ToString() + ","); sbEmailbody.AppendLine("<br><br>"); sbEmailbody.AppendLine("The FBM Number :" + ds.Tables[0].Rows[0]["FBM_NUMBER"].ToString() + " is sending for Rework."); sbEmailbody.AppendLine("<br><br>"); sbEmailbody.AppendLine("<br>"); sbEmailbody.AppendLine("<br>"); sbEmailbody.AppendLine("Best Regards,"); sbEmailbody.AppendLine("<br>"); sbEmailbody.AppendLine(dtapprovalDetails.Rows[0]["User_name"].ToString().ToUpper() + " " + dtapprovalDetails.Rows[0]["Last_Name"].ToString().ToUpper()); sbEmailbody.AppendLine("<br>"); sbEmailbody.AppendLine(dtapprovalDetails.Rows[0]["Designation"].ToString()); sbEmailbody.AppendLine("<br>"); sbEmailbody.AppendLine(Convert.ToString(Session["Company_Address_GL"])); sbEmailbody.AppendLine("<br>"); int val = BLL_FBM_Report.FBMCrewMailSave(Convert.ToInt32(Session["userid"].ToString()), subject, dtRequesterDetails.Rows[0]["MailID"].ToString(), "", sbEmailbody.ToString(), ref crewfbmidout); }
protected void SendEmailToApprovar(int fbmid, int requesterid, int approvarid) { int crewfbmidout = 0; BLL_Infra_UserCredentials ojbInfra = new BLL_Infra_UserCredentials(); DataTable dtapprovalDetails = ojbInfra.Get_UserDetails(approvarid); DataTable dtRequesterDetails = ojbInfra.Get_UserDetails(requesterid); DataSet ds = BLL_FBM_Report.FBMReportList(Convert.ToInt32(fbmid)); StringBuilder sbEmailbody = new StringBuilder(); string subject = "Pending for Approval - FBM Number :" + ds.Tables[0].Rows[0]["FBM_NUMBER"].ToString(); string path = System.Configuration.ConfigurationManager.AppSettings["APP_URL"].ToString() + "/QMS/FBM/FBM_Main_Report_Details.aspx?FBMREQUESTID=" + ds.Tables[0].Rows[0]["ID"].ToString() + "&APPROVARID=" + approvarid + "&REQUESTERID=" + requesterid; sbEmailbody.Append("Dear "); sbEmailbody.Append(dtapprovalDetails.Rows[0]["First_Name"].ToString() + ","); sbEmailbody.AppendLine("<br><br>"); sbEmailbody.AppendLine("FBM Number :" + ds.Tables[0].Rows[0]["FBM_NUMBER"].ToString() + " is Pending for your Approval, Click on below link to approve it."); sbEmailbody.Append("<a href=" + path + ">" + path + "</a>"); sbEmailbody.AppendLine("<br><br>"); sbEmailbody.AppendLine("<br>"); sbEmailbody.AppendLine("<br>"); sbEmailbody.AppendLine("Best Regards,"); sbEmailbody.AppendLine("<br>"); sbEmailbody.AppendLine(dtRequesterDetails.Rows[0]["User_name"].ToString().ToUpper() + " " + dtRequesterDetails.Rows[0]["Last_Name"].ToString().ToUpper()); sbEmailbody.AppendLine("<br>"); sbEmailbody.AppendLine(dtRequesterDetails.Rows[0]["Designation"].ToString()); sbEmailbody.AppendLine(Convert.ToString(Session["Company_Address_GL"])); sbEmailbody.AppendLine("<br>"); int val = BLL_FBM_Report.FBMCrewMailSave(Convert.ToInt32(Session["userid"].ToString()), subject, dtapprovalDetails.Rows[0]["MailID"].ToString(), "", sbEmailbody.ToString(), ref crewfbmidout); }
protected void SendEmail(int fbmid) { string ToMail = ""; int crewfbmidout = 0; if (optForUser.SelectedValue == "COMPANY") //company { ToMail = ConfigurationManager.AppSettings["FBM_TO_COMPANY_EMAIL"].ToString(); } else if (optForUser.SelectedValue == "OFFICE") //office { ToMail = ConfigurationManager.AppSettings["FBM_TO_OFFICE_EMAIL"].ToString(); } else if (optForUser.SelectedValue == "SHIP") // ship email { ToMail = ConfigurationManager.AppSettings["FBM_TO_OFFICE_EMAIL"].ToString(); } // if there is a Attachment is associated with FBM Then Send an Email to IT Department. DataTable dtAttachments = BLL_FBM_Report.FBMAttachmentSearch(fbmid); DataSet ds = BLL_FBM_Report.FBMReportList(Convert.ToInt32(fbmid)); // Check the attachment if (dtAttachments.Rows.Count > 0) { // IF USER TYPE IS SHIP THEN EMAI SHOULD GO TO IT DEPT FOR REDUCING THE FILE. if (ds.Tables[0].Rows[0]["FOR_USER"].ToString().ToUpper() == "SHIP") { StringBuilder sbEmailbody = new StringBuilder(); string subject = "FBM Number :" + ds.Tables[0].Rows[0]["FBM_NUMBER"].ToString(); string path = System.Configuration.ConfigurationManager.AppSettings["APP_URL"].ToString() + @"\uploads\FBM\\"; sbEmailbody.Append("Dear IT,"); sbEmailbody.AppendLine("<br><br>"); sbEmailbody.AppendLine("A FBM has been sent with one or more attachments to it."); sbEmailbody.AppendLine("<br><br>"); sbEmailbody.AppendLine("Arrange to reduce the size of the attachment/s listed below:"); sbEmailbody.AppendLine("<br><br>"); foreach (DataRow dr in dtAttachments.Rows) { sbEmailbody.Append(dr["FILEPATH"].ToString()); sbEmailbody.AppendLine("<br>"); } sbEmailbody.Append("This file is located in folder: <a href=" + path + ">" + path + "</a>"); //sbEmailbody.Append("<a href=" + path + ">" + path + "</a>"); sbEmailbody.AppendLine("<br><br>"); sbEmailbody.AppendLine("Best Regards,"); sbEmailbody.AppendLine("<br>"); sbEmailbody.AppendLine("Jibe AutoMessenger"); if (ds.Tables[0].Rows.Count > 0) { subject = ds.Tables[0].Rows[0]["FBM_NUMBER"].ToString(); } int val = BLL_FBM_Report.FBMCrewMailSave(Convert.ToInt32(Session["userid"].ToString()), subject, ToMail, "", sbEmailbody.ToString(), ref crewfbmidout); } //IF USER TYPE IS COMPANY OR OFFICE THEN NO ACTION AS PER SATVINDER SIR. else { //string filepathSave = @"\\server01\uploads\FBM\"; //int val = BLL_FBM_Report.FBMCrewMailSave(Convert.ToInt32(Session["userid"].ToString()), txtSubject.Text, ToMail, "", txtMailBody.Text, ref crewfbmidout); //foreach (DataRow dr in dtAttachments.Rows) //{ // BLL_FBM_Report.FBMCrewAttachmentSave(Convert.ToInt32(Session["userid"].ToString()), crewfbmidout, dr[2].ToString(), filepathSave + dr[2].ToString()); //} } } }
protected void BindFBMReportsDetails(int fbmid, bool approver) { DataSet ds = BLL_FBM_Report.FBMReportList(fbmid); if (ds.Tables[0].Rows.Count > 0) { DataRow dr = ds.Tables[0].Rows[0]; DDLOfficeDept.SelectedValue = dr["DEPARTMENT"].ToString() != "" ? dr["DEPARTMENT"].ToString() : "0"; DDLPrimaryCategory.SelectedValue = dr["PRIMARY_CATEGORY"].ToString() != "" ? dr["PRIMARY_CATEGORY"].ToString() : "0"; DDLPrimaryCategory_SelectedIndexChanged(null, null); DDLSecondryCategory.SelectedValue = dr["SECONDRY_CATEGORY"].ToString(); optForUser.SelectedValue = dr["FOR_USER"].ToString(); optPriority.SelectedValue = dr["URGENT"].ToString(); txtSubject.Text = dr["SUBJECT"].ToString(); txtMailBody.Text = dr["BODY"].ToString(); //txtMailBody.Text = dr["BODY"].ToString(); txtFBMNumber.Text = dr["FBM_NUMBER"].ToString(); txtDateSent.Text = dr["DATE_SENT"].ToString(); ViewState["FBM_NUMBER"] = dr["FBM_NUMBER"].ToString(); ViewState["DATE_SENT"] = dr["DATE_SENT"].ToString(); ViewState["ACTIVE"] = dr["ACTIVE"].ToString(); ViewState["FBM_STATUS"] = dr["FBM_STATUS"].ToString(); ViewState["APPROVED_BY"] = dr["APPROVED_BY"].ToString(); ViewState["APPROVED_ON"] = dr["APPROVED_ON"].ToString(); ViewState["MADE_INACTIVE_ON"] = dr["MADE_INACTIVE_ON"].ToString(); ViewState["FBM_CREATED_BY"] = dr["CREATED_BY"].ToString(); if (ViewState["ACTIVE"].ToString() == "N") { btnInActive.Text = "Make Active"; } if (ViewState["FBM_STATUS"].ToString() == "SENT") { btnInActive.Enabled = true; btnDraft.Enabled = false; btnSent.Enabled = false; btnApproved.Enabled = false; btnRework.Enabled = false; ImgTempFBMAttDelete.Enabled = false; DDLPrimaryCategory.Enabled = false; DDLSecondryCategory.Enabled = false; optForUser.Enabled = false; optPriority.Enabled = false; txtSubject.ReadOnly = true; txtMailBody.ReadOnly = true; lstfbmAttachment.Enabled = false; } if (ViewState["FBM_STATUS"].ToString() == "PENDINGAPPROVAL") { if (ViewState["APPROVED_BY"].ToString().Trim() == Session["userid"].ToString().Trim()) { btnApproved.Enabled = true; btnRework.Enabled = true; } else { btnApproved.Enabled = false; btnRework.Enabled = false; } btnSent.Enabled = false; btnDraft.Enabled = false; ImgTempFBMAttDelete.Enabled = false; DDLPrimaryCategory.Enabled = false; DDLSecondryCategory.Enabled = false; optForUser.Enabled = false; optPriority.Enabled = false; txtSubject.ReadOnly = true; txtMailBody.ReadOnly = true; lstfbmAttachment.Enabled = false; } if (ViewState["FBM_STATUS"].ToString() == "DRAFT") { btnDraft.Enabled = true; btnSent.Enabled = true; btnApproved.Enabled = false; btnRework.Enabled = false; } if (ViewState["FBM_STATUS"].ToString() == "REWORK") { btnDraft.Enabled = true; btnSent.Enabled = true; btnApproved.Enabled = false; btnRework.Enabled = false; } } if (approver) { if (ViewState["FBM_STATUS"].ToString() == "PENDINGAPPROVAL") { btnDraft.Enabled = false; btnSent.Enabled = false; btnApproved.Enabled = true; btnRework.Enabled = true; btnSent.Enabled = false; btnDraft.Enabled = false; ImgTempFBMAttDelete.Enabled = false; DDLPrimaryCategory.Enabled = false; DDLSecondryCategory.Enabled = false; optForUser.Enabled = false; optPriority.Enabled = false; txtSubject.ReadOnly = true; txtMailBody.ReadOnly = true; lstfbmAttachment.Enabled = false; } } }