protected void ImgFBMAttDelete_Click(object sender, CommandEventArgs e) { string[] cmdargs = e.CommandArgument.ToString().Split(','); string fileid = cmdargs[0].ToString(); string fileName = cmdargs[1].ToString(); string filepath = "../../uploads/fbm/" + fileName; int retval = BLL_FBM_Report.FBMAttachmentDelete(Convert.ToInt32(Session["userid"].ToString()), Convert.ToInt32(fileid)); if (File.Exists(Server.MapPath(filepath))) { File.Delete(Server.MapPath(filepath)); } if (Request.QueryString["FBMID"] != null) { BindFBMAttachment(Convert.ToInt32(Request.QueryString["FBMID"].ToString())); } if (Request.QueryString["FBMREQUESTID"] != null) { BindFBMAttachment(Convert.ToInt32(Request.QueryString["FBMID"].ToString())); } }
public void BindFBMAccessRight() { try { int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = BLL_FBM_Report.FBM_Get_RankList_Search(txtSearchBy.Text, UDFLib.ConvertIntegerToNull(ddlRank.SelectedValue), UDFLib.ConvertIntegerToNull(ddlRankCategory.SelectedValue) , sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } gvFBMAcessRight.DataSource = dt; gvFBMAcessRight.DataBind(); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void BindFBMAttachment(int fbmid) { DataTable dt = BLL_FBM_Report.FBMAttachmentSearch(fbmid); gvFBMAtt.DataSource = dt; gvFBMAtt.DataBind(); }
public void GetCountFBMOnCurrenUserDepartment() { /* On launching the FBM Module, if current user's having the FBM in draft then only Draft option would select * Otherwise Sent option will select automatically. */ int?deptid = null; if (ViewState["DeptID"] != null) { deptid = Convert.ToInt32(ViewState["DeptID"].ToString()); } DataTable dt = BLL_FBM_Report.GetCountFBMOnCurrenUserDepartment(deptid); if (ViewState["USERTYPE"].ToString().ToUpper() == "ADMIN") { optMsgType.SelectedValue = "PENDINGAPPROVAL"; DDLOfficeDept.SelectedValue = ViewState["DeptID"].ToString(); } else { if (dt.Rows.Count > 0) { optMsgType.SelectedValue = "DRAFT"; DDLOfficeDept.SelectedValue = ViewState["DeptID"].ToString(); } else { optMsgType.SelectedValue = "SENT"; DDLOfficeDept.SelectedValue = "0"; ViewState["DeptID"] = "0"; } } }
protected void SaveFBMAttachment(int fbmid, bool SyncAttachment) { string sourchfilepath = ""; string destinationpath = ""; DataTable dt = new DataTable(); if (Request.QueryString["FBMID"] != null) { dt = BLL_FBM_Report.FBMAttachmentSearch(Convert.ToInt32(Request.QueryString["FBMID"].ToString())); } DataTable vdtFile = (DataTable)ViewState["vdtFile"]; foreach (DataRow dr in vdtFile.Rows) { sourchfilepath = Server.MapPath(@"~/QMS\\TempUpload\\"); sourchfilepath += dr["FileGuid"].ToString() + dr["FileExtn"].ToString(); destinationpath = Server.MapPath(@"~/Uploads\\FBM\\"); destinationpath += dr["FileGuid"].ToString() + dr["FileExtn"].ToString(); BLL_FBM_Report.FBMAttachmentSave(Convert.ToInt32(Session["userid"].ToString()), fbmid, dr["FileName"].ToString(), dr["FileGuid"].ToString() + dr["FileExtn"].ToString()); if (!File.Exists(destinationpath)) { File.Copy(sourchfilepath, destinationpath); } } }
public void FillDDLOfficeDept() { try { int?companyid = null; if ((Session["USERCOMPANYID"].ToString() != "") || (Session["USERCOMPANYID"] == null)) { companyid = Convert.ToInt32(Session["USERCOMPANYID"].ToString()); } DataTable dtOfficeDept = BLL_FBM_Report.GetOfficeDepartment(companyid); DDLOfficeDept.Items.Clear(); DDLOfficeDept.DataSource = dtOfficeDept; DDLOfficeDept.DataTextField = "VALUE"; DDLOfficeDept.DataValueField = "ID"; DDLOfficeDept.DataBind(); ListItem li = new ListItem("--SELECT ALL--", "0"); DDLOfficeDept.Items.Insert(0, li); FillDDLPrimaryCategory(); } catch (Exception ex) { } }
public void BindFbmReadSearch() { int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataSet ds = BLL_FBM_Report.FBMReadReportSearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue) , UDFLib.ConvertIntegerToNull(ddlFbmList.SelectedValue), txtSearchBy.Text.Trim() , UDFLib.ConvertIntegerToNull(ddlRank.SelectedValue), UDFLib.ConvertIntegerToNull(rdoFBMReadStatus.SelectedValue) , sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (ds.Tables[0].Rows.Count > 0) { gvFbmRead.DataSource = ds.Tables[0]; gvFbmRead.DataBind(); } else { gvFbmRead.DataSource = ds.Tables[0]; gvFbmRead.DataBind(); } }
protected void onDelete(object source, CommandEventArgs e) { int retval = BLL_FBM_Report.FBM_READ_ACCESS_RIGHT_REMOVE(Convert.ToInt32(e.CommandArgument.ToString()), Convert.ToInt32(Session["USERID"].ToString())); BindFBMAccessRight(); UpdPnlGrid.Update(); }
protected void DDLPrimaryCategory_SelectedIndexChanged(object sender, EventArgs e) { DataTable dtSecondryCategory = BLL_FBM_Report.FBMGetSystemParameterList(DDLPrimaryCategory.SelectedValue.ToString(), "", null); DDLSecondryCategory.Items.Clear(); DDLSecondryCategory.DataSource = dtSecondryCategory; DDLSecondryCategory.DataTextField = "NAME"; DDLSecondryCategory.DataValueField = "CODE"; DDLSecondryCategory.DataBind(); ListItem li = new ListItem("--SELECT ALL--", "0"); DDLSecondryCategory.Items.Insert(0, li); }
public void BindFBMReport() { int rowcount = ucCustomPagerItems.isCountRecord; string deptid = (ViewState["DeptID"] == null || ViewState["DeptID"].ToString() == "0") ? null : (ViewState["DeptID"].ToString()); string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataSet ds = BLL_FBM_Report.FBMMessageSearch(UDFLib.ConvertIntegerToNull(Session["userid"].ToString()), null , UDFLib.ConvertIntegerToNull(deptid), optForUser.SelectedValue.ToString().Trim() , Convert.ToInt32(optMsgStatus.SelectedValue.ToString()) , UDFLib.ConvertIntegerToNull(DDLPrimaryCategory.SelectedValue), UDFLib.ConvertIntegerToNull(DDLSecondryCategory.SelectedValue) , UDFLib.ConvertStringToNull(ddlYear.SelectedValue), UDFLib.ConvertDateToNull(txtFromDate.Text) , UDFLib.ConvertDateToNull(txtToDate.Text), txtSearch.Text, ViewState["ISDEPTSARCHONSENT"].ToString(), optMsgType.SelectedValue.ToString() , sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount); if (ucCustomPagerItems.isCountRecord == 1) { ucCustomPagerItems.CountTotalRec = rowcount.ToString(); ucCustomPagerItems.BuildPager(); } if (ds.Tables[0].Rows.Count > 0) { gvFBMReport.DataSource = ds.Tables[0]; gvFBMReport.DataBind(); if (ViewState["ID"] == null) { ViewState["ID"] = ds.Tables[0].Rows[0]["ID"].ToString(); //gvFBMReport.SelectedIndex = 0; } // SetRowSelection(); } else { gvFBMReport.DataSource = ds.Tables[0]; gvFBMReport.DataBind(); } }
public void BindFBMDLL() { try { DataTable dtFbmList = BLL_FBM_Report.GetFBMList(); ddlFbmList.DataTextField = "FBM_NUMBER"; ddlFbmList.DataValueField = "ID"; ddlFbmList.DataSource = dtFbmList; ddlFbmList.DataBind(); ddlFbmList.Items.Insert(0, new ListItem("-SELECT-", "0")); } catch { } }
public void FillDDLYear() { try { DataTable dtyears = BLL_FBM_Report.GetFBMYears(); ddlYear.Items.Clear(); ddlYear.DataSource = dtyears; ddlYear.DataTextField = "DATE_SENT"; ddlYear.DataValueField = "DATE_SENT"; ddlYear.DataBind(); ListItem li = new ListItem("--SELECT ALL--", "0"); ddlYear.Items.Insert(0, li); } catch (Exception ex) { } }
protected void btnExport_Click(object sender, ImageClickEventArgs e) { int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataSet ds = BLL_FBM_Report.FBMReadReportSearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue) , UDFLib.ConvertIntegerToNull(ddlFbmList.SelectedValue), txtSearchBy.Text.Trim() , UDFLib.ConvertIntegerToNull(ddlRank.SelectedValue), UDFLib.ConvertIntegerToNull(rdoFBMReadStatus.SelectedValue) , sortbycoloumn, sortdirection, null, null, ref rowcount); string[] HeaderCaptions = { "Vessel", "Rank", "Staff Code", "Name", "FBM Read On" }; string[] DataColumnsName = { "Vessel_Name", "Rank_Short_Name", "Staff_Code", "Staff_FullName", "FBM_DATE_READ" }; GridViewExportUtil.ShowExcel(ds.Tables[0], HeaderCaptions, DataColumnsName, "FBM Read Report", "FBM Read Report"); }
protected void gvFBMAtt_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName.ToUpper().Equals("DELETE")) { GridView _gridView = (GridView)sender; int nCurrentRow = Int32.Parse(e.CommandArgument.ToString()); string fbmattid = ((Label)gvFBMAtt.Rows[nCurrentRow].FindControl("lblFileId")).Text; if (fbmattid.ToString() == "") { DataTable dt = (DataTable)ViewState["TempDtLocation"]; dt.Rows[nCurrentRow].Delete(); dt.AcceptChanges(); } else { int retval = BLL_FBM_Report.FBMAttachmentDelete(Convert.ToInt32(Session["userid"].ToString()), Convert.ToInt32(fbmattid)); } } }
protected void btnApproved_Click(object sender, EventArgs e) { if (Request.QueryString["FBMREQUESTID"] == null) { int retval = BLL_FBM_Report.FBMMessageApproved(Convert.ToInt32(Request.QueryString["FBMID"].ToString()), Convert.ToInt32(Session["userid"].ToString()), "SENT"); SendEmail(Convert.ToInt32(Request.QueryString["FBMID"].ToString())); String script = String.Format("alert('FBM has been approved.');window.opener.location.reload(true);window.close();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", script, true); } else { int retval = BLL_FBM_Report.FBMMessageApproved(Convert.ToInt32(Request.QueryString["FBMREQUESTID"].ToString()), Convert.ToInt32(Request.QueryString["APPROVARID"].ToString()), "SENT"); SendEmail(Convert.ToInt32(Request.QueryString["FBMREQUESTID"].ToString())); String script = String.Format("alert('FBM has been approved.');window.close();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", script, true); } }
protected void chkAccess_CheckedChanged(object sender, EventArgs e) { try { CheckBox chkAccess = (sender as CheckBox); GridViewRow row = chkAccess.NamingContainer as GridViewRow; int retVal = BLL_FBM_Report.FBM_READ_ACCESS_RIGHT_SAVE(UDFLib.ConvertIntegerToNull(((Label)row.FindControl("lblID")).Text) , UDFLib.ConvertIntegerToNull(((Label)row.FindControl("lblRankID")).Text) , Convert.ToInt32(Session["USERID"]) , ((CheckBox)row.FindControl("chkAccess")).Checked == true ? 1 : 0); BindFBMAccessRight(); UpdPnlGrid.Update(); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
protected void btnDraft_Click(object sender, EventArgs e) { try { if (txtMailBody.Text.Trim() != "") { int fbmidout = 0; int?fbmid = null; if (Request.QueryString["FBMID"] != null) { fbmid = Convert.ToInt32(Request.QueryString["FBMID"].ToString()); } int retval = BLL_FBM_Report.FBMMessageSave(fbmid, Convert.ToInt32(Session["userid"].ToString()), txtSubject.Text , UDFLib.ConvertIntegerToNull(DDLOfficeDept.SelectedValue), optForUser.SelectedValue.ToString().Trim() , txtMailBody.Text, 0, 1, UDFLib.ConvertIntegerToNull(DDLPrimaryCategory.SelectedValue) , UDFLib.ConvertIntegerToNull(DDLSecondryCategory.SelectedValue) , Convert.ToInt32(optPriority.SelectedValue), "DRAFT", ref fbmidout); SaveFBMAttachment(fbmidout, false); if (Request.QueryString["FBMID"] != null) { BindFBMAttachment(Convert.ToInt32(Request.QueryString["FBMID"].ToString())); } String script = String.Format("alert('FBM has been Save as Draft.');window.opener.location.reload(true);window.close();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", script, true); } else { String script = String.Format("alert('e-Mail Body is required.')"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "bodymsgdraft", script, true); } } catch (Exception ex) { } }
protected void btnInActive_Click(object sender, EventArgs e) { int?fbmid = null; if (Request.QueryString["FBMREQUESTID"] != null) { fbmid = Convert.ToInt32(Request.QueryString["FBMREQUESTID"].ToString()); } else if (Request.QueryString["FBMID"] != null) { fbmid = Convert.ToInt32(Request.QueryString["FBMID"].ToString()); } int retval = BLL_FBM_Report.FBMMessageInActive(Convert.ToInt32(Session["userid"].ToString()), fbmid); //String script = String.Format("alert('FBM has been InActiveted.');window.opener.location.reload(true);window.close();"); //ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", script, true); String script = String.Format("window.opener.location.reload(true);window.close();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msgdfd", script, true); }
protected void btnDivSendApproval_click(object sender, EventArgs e) { try { int fbmidout = 0; int?fbmid = null; if (Request.QueryString["FBMID"] != null) { fbmid = Convert.ToInt32(Request.QueryString["FBMID"].ToString()); } int requesterid = 0; if (Request.QueryString["UserID"] != null) { requesterid = Convert.ToInt32(Request.QueryString["UserID"].ToString()); } else { requesterid = Convert.ToInt32(Session["userid"].ToString()); } int retval = BLL_FBM_Report.FBMMessageSent(fbmid, Convert.ToInt32(Session["userid"].ToString()), txtSubject.Text , UDFLib.ConvertIntegerToNull(DDLOfficeDept.SelectedValue), optForUser.SelectedValue.ToString().Trim() , txtMailBody.Text, 1, 1, UDFLib.ConvertIntegerToNull(DDLPrimaryCategory.SelectedValue) , UDFLib.ConvertIntegerToNull(DDLSecondryCategory.SelectedValue) , Convert.ToInt32(optPriority.SelectedValue), "PENDINGAPPROVAL", Convert.ToInt32(ddlFbmApprover.SelectedValue), ref fbmidout); SaveFBMAttachment(fbmidout, true); SendEmailToApprovar(fbmidout, requesterid, Convert.ToInt32(ddlFbmApprover.SelectedValue)); String script = String.Format("alert('FBM has been sent to for approval.');window.opener.location.reload(true);window.close();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", script, true); } catch (Exception ex) { } }
public void FillDDLPrimaryCategory() { try { int?deptid = null; if (DDLOfficeDept.SelectedValue != "0") { deptid = Convert.ToInt32(DDLOfficeDept.SelectedValue); } DataTable dtPrimaryCategory = BLL_FBM_Report.FBMGetSystemParameterList("1", "", deptid); DDLPrimaryCategory.Items.Clear(); DDLPrimaryCategory.DataSource = dtPrimaryCategory; DDLPrimaryCategory.DataTextField = "NAME"; DDLPrimaryCategory.DataValueField = "CODE"; DDLPrimaryCategory.DataBind(); ListItem li = new ListItem("--SELECT ALL--", "0"); DDLPrimaryCategory.Items.Insert(0, li); } catch (Exception ex) { } }
protected void btnRework_Click(object sender, EventArgs e) { if (Request.QueryString["FBMREQUESTID"] == null) { int retval = BLL_FBM_Report.FBMMessageRework(Convert.ToInt32(Request.QueryString["FBMID"].ToString()), "REWORK"); SendEmailForRework(Convert.ToInt32(Request.QueryString["FBMID"].ToString()), Convert.ToInt32(ViewState["FBM_CREATED_BY"].ToString()) , Convert.ToInt32(Session["userid"].ToString())); String script = String.Format("alert('FBM has been send for Rework.');window.opener.location.reload(true);window.close();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", script, true); } else { int retval = BLL_FBM_Report.FBMMessageRework(Convert.ToInt32(Request.QueryString["FBMREQUESTID"].ToString()), "REWORK"); SendEmailForRework(Convert.ToInt32(Request.QueryString["FBMREQUESTID"].ToString()), Convert.ToInt32(Request.QueryString["REQUESTERID"].ToString()) , Convert.ToInt32(Request.QueryString["APPROVARID"].ToString())); String script = String.Format("alert('FBM has been send for Rework.');window.close();"); ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", script, true); } }
public void FillDLLFBMApprovalList() { DataTable dtfbmuserapproval = new DataTable(); if (Request.QueryString["APPROVARID"] != null) { dtfbmuserapproval = BLL_FBM_Report.GetFBMUserApprovalList(Convert.ToInt32(Request.QueryString["APPROVARID"].ToString())); } else { dtfbmuserapproval = BLL_FBM_Report.GetFBMUserApprovalList(Convert.ToInt32(Session["userid"].ToString())); } ddlFbmApprover.Items.Clear(); ddlFbmApprover.DataSource = dtfbmuserapproval; ddlFbmApprover.DataTextField = "ApprovalName"; ddlFbmApprover.DataValueField = "UserID"; ddlFbmApprover.DataBind(); ListItem li = new ListItem("-- SELECT --", "0"); ddlFbmApprover.Items.Insert(0, li); }
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 btnExport_Click(object sender, ImageClickEventArgs e) { try { int rowcount = ucCustomPagerItems.isCountRecord; string sortbycoloumn = (ViewState["SORTBYCOLOUMN"] == null) ? null : (ViewState["SORTBYCOLOUMN"].ToString()); int? sortdirection = null; if (ViewState["SORTDIRECTION"] != null) { sortdirection = Int32.Parse(ViewState["SORTDIRECTION"].ToString()); } DataTable dt = BLL_FBM_Report.FBM_Get_RankList_Search(txtSearchBy.Text, UDFLib.ConvertIntegerToNull(ddlRank.SelectedValue), UDFLib.ConvertIntegerToNull(ddlRankCategory.SelectedValue) , sortbycoloumn, sortdirection, null, null, ref rowcount); string[] HeaderCaptions = { "Rank Name", "Rank Short Name", "Read Access" }; string[] DataColumnsName = { "Rank_Name", "Rank_Short_Name", "READ_ACCESS_FLAG" }; GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "FBMReadAccess", "FBM Read Access"); } catch (Exception ex) { UDFLib.WriteExceptionLog(ex); } }
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; } } }