protected void Save_Click(object sender, EventArgs e)
    {
        try
        {
            CourierDetails _objCD = new CourierDetails();
            _objCD.SaveDispatchEmailDetails(Convert.ToInt32(txtDocIdEdit.Text.Trim()), "O", Convert.ToInt32(strFY), Convert.ToString(Session["UserName"]), out SCD);

            SendEmailJob();
        }
        catch { }
    }
Exemplo n.º 2
0
    public void saveMaster(bool isprint)
    {
        int    DocId    = 0;
        string Localout = string.Empty;

        try
        {
            string    date   = txtDocDate.Text.Split('/')[1] + "/" + txtDocDate.Text.Split('/')[0] + "/" + txtDocDate.Text.Split('/')[2];
            string    LRdate = txtLrDate.Text.Split('/')[1] + "/" + txtLrDate.Text.Split('/')[0] + "/" + txtLrDate.Text.Split('/')[2];
            G_GetPass obj    = new G_GetPass();
            obj.Doc_ID         = Convert.ToInt32(lblDocNo.Text.Trim());
            obj.Local_Out      = "O";
            Localout           = "O";
            obj.Doc_Date       = Convert.ToDateTime(date);
            obj.DC_No          = Convert.ToDecimal(txtDcNo.Text.Trim());
            obj.Cust_ID        = Convert.ToInt32(lblCustID.Text.Trim());
            obj.Transporter_ID = Convert.ToInt32(lblTransID.Text.Trim());
            obj.No_Bundles     = txtNoOfBund.Text.Trim();
            obj.Bill_Nos       = txtBillNo.Text.Trim();
            if (txtValOfGoods.Text.Trim() == "")
            {
                obj.Value_Goods = 0;
            }
            else
            {
                obj.Value_Goods = Convert.ToDecimal(txtValOfGoods.Text.Trim());
            }

            obj.Sent_By  = txtSentBy.Text.Trim();
            obj.LR_No    = txtLRNo.Text.Trim();
            obj.LR_Date  = Convert.ToDateTime(LRdate);
            obj.Pay_Paid = rdoPaidStaus.SelectedValue.ToString();
            if (txtAmt.Text.Trim() == "")
            {
                obj.Amount = 0;
            }
            else
            {
                obj.Amount = Convert.ToDecimal(txtAmt.Text.Trim());
            }
            obj.Delivery   = chIsDelivery.Checked;
            obj.Fy         = Convert.ToInt32(strFY);
            obj.Created_By = UserName;
            obj.Updated_By = UserName;
            obj.Remark1    = txtRemark.Text;
            int Doc_No_New = 0;
            DocId = obj.Save(out Doc_No_New);
            MessageBox("Data Saved! \\r\\n Documennt no." + Doc_No_New.ToString());
            int            SCD;
            CourierDetails _objCD = new CourierDetails();
            _objCD.SaveDispatchEmailDetails(Convert.ToInt32(DocId), "O", Convert.ToInt32(strFY), Convert.ToString(Session["UserName"]), out SCD);

            DataSet ds = new DataSet();
            ds = G_GetPass.CustEMail_LocalEntry(obj.Cust_ID);
            String CustEmailId = "";
            if (ds.Tables.Count != 0)
            {
                CustEmailId = ds.Tables[0].Rows[0]["EmailId"].ToString();
                string SZEmailid = ds.Tables[0].Rows[0]["SEmailID"].ToString();

                if (CustEmailId.Trim() != "")
                {
                    MailMessage msg = new MailMessage();
                    msg.From = new MailAddress("*****@*****.**");
                    msg.To.Add(new MailAddress(CustEmailId));
                    msg.To.Add(new MailAddress("*****@*****.**"));
                    msg.Bcc.Add(new MailAddress(SZEmailid));
                    msg.Subject = "Chetana Book Depot";

                    string CustomerName = "";
                    if (lblCustomer.Text.Trim() != "")
                    {
                        string[] tokens = lblCustomer.Text.Split(new string[] { "::" }, StringSplitOptions.None);
                        CustomerName = tokens[0].Trim();
                    }
                    if (CustomerName == "")
                    {
                        CustomerName = txtcustomer.Text;
                    }
                    string TransporterName = "";
                    TransporterName = lbltransporter.Text;
                    if (TransporterName == "")
                    {
                        TransporterName = txttransporter.Text;
                    }

                    msg.Body       = MailBodyDesign(CustomerName, obj.DC_No, obj.No_Bundles, TransporterName, obj.LR_No, obj.LR_Date.ToString()).ToString();
                    msg.IsBodyHtml = true;
                    SmtpClient smtp = new SmtpClient();
                    smtp.Host = "crm.chetanapublications.com";
                    smtp.Port = 25;
                    smtp.UseDefaultCredentials = false;
                    smtp.Credentials           = new System.Net.NetworkCredential("*****@*****.**", "we0504260");
                    smtp.EnableSsl             = false;

                    try
                    {
                        smtp.Send(msg);
                        DataSet DsMailLog   = new DataSet();
                        string  mDocumentNo = obj.DC_No.ToString();
                        DsMailLog = CourierDetails.SendDispatchEmail(SCD, float.Parse(mDocumentNo), "DispatchEmail", "DispatchId", Convert.ToInt32(strFY), "*****@*****.**", "we0504260", Convert.ToString(Session["UserName"]));
                        //MessageBox("Mail Sent successfully");
                    }
                    catch (Exception ex)
                    {
                        //MessageBox(ex.Message);
                    }
                }
            }
            ds.Dispose();
            if (isprint)
            {
                ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "window", "f_open_window_max('Godown/print/OutGodownPrint.aspx?d=" + DocId + "&L=" + Localout + "')", true);
            }
            Clear();
            CallButonVisible("new");
        }
        catch (Exception ex)
        {
            MessageBox("Error! : " + ex.Message.ToString());
        }
    }
