Exemplo n.º 1
0
    public void BindGrid()
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        string vesselcode = (ViewState["VesselCode"] == null) ? null : (ViewState["VesselCode"].ToString());

        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_Infra_Common.Get_Exception_Search(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(ddlvessel.SelectedValue)
                                                             , UDFLib.ConvertDateToNull(txtfrom.Text), UDFLib.ConvertDateToNull(txtto.Text), txtSearch.Text
                                                             , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);

        if (ucCustomPagerItems.isCountRecord == 1)
        {
            ucCustomPagerItems.CountTotalRec = rowcount.ToString();
            ucCustomPagerItems.BuildPager();
        }

        if (dt.Rows.Count > 0)
        {
            gvDeckLogBook.DataSource = dt;
            gvDeckLogBook.DataBind();
        }
        else
        {
            gvDeckLogBook.DataSource = dt;
            gvDeckLogBook.DataBind();
        }
    }
Exemplo n.º 2
0
    protected void GeneratePOAsPDF(DataTable dt, string FileName, int EmailID)
    {
        string repFilePath = Server.MapPath("TRVPOReport.rpt");

        ReportDocument repDoc = new ReportDocument();

        repDoc.Load(repFilePath);

        repDoc.SetDataSource(dt);


        ExportOptions exp             = new ExportOptions();
        DiskFileDestinationOptions dk = new DiskFileDestinationOptions();
        PdfRtfWordFormatOptions    pd = new PdfRtfWordFormatOptions();

        string destFile = Server.MapPath("../Uploads/Travel") + "\\" + FileName;

        dk.DiskFileName = destFile;

        //string Network_Path = System.Configuration.ConfigurationManager.AppSettings["APP_URL"].ToString()+@"Uploads\Travel\";
        string Network_Path = @"Uploads\Travel\";

        exp.ExportDestinationType = ExportDestinationType.DiskFile;
        exp.ExportFormatType      = ExportFormatType.PortableDocFormat;
        exp.DestinationOptions    = dk;
        exp.FormatOptions         = pd;
        repDoc.Export(exp);

        BLL_Infra_Common.Insert_EmailAttachedFile(EmailID, FileName, Network_Path + FileName);
    }
Exemplo n.º 3
0
    public void BindGrid()
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        string vesselcode = (ViewState["VesselCode"] == null) ? null : (ViewState["VesselCode"].ToString());

        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_Infra_Common.SearchDMN_UpdatesErrors(UDFLib.ConvertIntegerToNull(ddlvessel.SelectedValue), sortbycoloumn, sortdirection, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);

        if (ucCustomPagerItems.isCountRecord == 1)
        {
            ucCustomPagerItems.CountTotalRec = rowcount.ToString();
            ucCustomPagerItems.BuildPager();
        }

        if (dt.Rows.Count > 0)
        {
            gvDmErrorList.DataSource = dt;
            gvDmErrorList.DataBind();
        }
        else
        {
            gvDmErrorList.DataSource = dt;
            gvDmErrorList.DataBind();
        }
    }
Exemplo n.º 4
0
    protected void imgbtnDelete_Click(object s, EventArgs e)
    {
        string ID  = ((ImageButton)s).CommandArgument.Split(',')[0];
        int    res = BLL_Infra_Common.Delete_EmailAttachedFile_DL(Convert.ToInt32(ID));

        if (res > 0)
        {
            string path = Server.MapPath("~") + @"\" + ((ImageButton)s).CommandArgument.Split(',')[1];
            //File.Delete(((ImageButton)s).CommandArgument.Split(',')[1]);
            File.Delete(path);
        }
        LoadFiles(null, null);
    }
