Пример #1
0
    public void SaveSubRecords(int DocId, int DocIdnew)
    {
        try
        {
            G_GetPassSub obj = new G_GetPassSub();
            obj.DOC_ID = DocId;
            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();
            }

            MessageBox("Data Saved! \\r\\n Documennt no." + DocIdnew);
        }
        catch (Exception ex)
        {
            MessageBox("Error! : " + ex.Message.ToString());
        }
    }
Пример #2
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());
        }
    }