Exemplo n.º 3
0
    public void SaveSubRecords(int DocId, int DocIdnew)
    {
        try
        {
            G_GetPassSub obj = new G_GetPassSub();
            obj.DOC_ID = DocId;
            int            SCD;
            DataSet        ds     = new DataSet();
            CourierDetails _objCD = new CourierDetails();
            _objCD.SaveDispatchEmailDetails(Convert.ToInt32(DocIdnew), "O", Convert.ToInt32(strFY), Convert.ToString(Session["UserName"]), out SCD);
            foreach (GridViewRow row in grdTemp.Rows)
            {
                obj.DOC_SUB_ID    = Convert.ToInt32(((Label)(row.FindControl("lblSubID"))).Text.Trim());
                obj.DC_NO         = Convert.ToInt32(((Label)(row.FindControl("lblDcNo"))).Text.Trim());
                obj.BILL_NO       = ((Label)(row.FindControl("lblBillNo"))).Text.Trim();
                obj.SCHL_NAME     = ((Label)(row.FindControl("lblCustName"))).Text.Trim();
                obj.SCHL_AREA     = ((Label)(row.FindControl("lblArea"))).Text.Trim();
                obj.NO_OF_BUNDLES = ((Label)(row.FindControl("lblNoOfBundles"))).Text.Trim();
                obj.DELIVERY      = ((CheckBox)(row.FindControl("ChkDelivery"))).Checked;
                obj.Cust_ID       = Convert.ToInt32(((Label)(row.FindControl("lblCustid"))).Text.Trim());
                obj.Created_By    = UserName;
                obj.Updated_By    = UserName;
                obj.Save();
                ds = G_GetPass.CustEMail_LocalEntry(obj.Cust_ID);
                String CustEmailId = "";
                if (ds.Tables.Count != 0)
                {
                    CustEmailId = ds.Tables[0].Rows[0]["EmailId"].ToString();

                    if (CustEmailId.Trim() != "")
                    {
                        MailMessage msg = new MailMessage();
                        msg.From = new MailAddress("*****@*****.**");
                        msg.To.Add(new MailAddress("*****@*****.**"));
                        msg.To.Add(new MailAddress(CustEmailId));
                        msg.To.Add(new MailAddress("*****@*****.**"));


                        msg.Subject    = "Chetana Book Depot";
                        msg.Body       = MailBodyDesign(obj.SCHL_NAME, obj.DC_NO, obj.NO_OF_BUNDLES).ToString();
                        msg.IsBodyHtml = true;
                        SmtpClient smtp = new SmtpClient();
                        smtp.Host = "crm.chetanapublications.com";
                        smtp.Port = 25;
                        smtp.UseDefaultCredentials = false;
                        smtp.Credentials           = new System.Net.NetworkCredential(ConfigurationManager.AppSettings["Username"].ToString(), ConfigurationManager.AppSettings["Password"].ToString());
                        smtp.EnableSsl             = false;

                        try
                        {
                            smtp.Send(msg);
                            DataSet DsMailLog   = new DataSet();
                            string  mDocumentNo = obj.DC_NO.ToString();
                            DsMailLog = CourierDetails.SendDispatchEmail(SCD, float.Parse(mDocumentNo), "DispatchEmail", "DispatchId", Convert.ToInt32(strFY), "*****@*****.**", "we0504260", Convert.ToString(Session["UserName"]));
                            //MessageBox("Mail Sent successfully");
                        }
                        catch (Exception ex)
                        {
                            //MessageBox(ex.Message);
                        }
                    }
                }
            }

            MessageBox("Data Saved! \\r\\n Documennt no." + DocIdnew);
        }
        catch (Exception ex)
        {
            MessageBox("Error! : " + ex.Message.ToString());
        }
    }