Exemplo n.º 5
0
 public void LoadFiles(object s, EventArgs e)
 {
     try
     {
         dlstAttachment.DataSource = BLL_Infra_Common.Get_EmailAttachedFile(Convert.ToInt32(getQueryString("ID")));
         dlstAttachment.DataBind();
         if (IsPostBack)
         {
             ucEmailAttachment1.Register_JS_Attach();
         }
     }
     catch { }
 }
    protected void lstUserList_SelectedIndexChanged(object sender, EventArgs e)
    {
        int       UserCompanyID = UDFLib.ConvertToInteger(Session["USERCOMPANYID"].ToString());
        DataTable dtvsl         = BLL_Infra_Common.Get_User_Vessel_Assignment(Convert.ToInt32(lstUserList.SelectedValue), ddlFleet.SelectedIndex == 0 ? null : UDFLib.ConvertIntegerToNull(ddlFleet.SelectedValue), UserCompanyID);

        lstVessel.DataSource = dtvsl;
        lstVessel.DataBind();
        // lstVessel.Items.Insert(0, new ListItem("-SELECT-", "-1"));
        lstVessel.ClearSelection();
        chkSelectAll.Checked = false;
        foreach (DataRow dr in dtvsl.Rows)
        {
            ListItem li = lstVessel.Items.FindByValue(dr["ASSIGNED"].ToString());
            if (li != null)
            {
                li.Selected = true;
            }
        }
    }
    /// <summary>
    /// Added by Anjali DT:20-06-2016 JIT:9496
    /// To assign one or more vessel to selected user.
    /// </summary>
    private void AssignVesseltoUser()
    {
        try
        {
            if (ValidateControls())
            {
                int       UserCompanyID    = UDFLib.ConvertToInteger(Session["USERCOMPANYID"].ToString());
                DataTable dtvslAllSelected = BLL_Infra_Common.Get_User_Vessel_Assignment(Convert.ToInt32(lstUserList.SelectedValue), null, UserCompanyID);

                if (dtvslAllSelected != null)
                {
                    if (dtvslAllSelected.Rows.Count > 0)
                    {
                        if (ddlFleet.SelectedIndex > 0)
                        {
                            foreach (DataRow item in dtvslAllSelected.Rows)
                            {
                                if (item["FleetCode"].ToString() != ddlFleet.SelectedValue && item["ASSIGNED"].ToString() != "-1")
                                {
                                    DataRow dr = dtvsl.NewRow();
                                    dr["ID"] = item["Vessel_ID"].ToString();
                                    dtvsl.Rows.Add(dr);
                                }
                            }
                        }

                        BLL_Infra_Common.Upd_User_Vessel_Assignment(Convert.ToInt32(lstUserList.SelectedValue), dtvsl, Convert.ToInt32(Session["USERID"]));
                        string js1 = "alert('Vessel assignment is saved successfully.');";
                        ScriptManager.RegisterStartupScript(this, this.GetType(), "script1", js1, true);
                        dtvsl = null;
                    }
                }
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }
Exemplo n.º 8
0
    protected void btnExport_Click(object sender, ImageClickEventArgs e)
    {
        int rowcount = ucCustomPagerItems.isCountRecord;

        string vesselcode = (ViewState["VesselCode"] == null) ? null : (ViewState["VesselCode"].ToString());

        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_Infra_Common.Get_Exception_Search(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(ddlvessel.SelectedValue)
                                                             , UDFLib.ConvertDateToNull(txtfrom.Text), UDFLib.ConvertDateToNull(txtto.Text), txtSearch.Text
                                                             , ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);


        //string[] HeaderCaptions = { "Vessel", "From Date", "To Date", "Remarks" };
        //string[] DataColumnsName = { "Vessel_Name", "From_Date", "To_Date", "Remarks" };

        //GridViewExportUtil.ShowExcel(dt, HeaderCaptions, DataColumnsName, "DeckLogBook", "Deck Log Book", "");
    }
    protected void BtnSendEmail_Click(object sender, EventArgs e)
    {
        try
        {
            int rowcount = ucCustomPagerItems.isCountRecord;

            DataSet ds = objJobStatus.TecJobDoneNotDoneSummarySearch(UDFLib.ConvertIntegerToNull(DDLFleet.SelectedValue), UDFLib.ConvertIntegerToNull(DDLVessel.SelectedValue), null, null,
                                                                     null, null, ucCustomPagerItems.CurrentPageIndex, ucCustomPagerItems.PageSize, ref rowcount);

            ExcelDataPMSJob objExpJob   = new ExcelDataPMSJob();
            StringBuilder   sbEmailbody = new StringBuilder();

            string Attachfilename = "";

            string CaptainName = "", ChiefEnggName = "";

            objExpJob.WriteExcell(ds, ref Attachfilename);

            string sToEmailAddress = ds.Tables[2].Rows[0]["Vessel_email"].ToString(), strEmailAddCc = ds.Tables[2].Rows[0]["Fleet_email"].ToString() + ";" + ds.Tables[2].Rows[0]["Fleet_Suprintendent"].ToString(), strFormatSubject = "PMS Jobs updating status";

            DataTable dtRequesterDetails = ojbInfra.Get_UserDetails(Convert.ToInt32(Session["userid"].ToString()));


            if (ds.Tables[1].Rows.Count > 0)
            {
                CaptainName = ds.Tables[1].Rows[0]["Staff_Name"].ToString();
            }
            else
            {
                CaptainName = "";
            }

            if (ds.Tables[3].Rows.Count > 0)
            {
                ChiefEnggName = ds.Tables[3].Rows[0]["Staff_Name"].ToString();
            }
            else
            {
                ChiefEnggName = "";
            }

            sbEmailbody.Append("Dear Capt.  " + CaptainName + " & C/E  " + ChiefEnggName + ",");
            sbEmailbody.AppendLine("<br><br>");
            sbEmailbody.AppendLine("<br><br>");
            sbEmailbody.AppendLine("<br><br>");
            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("<br>");
            sbEmailbody.AppendLine(Convert.ToString(Session["Company_Address_GL"]));
            sbEmailbody.AppendLine("<br>");

            /* Make Entry for email nofification   */

            int MailID = objBLLCrew.Send_CrewNotification(0, 0, 0, 0, sToEmailAddress, strEmailAddCc, "", strFormatSubject, sbEmailbody.ToString(), "", "MAIL", "", UDFLib.ConvertToInteger(Session["USERID"].ToString()), "DRAFT");
            //string uploadpath = @"\\server01\uploads\PmsJobs";
            //string uploadpath = @"\\" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "" + @"\uploads\PmsJobs";
            string uploadpath = @"uploads\PmsJobs";
            /* Make Entry for email attachment   */

            BLL_Infra_Common.Insert_EmailAttachedFile(MailID, Attachfilename, uploadpath + @"\" + Attachfilename);

            string URL = String.Format("window.open('/" + System.Configuration.ConfigurationManager.AppSettings["APP_NAME"].ToString() + "/crew/EmailEditor.aspx?ID=+" + MailID.ToString() + "');");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "k" + MailID.ToString(), URL, true);
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
            string js = "alert('" + UDFLib.GetException("SystemError/ GeneralMessage") + "');";
            ScriptManager.RegisterStartupScript(this, this.GetType(), "error", js, true);
        }
    }
Exemplo n.º 10
0
    public void SendEmailToSupplier(DataSet dsEmailInfo, string strSuppCode, string strServerIPAdd, string Attachment, bool bIsListed, string RFQType, bool IsInsert_Mail)
    {
        try
        {
            DataTable dtSuppDetails = new DataTable();
            string    strFormatSubject = "", strFormatBody = "", sToEmailAddress = "";
            BLL_Infra_UserCredentials objUser = new BLL_Infra_UserCredentials();

            DataTable dtUser        = objUser.Get_UserDetails(Convert.ToInt32(Session["USERID"]));
            string    strEmailAddCc = dtUser.Rows[0]["MailID"].ToString();

            int value = Int32.Parse(RFQType);
            BLL_Crew_CrewDetails objMail = new BLL_Crew_CrewDetails();
            int    MailID         = 0;
            String URL            = "";
            string UploadFilePath = ConfigurationManager.AppSettings["PURC_UPLOAD_PATH"];
            switch (value)
            {
            case 1:      // Excel Based RFQ

                FormateEmail(dsEmailInfo, true, strServerIPAdd, out sToEmailAddress, out strFormatSubject, out strFormatBody, bIsListed, Attachment);

                MailID = objMail.Send_CrewNotification(0, 0, 0, 0, sToEmailAddress, strEmailAddCc, "", strFormatSubject, strFormatBody, "", "MAIL", "", UDFLib.ConvertToInteger(Session["USERID"].ToString()), "DRAFT");

                //string uploadpath = @"\\server01\uploads\Purchase";
                string uploadpath = @"uploads\Purchase";

                BLL_Infra_Common.Insert_EmailAttachedFile(MailID, FileName, uploadpath + @"\" + FileName);


                URL = String.Format("window.open('../crew/EmailEditor.aspx?ID=+" + MailID.ToString() + @"&FILEPATH=" + UploadFilePath + "');");
                ScriptManager.RegisterStartupScript(thispage, thispage.GetType(), "k" + MailID.ToString(), URL, true);


                break;

            case 2:      // Web Based RFQ

                FormateEmail(dsEmailInfo, false, strServerIPAdd, out sToEmailAddress, out strFormatSubject, out strFormatBody, bIsListed, "");

                MailID = objMail.Send_CrewNotification(0, 0, 0, 0, sToEmailAddress, strEmailAddCc, "", strFormatSubject, strFormatBody, "", "MAIL", "", UDFLib.ConvertToInteger(Session["USERID"].ToString()), "DRAFT");

                //URL = String.Format("alert('web');");
                URL = String.Format("window.open('../crew/EmailEditor.aspx?ID=+" + MailID.ToString() + @"&FILEPATH=" + UploadFilePath + "');");
                ScriptManager.RegisterStartupScript(thispage, thispage.GetType(), "k" + MailID.ToString(), URL, true);


                break;

            case 3:

                FormateEmailOnRework(dsEmailInfo, false, strServerIPAdd, out sToEmailAddress, out strFormatSubject, out strFormatBody, bIsListed, "");

                MailID = objMail.Send_CrewNotification(0, 0, 0, 0, sToEmailAddress, strEmailAddCc, "", strFormatSubject, strFormatBody, "", "MAIL", "", UDFLib.ConvertToInteger(Session["USERID"].ToString()), "READY");
                URL    = String.Format("window.open('../crew/EmailEditor.aspx?ID=+" + MailID.ToString() + @"&FILEPATH=" + UploadFilePath + "');");
                ScriptManager.RegisterStartupScript(thispage, thispage.GetType(), "k" + MailID.ToString(), URL, true);

                break;
            }
        }
        catch (Exception ex)
        {
        }
    }
Exemplo n.º 11
0
    protected void SendPurchaseOrder()
    {
        // string[] Attchment = new string[10];
        lblError.Text = "";
        string    strPath        = Server.MapPath(".") + "\\SendPO\\";
        DataTable DsPO           = new DataTable();
        DataSet   dsSendMailInfo = new DataSet();

        BLL_Infra_UserCredentials objUser = new BLL_Infra_UserCredentials();
        DataTable dtUser = objUser.Get_UserDetails(Convert.ToInt32(Session["USERID"]));

        string emailIDcc = dtUser.Rows[0]["MailID"].ToString();
        bool   IsPO      = false;



        int i = 0;

        string sDlvIns         = txtdlvins.Text != "" ? txtdlvins.Text : DBNull.Value.ToString();
        string strDeliveryPort = DDLPort.SelectedItem.ToString() != "--Select--" ? DDLPort.SelectedValue.ToString() : DBNull.Value.ToString();
        string sEta            = txteta.Text != "" ? txteta.Text + " " + txtETAAPPM.Text.ToString().Trim() + ":00" : Convert.ToString("01/01/1900");
        string sRemark         = txtremark.Text != "" ? txtremark.Text : DBNull.Value.ToString();
        string sAgent          = txtagent.Text != "" ? txtagent.Text : DBNull.Value.ToString();
        string sEtd            = txtetd.Text != "" ? txtetd.Text + " " + txtETDAMPM.Text.ToString().Trim() + ":00" : Convert.ToString("01/01/1900");

        foreach (GridViewRow gvRow in gvLPOList.Rows)
        {
            CheckBox chk        = (CheckBox)(gvRow.FindControl("chkSelectLPO") as CheckBox);
            string   order_code = gvLPOList.DataKeys[gvRow.RowIndex].Value.ToString();

            if ((chk.Checked))
            {
                string OrderCode = gvLPOList.DataKeys[gvRow.RowIndex].Value.ToString();

                int sts = BLL_PURC_LOG.Upd_Log_Order_Details(sDlvIns, strDeliveryPort, DateTime.Parse(sEta), sRemark, DateTime.Parse(sEtd), sAgent, Request.QueryString["LOG_ID"], order_code, Convert.ToInt32(Session["USERID"]));

                DsPO = BLL_PURC_LOG.Get_Log_Raise_PO(order_code, Request.QueryString["LOG_ID"]);

                dsSendMailInfo = BLL_PURC_LOG.Get_RaisePO_EmailInfo(order_code, Request.QueryString["LOG_ID"], Convert.ToInt32(Session["USERID"]));
                string FileName = "PO_" + OrderCode + "_" + ReplaceSpecialCharacterinFileName(DsPO.Rows[0]["SHORT_NAME"].ToString()) + DateTime.Now.ToString("yyMMddss") + ".pdf";
                string sToEmailAddress = "", strSubject = "", strEmailBody = "";
                //Generate the PDF file and check the include amount status


                DataTable dtPO = DsPO;

                if (rbtnIncludeAmount.Checked == false)
                {
                    int ipo = 0;
                    foreach (DataRow dr in dtPO.Rows)
                    {
                        dtPO.Rows[ipo]["currency"]      = "";
                        dtPO.Rows[ipo]["exchange_rate"] = 0;
                        dtPO.Rows[ipo]["quoted_rate"]   = 0;

                        dtPO.AcceptChanges();
                        ipo++;
                    }
                }



                GeneratePOAsPDF(dtPO, strPath, FileName);


                FormateEmail(dsSendMailInfo, out sToEmailAddress, out strSubject, out strEmailBody, false, OrderCode);

                BLL_Crew_CrewDetails objMail = new BLL_Crew_CrewDetails();
                int MailID = 0;
                MailID = objMail.Send_CrewNotification(0, 0, 0, 0, sToEmailAddress, emailIDcc, "", strSubject, strEmailBody, "", "MAIL", "", UDFLib.ConvertToInteger(Session["USERID"].ToString()), "DRAFT");

                string UploadFilePath = ConfigurationManager.AppSettings["PURC_UPLOAD_PATH"];

                //string uploadpath = @"\\server01\uploads\Purchase";
                string uploadpath = @"uploads\Purchase";
                BLL_Infra_Common.Insert_EmailAttachedFile(MailID, FileName, uploadpath + @"\" + FileName);


                string URL = String.Format("window.open('../crew/EmailEditor.aspx?ID=+" + MailID.ToString() + @"&FILEPATH=" + UploadFilePath + "');");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "k" + MailID.ToString(), URL, true);

                //   ResponseHelper.Redirect("../crew/EmailEditor.aspx?ID=" + MailID.ToString(), "blank", "");
            }
        }


        String msg1 = String.Format("window.open('','_self') ;window.close() ;");

        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg1, true);


        dvRaiselPo.Visible   = false;
        btnSendOrder.Enabled = true;
    }
Exemplo n.º 12
0
    protected void SendPurchaseOrder()
    {
        // string[] Attchment = new string[10];
        lblError.Text = "";
        string  strPath        = Server.MapPath(".") + "\\SendPO\\";
        DataSet DsPO           = new DataSet();
        DataSet dsSendMailInfo = new DataSet();

        BLL_Infra_UserCredentials objUser = new BLL_Infra_UserCredentials();
        DataTable dtUser = objUser.Get_UserDetails(Convert.ToInt32(Session["USERID"]));

        string emailIDcc = dtUser.Rows[0]["MailID"].ToString();
        bool   IsPO      = false;

        if (rgdSuppliers.MasterTableView.Items.Count > 0)
        {
            foreach (GridDataItem dataItem in rgdSuppliers.MasterTableView.Items)
            {
                CheckBox chk = (CheckBox)(dataItem.FindControl("chkSendOrder") as CheckBox);
                if ((chk.Checked))
                {
                    IsPO = true;
                }
            }
        }

        if (rgdSuppliers.MasterTableView.Items.Count > 0)
        {
            int i = 0;

            if (IsPO)
            {
                DataTable dtQuotationList = new DataTable();
                dtQuotationList.Columns.Add("Qtncode");
                dtQuotationList.Columns.Add("amount");

                string sDlvIns         = txtdlvins.Text != "" ? txtdlvins.Text : DBNull.Value.ToString();
                string strDeliveryPort = DDLPort.SelectedItem.ToString() != "--Select--" ? DDLPort.SelectedValue.ToString() : DBNull.Value.ToString();
                string sEta            = txteta.Text != "" ? txteta.Text + " " + txtETAAPPM.Text.ToString().Trim() + ":00" : Convert.ToString("01/01/1900");
                string sRemark         = txtremark.Text != "" ? txtremark.Text : DBNull.Value.ToString();
                string sAgent          = txtagent.Text != "" ? txtagent.Text : DBNull.Value.ToString();
                string sEtd            = txtetd.Text != "" ? txtetd.Text + " " + txtETDAMPM.Text.ToString().Trim() + ":00" : Convert.ToString("01/01/1900");

                foreach (GridDataItem dataItem in rgdSuppliers.MasterTableView.Items)
                {
                    CheckBox chk = (CheckBox)(dataItem.FindControl("chkSendOrder") as CheckBox);

                    string chkAppStatus = dataItem["APPROVED_Status"].Text;



                    if ((chk.Checked) && dataItem["APPROVED_Status"].Text == "YES")
                    {
                        i++;
                        using (BLL_PURC_Purchase objTechService = new BLL_PURC_Purchase())
                        {
                            DataRow drQTN = dtQuotationList.NewRow();
                            drQTN["Qtncode"] = dataItem["QUOTATION_CODE"].Text.ToString();
                            drQTN["amount"]  = "0";
                            dtQuotationList.Rows.Add(drQTN);

                            string OrderCode = dataItem["ORDER_CODE"].Text;

                            int sts = objTechService.PMSUpdOtherPODetails(sDlvIns, strDeliveryPort, sEta, sRemark, sEtd, sAgent, Request.QueryString["Document_Code"].ToString(), Request.QueryString["Requisitioncode"].ToString(), Convert.ToInt32(Request.QueryString["Vessel_Code"].ToString()), dataItem["QUOTATION_CODE"].Text.ToString(), dataItem["SUPPLIER"].Text.ToString(), Convert.ToInt32(Session["USERID"].ToString()));

                            DsPO = objTechService.GetDataToGeneratPO(Request.QueryString["Requisitioncode"].ToString(), Request.QueryString["Vessel_Code"].ToString(), dataItem["SUPPLIER"].Text.ToString(), dataItem["QUOTATION_CODE"].Text, Request.QueryString["Document_Code"].ToString());

                            dsSendMailInfo = objTechService.GetRFQsuppInfoSendEmail(dataItem["SUPPLIER"].Text.ToString(), dataItem["QUOTATION_CODE"].Text, Request.QueryString["Vessel_Code"].ToString(), Request.QueryString["Document_Code"].ToString(), Session["userid"].ToString());
                            string FileName = "PO_" + Request.QueryString["Vessel_Code"].ToString() + "_" + OrderCode + "_" + dataItem["SUPPLIER"].Text.ToString() + ReplaceSpecialCharacterinFileName(dataItem["SHORT_NAME"].Text) + DateTime.Now.ToString("yyMMddss") + ".pdf";
                            string sToEmailAddress = "", strSubject = "", strEmailBody = "";
                            //Generate the PDF file and check the include amount status


                            DataTable dtPO = DsPO.Tables[0];

                            if (rbtnIncludeAmount.Checked == false)
                            {
                                int ipo = 0;
                                foreach (DataRow dr in dtPO.Rows)
                                {
                                    dtPO.Rows[ipo]["currency"]      = "";
                                    dtPO.Rows[ipo]["exchange_rate"] = 0;
                                    dtPO.Rows[ipo]["quoted_rate"]   = 0;

                                    dtPO.AcceptChanges();
                                    ipo++;
                                }
                            }



                            GeneratePOAsPDF(dtPO, strPath, FileName);
                            //Attchment.SetValue(strPath + FileName, 0);
                            // objTechService.ChangeSupplierPOStatus(Request.QueryString["Requisitioncode"].ToString(), Request.QueryString["Document_Code"].ToString(), Request.QueryString["Vessel_Code"].ToString());
                            //Format Email body.

                            FormateEmail(dsSendMailInfo, out sToEmailAddress, out strSubject, out strEmailBody, false, OrderCode);
                            //Send Email to selected supplier.
                            // // Email.SendEMailForPO("*****@*****.**", sToEmailAddress, "", "", strSubject, strEmailBody, Attchment);

                            BLL_Crew_CrewDetails objMail = new BLL_Crew_CrewDetails();
                            int MailID = 0;
                            MailID = objMail.Send_CrewNotification(0, 0, 0, 0, sToEmailAddress, emailIDcc, "", strSubject, strEmailBody, "", "MAIL", "", UDFLib.ConvertToInteger(Session["USERID"].ToString()), "DRAFT");


                            string UploadFilePath = ConfigurationManager.AppSettings["PURC_UPLOAD_PATH"];
                            //string uploadpath = @"\\server01\uploads\Purchase";
                            string uploadpath = @"uploads\Purchase";
                            BLL_Infra_Common.Insert_EmailAttachedFile(MailID, FileName, uploadpath + @"\" + FileName);



                            string URL = String.Format("window.open('../crew/EmailEditor.aspx?ID=+" + MailID.ToString() + @"&FILEPATH=" + UploadFilePath + "');");
                            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "k" + MailID.ToString(), URL, true);

                            //   ResponseHelper.Redirect("../crew/EmailEditor.aspx?ID=" + MailID.ToString(), "blank", "");
                        }
                    }
                    else if ((chk.Checked) && dataItem["APPROVED_Status"].Text == "NO")
                    {
                        String msg = String.Format("alert('Purchase order can not be raise because PO has not been approved.');");
                        ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg, true);
                    }
                }

                using (BLL_PURC_Purchase objTechService = new BLL_PURC_Purchase())
                {
                    //Update the requistion Stage Status
                    objTechService.InsertRequisitionStageStatus(Request.QueryString["Requisitioncode"].ToString(), Request.QueryString["Vessel_Code"].ToString(), Request.QueryString["Document_Code"].ToString(), "SCN", sRemark, Convert.ToInt32(Session["userid"]), dtQuotationList);
                }

                if (i == rgdSuppliers.MasterTableView.Items.Count)
                {
                    String msg1 = String.Format("window.close();");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg1, true);
                }
                else
                {
                    String msg1 = String.Format("alert('Purchase order has been raised successfully.'); ");
                    ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg1, true);
                }



                BindRequisitionInfo();

                //AddToSyncronizer.AddToSyncroNizerData("PURC_Dtl_Supply_Items");
                //AddToSyncronizer.AddToSyncroNizerData("PURC_Dtl_Reqsn");
                //AddToSyncronizer.AddToSyncroNizerData("PURC_Dtl_Reqsn_Status");
                BindGrid();
                divpurcomment.Visible = false;
                btnSendOrder.Enabled  = true;
            }
            else
            {
                String msg2 = String.Format("alert('Select alteast one quotation to raise the PO.')");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg2, true);
                //lblError.Text = "Select alteast one check box to raise the PO.";
            }
        }
        else
        {
            String msg3 = String.Format("alert('There is no quotation selected to Send the PO.')");
            ScriptManager.RegisterStartupScript(Page, Page.GetType(), "msg", msg3, true);
            //lblError.Text = "There is No data to Send the Purchase Order";
        }
    }
