Esempio n. 1
0
 public void SaveMain(bool isprint)
 {
     try
     {
         string    Docdate = txtDocDate.Text.Split('/')[1] + "/" + txtDocDate.Text.Split('/')[0] + "/" + txtDocDate.Text.Split('/')[2];
         G_GetPass _obj    = new G_GetPass();
         _obj.Doc_ID           = Convert.ToInt32(lblDocNo.Text.Trim());
         _obj.DC_No            = Convert.ToInt32(0);
         _obj.Doc_Date         = Convert.ToDateTime(Docdate);
         _obj.Veh_ID           = Convert.ToInt32(lblVehicleNoID.Text.Trim());
         _obj.Driver_ID        = Convert.ToInt32(lblDriverID.Text.Trim());
         _obj.Driver_Name      = lblDriver.Text.Trim();
         _obj.Area             = ddlArea.SelectedValue.ToString();
         _obj.Deliveruy_Boy_ID = Convert.ToInt32(lblDeliveryBoyID.Text.Trim());
         _obj.Deliveruy_Boy    = lblDeliveryBoy.Text.Trim();
         _obj.Fy          = Convert.ToInt32(strFY);
         _obj.Amount      = 0;
         _obj.Local_Out   = "L";
         Localout         = "L";
         _obj.Value_Goods = 0;
         _obj.Created_By  = UserName;
         _obj.Updated_By  = UserName;
         _obj.Remark2     = "speciman";
         int Doc_No_New = 0;
         if (grdTemp.Rows.Count > 0)
         {
             DocId = _obj.Save(out Doc_No_New);
             SaveSubRecords(DocId, Doc_No_New);
             if (isprint)
             {
                 ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "window", "f_open_window_max('Godown/print/LocalGodownPrint.aspx?d=" + Doc_No_New + "&L=" + "SP" + "')", true);
             }
             Clear();
             CallButonVisible("new");
         }
         else
         {
             MessageBox("Please Enter complete details before saving !!!");
         }
     }
     catch (Exception ex)
     {
         MessageBox("Error! : " + ex.Message.ToString());
     }
 }
Esempio n. 2
0
    public void SaveMain(bool isprint)
    {
        try
        {
            string Docdate = 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.DC_No          = Convert.ToInt32(0);
            _obj.Doc_Date       = Convert.ToDateTime(Docdate);
            _obj.Transporter_ID = Convert.ToInt32(lblTransID.Text.Trim());
            _obj.Cust_ID        = Convert.ToInt32(lblBranchID.Text.Trim());
            _obj.No_Bundles     = txtNoOfBund.Text.Trim().ToString();

            if (txtValOfGoods.Text.Trim() == "")
            {
                _obj.Value_Goods = 0;
            }
            else
            {
                _obj.Value_Goods = Convert.ToDecimal(txtValOfGoods.Text.Trim());
            }

            _obj.Remark1 = txtRemark.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.Amount    = 0;
            _obj.Local_Out = "O";
            Localout       = "O";
            _obj.Remark2   = "B";
            //_obj.Value_Goods = 0;

            _obj.Created_By = UserName;
            _obj.Updated_By = UserName;
            int Doc_No_New = 0;
            if (grdTemp.Rows.Count > 0)
            {
                DocId = _obj.Save(out Doc_No_New);
                SaveSubRecords(DocId, Doc_No_New);
                if (isprint)
                {
                    ScriptManager.RegisterClientScriptBlock(Page, Page.GetType(), "window", "f_open_window_max('Godown/print/OutGodownPrint.aspx?d=" + DocId + "&L=" + Localout + "')", true);
                }
                Clear();
                CallButonVisible("new");
            }
            else
            {
                MessageBox("Please Enter complete details before saving !!!");
            }
        }
        catch (Exception ex)
        {
            MessageBox("Error! : " + ex.Message.ToString());
        }
    }
Esempio n. 3
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());
        }
    }