protected void btnSaveDetails_Click(object sender, EventArgs e) { DataSet ds = G_GetPass.Local_GetPass_DCNo_BillNo_Validation(Convert.ToDecimal(txtDcNo.Text.Trim()), txtBillNo.Text.Trim(), Convert.ToInt32(strFY), "SpecBill"); if (lblEditMode.Text != "edit") { if ((ds.Tables[0].Rows.Count > 0)) { MessageBox(ds.Tables[0].Rows[0][0].ToString()); } else { grdTemp.Visible = true; grdTemp.DataSource = fillTempBookData(txtBillNo.Text.Trim(), txtDcNo.Text.Trim()); grdTemp.DataBind(); clearStrip(); } } else { //if (ds.Tables[0].Rows.Count > 0) //{ // if (ds.Tables[0].Rows[0][1] == "1") // { // MessageBox(ds.Tables[0].Rows[0][0].ToString()); // } // else // { grdTemp.Visible = true; grdTemp.DataSource = fillTempBookData(txtBillNo.Text.Trim(), txtDcNo.Text.Trim()); grdTemp.DataBind(); clearStrip(); // } //} } txtDcNo.Focus(); }
public void fillEditForm() { Clear(); DataTable dt = G_GetPass.GetpassOnDocNo(Convert.ToInt32(txtDocIdEdit.Text.Trim()), "O", Convert.ToInt32(strFY)).Tables[0]; if (dt.Rows.Count > 0) { string date = (Convert.ToDateTime(dt.Rows[0]["Doc_Date"].ToString())).ToString("dd/MM/yyyy"); string LRdate = (Convert.ToDateTime(dt.Rows[0]["LR_Date"].ToString())).ToString("dd/MM/yyyy"); txtDocNo.Text = dt.Rows[0]["Doc_No"].ToString(); lblDocNo.Text = dt.Rows[0]["Doc_ID"].ToString(); txtDcNo.Text = dt.Rows[0]["DC_No"].ToString(); txtBillNo.Text = dt.Rows[0]["Bill_Nos"].ToString(); lblclone.Text = dt.Rows[0]["Bill_Nos"].ToString(); txtcustomer.Text = dt.Rows[0]["CustomerName"].ToString(); lblCustID.Text = dt.Rows[0]["Cust_ID"].ToString(); txttransporter.Text = dt.Rows[0]["Trasporter"].ToString(); lblTransID.Text = dt.Rows[0]["Transporter_ID"].ToString(); txtNoOfBund.Text = dt.Rows[0]["No_Bundles"].ToString(); txtValOfGoods.Text = dt.Rows[0]["Value_Goods"].ToString(); txtSentBy.Text = dt.Rows[0]["Sent_By"].ToString(); txtLRNo.Text = dt.Rows[0]["LR_No"].ToString(); txtLrDate.Text = LRdate; chIsDelivery.Checked = Convert.ToBoolean(dt.Rows[0]["Delivery"].ToString()); txtAmt.Text = dt.Rows[0]["Amount"].ToString(); rdoPaidStaus.SelectedValue = dt.Rows[0]["Pay_Paid"].ToString(); txtDocDate.Text = date; dt.Rows[0]["Amount"].ToString(); txtRemark.Text = dt.Rows[0]["Remark1"].ToString(); CallButonVisible("edit"); txtDocDate.Focus(); } else { MessageBox("Info! : \\r\\n Doc. No. " + txtDocIdEdit.Text.Trim() + " Not Found!!!"); txtDocIdEdit.Text = ""; txtDocIdEdit.Focus(); ModalPopUpDocNum.Show(); } }
public void fillEditForm() { Clear(); DataSet ds = G_GetPass.GetpassOnDocNo(Convert.ToInt32(txtDocIdEdit.Text.Trim()), "L", Convert.ToInt32(strFY)); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { string date = (Convert.ToDateTime(dt.Rows[0]["Doc_Date"].ToString())).ToString("dd/MM/yyyy"); txtDocNo.Text = dt.Rows[0]["Doc_No"].ToString(); lblDocNo.Text = dt.Rows[0]["Doc_ID"].ToString(); txtDocDate.Text = date; txtDriver.Text = dt.Rows[0]["Driver_Name"].ToString(); lblDriver.Text = dt.Rows[0]["Driver_Name"].ToString(); lblDriver.Visible = true; lblDriverID.Text = dt.Rows[0]["Driver_ID"].ToString(); txtVehicle.Text = dt.Rows[0]["Veh_no"].ToString(); lblVehicleNo.Text = dt.Rows[0]["Veh_no"].ToString(); lblVehicleNoID.Text = dt.Rows[0]["Veh_ID"].ToString(); ddlArea.SelectedValue = dt.Rows[0]["Area"].ToString(); txtDiliveryboy.Text = dt.Rows[0]["Deliveruy_Boy"].ToString(); lblDeliveryBoy.Text = dt.Rows[0]["Deliveruy_Boy"].ToString(); lblDeliveryBoy.Visible = true; lblDeliveryBoyID.Text = dt.Rows[0]["Deliveruy_Boy_ID"].ToString(); filltempData(ds.Tables[1]); CallButonVisible("edit"); txtDocDate.Focus(); } else { MessageBox("Info! : \\r\\n Doc. No. " + txtDocIdEdit.Text.Trim() + " Not Found!!!"); ModalPopUpDocNum.Show(); txtDocIdEdit.Text = ""; txtDocIdEdit.Focus(); } }
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()); } }
public void fillDatacustomer(int isNew) { DateTimeFormatInfo info = new DateTimeFormatInfo(); info.ShortDatePattern = "dd/MM/yyyy"; info.DateSeparator = "/"; ReportDocument rd = new ReportDocument(); if (isNew == 1) { DateTime _objfdate = Convert.ToDateTime(txtfromdate.Text.Trim(), info); DateTime _objtdate = Convert.ToDateTime(txttodate.Text.Trim(), info); DataSet ds = new DataSet(); string selectedCust = getSelectedCustomer(); if (rdodelivery.SelectedIndex == 0) { if (grdTemp.Rows.Count == 0) { ds = G_GetPass.Out_Transporter_Report("C", _objfdate, _objtdate, "A", Convert.ToInt32(strFY), selectedCust); } else { ds = G_GetPass.Out_Transporter_Report("C", _objfdate, _objtdate, "A", Convert.ToInt32(strFY), selectedCust); } } else if (rdodelivery.SelectedIndex == 1) { if (grdTemp.Rows.Count == 0) { ds = G_GetPass.Out_Transporter_Report("C", _objfdate, _objtdate, "P", Convert.ToInt32(strFY), selectedCust); } else { ds = G_GetPass.Out_Transporter_Report("C", _objfdate, _objtdate, "P", Convert.ToInt32(strFY), selectedCust); } } else if (rdodelivery.SelectedIndex == 2) { if (grdTemp.Rows.Count == 0) { ds = G_GetPass.Out_Transporter_Report("C", _objfdate, _objtdate, "C", Convert.ToInt32(strFY), selectedCust); } else { ds = G_GetPass.Out_Transporter_Report("C", _objfdate, _objtdate, "C", Convert.ToInt32(strFY), selectedCust); } } ViewState["OutCustomerRep"] = ds.Tables[0]; } if (ViewState["OutCustomerRep"] != null) { try { rd.Load(Server.MapPath("Godown/reports/Customer_C_Details.rpt")); rd.Database.Tables[0].SetDataSource((DataTable)ViewState["OutCustomerRep"]); OutCustomer.ReportSource = rd; } catch { } } }
public void fillDataDocNo(int isNew) { DateTimeFormatInfo info = new DateTimeFormatInfo(); info.ShortDatePattern = "dd/MM/yyyy"; info.DateSeparator = "/"; ReportDocument rd = new ReportDocument(); if (isNew == 1) { DataSet ds = new DataSet(); fdcno = txtfdocno.Text.Trim(); tdcno = txttdocno.Text.Trim(); if (rdoview.Items[0].Selected == true) { if (rdoview1.Items[0].Selected == true) { fdcno = txtfdocno.Text.Trim(); tdcno = txttdocno.Text.Trim(); ds = G_GetPass.LocalOut_PassReport("L", "dcno", Convert.ToInt32(fdcno), Convert.ToInt32(tdcno), System.DateTime.Now, System.DateTime.Now, Convert.ToInt32(strFY)); } else if (rdoview1.Items[1].Selected == true) { DateTime _objfdate = Convert.ToDateTime(txtfromdate.Text.Trim(), info); DateTime _objtdate = Convert.ToDateTime(txttodate.Text.Trim(), info); ds = G_GetPass.LocalOut_PassReport("L", "", 0, 0, _objfdate, _objtdate, Convert.ToInt32(strFY)); } else if (rdoview1.Items[2].Selected == true) { fdcno = txtfdocno.Text.Trim(); tdcno = txttdocno.Text.Trim(); ds = G_GetPass.LocalOut_PassReport("L", "orgdcno", Convert.ToInt32(fdcno), Convert.ToInt32(tdcno), System.DateTime.Now, System.DateTime.Now, Convert.ToInt32(strFY)); } } else if (rdoview.Items[1].Selected == true) { if (rdoview1.Items[0].Selected == true) { fdcno = txtfdocno.Text.Trim(); tdcno = txttdocno.Text.Trim(); ds = G_GetPass.LocalOut_PassReport("O", "dcno", Convert.ToInt32(fdcno), Convert.ToInt32(tdcno), System.DateTime.Now, System.DateTime.Now, Convert.ToInt32(strFY)); } else if (rdoview1.Items[1].Selected == true) { DateTime _objfdate = Convert.ToDateTime(txtfromdate.Text.Trim(), info); DateTime _objtdate = Convert.ToDateTime(txttodate.Text.Trim(), info); ds = G_GetPass.LocalOut_PassReport("O", "", 0, 0, _objfdate, _objtdate, Convert.ToInt32(strFY)); } else if (rdoview1.Items[2].Selected == true) { fdcno = txtfdocno.Text.Trim(); tdcno = txttdocno.Text.Trim(); ds = G_GetPass.LocalOut_PassReport("O", "orgdcno", Convert.ToInt32(fdcno), Convert.ToInt32(tdcno), System.DateTime.Now, System.DateTime.Now, Convert.ToInt32(strFY)); } } ViewState["DocNoRep"] = ds.Tables[0]; } if (ViewState["DocNoRep"] != null) { try { if (rdoview.Items[0].Selected == true) { rd.Load(Server.MapPath("Godown/reports/GetPass_Local_Report.rpt")); rd.Database.Tables[0].SetDataSource((DataTable)ViewState["DocNoRep"]); LocalOutDocNo.ReportSource = rd; } else if (rdoview.Items[1].Selected == true) { rd.Load(Server.MapPath("Godown/reports/GetPass_Out_Report.rpt")); rd.Database.Tables[0].SetDataSource((DataTable)ViewState["DocNoRep"]); LocalOutDocNo.ReportSource = rd; } } catch { } } }
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()); } }
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()); } }