Exemplo n.º 13
0
    protected void ImgbtnReSendPO_Click(object s, CommandEventArgs e)
    {
        try
        {
            string[] strIds          = e.CommandArgument.ToString().Split(',');
            string   Requisitioncode = strIds[0].ToString();
            string   Document_Code   = strIds[1].ToString();
            string   Vessel_Code     = strIds[2].ToString();
            string   SUPPLIER        = strIds[3].ToString();
            string   OrderCode       = strIds[4].ToString();
            string   QUOTATION_CODE  = strIds[5].ToString();


            string  strPath        = Server.MapPath(".") + "\\SendPO\\";
            DataSet DsPO           = new DataSet();
            DataSet dsSendMailInfo = new DataSet();

            BLL_Infra_UserCredentials objUser = new BLL_Infra_UserCredentials();
            DataTable dtUser = objUser.Get_UserDetails(Convert.ToInt32(Session["USERID"]));

            string emailIDcc = dtUser.Rows[0]["MailID"].ToString();


            using (BLL_PURC_Purchase objTechService = new BLL_PURC_Purchase())
            {
                DsPO = objTechService.GetDataToGeneratPO(Requisitioncode, Vessel_Code, SUPPLIER, QUOTATION_CODE, Document_Code);

                dsSendMailInfo = objTechService.GetRFQsuppInfoSendEmail(SUPPLIER, QUOTATION_CODE, Vessel_Code, Document_Code, Session["userid"].ToString());
                string FileName = "PO_" + Vessel_Code + "_" + OrderCode + "_" + SUPPLIER + DateTime.Now.ToString("yyMMddss") + ".pdf";
                string sToEmailAddress = "", strSubject = "", strEmailBody = "";
                //Generate the PDF file and check the include amount status


                DataTable dtPO = DsPO.Tables[0];



                GeneratePOAsPDF(dtPO, strPath, FileName);


                FormateEmail(dsSendMailInfo, out sToEmailAddress, out strSubject, out strEmailBody, false, OrderCode);

                BLL_Crew_CrewDetails objMail = new BLL_Crew_CrewDetails();
                int MailID = 0;
                MailID = objMail.Send_CrewNotification(0, 0, 0, 0, sToEmailAddress, emailIDcc, "", strSubject, strEmailBody, "", "MAIL", "", UDFLib.ConvertToInteger(Session["USERID"].ToString()), "DRAFT");


                string UploadFilePath = ConfigurationManager.AppSettings["PURC_UPLOAD_PATH"];
                //string uploadpath = @"\\server01\uploads\Purchase";
                string uploadpath = @"uploads\Purchase";
                BLL_Infra_Common.Insert_EmailAttachedFile(MailID, FileName, uploadpath + @"\" + FileName);


                string URL = String.Format("window.open('../crew/EmailEditor.aspx?ID=+" + MailID.ToString() + @"&FILEPATH=" + UploadFilePath + "');");
                ScriptManager.RegisterStartupScript(Page, Page.GetType(), "k" + MailID.ToString(), URL, true);
            }
        }
        catch (Exception ex)
        {
            UDFLib.WriteExceptionLog(ex);
        }
    }