protected void UpdateButton_Click(object sender, EventArgs e) { try { if (Page.IsValid) { string connection = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString(); int CustomerID = 0; int ServiceID = 0; DateTime DueDate; DateTime VisitDate; string VisitDetails = string.Empty; double Amount = 0.0; int PayMode; string Visited; string CreditCardNo; int iBank = 0; GridViewRow row = GrdViewSerVisit.SelectedRow; int VisitID = Convert.ToInt32(GrdViewSerVisit.SelectedDataKey.Value); CustomerID = int.Parse(drpCustomer.SelectedValue); ServiceID = int.Parse(hdServiceID.Value.ToString()); DueDate = DateTime.Parse(txtDueDate.Text); VisitDate = DateTime.Parse(txtVisitDate.Text); VisitDetails = txtDetials.Text; Amount = double.Parse(txtAmount.Text); PayMode = int.Parse(drpPaymode.SelectedValue); Visited = chkVisited.Checked.ToString(); CreditCardNo = txtCreditCardNo.Text; iBank = int.Parse(drpBankName.SelectedValue); BusinessLogic bl = new BusinessLogic(sDataSource); try { bl.UpdateServiceVisit(connection, VisitID, CustomerID, ServiceID, DueDate, VisitDate, VisitDetails, Amount, PayMode, Visited, CreditCardNo, iBank); //MyAccordion.Visible = true; pnlVisitDetails.Visible = false; lnkBtnAdd.Visible = true; Reset(); GrdViewSerVisit.DataBind(); GrdViewSerVisit.Visible = true; ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Service Visit Details Saved Successfully.');", true); return; } catch (Exception ex) { ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Exception Occured: " + ex.Message + "')", true); } } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }
protected void SaveButton_Click(object sender, EventArgs e) { try { Page.Validate("salesval"); if (Page.IsValid) { string connection = ConfigurationManager.ConnectionStrings[Request.Cookies["Company"].Value].ToString(); int dcatid = 0; string AccountNo = string.Empty; int dopening = 0; string ditemCode = string.Empty; string dProductName = string.Empty; string dProductDesc = string.Empty; string dmodel = string.Empty; string Username = Request.Cookies["LoggedUserName"].Value; BusinessLogic bl = new BusinessLogic(sDataSource); double dlnAmt = 0; double dpurAmt = 0; double ddochr = 0; double dintamt = 0; double dfinpay = 0; double dnoinst = 0; double dpay = 0; double deachpay = 0; string txtoth = string.Empty; string sBilldate = string.Empty; string dpaydate = string.Empty; string dstartdate = string.Empty; string sCustomerName = string.Empty; int sCustomerID = 0; sBilldate = txtBillDate.Text.Trim(); dlnAmt = Convert.ToDouble(Txtlnamt.Text); sCustomerName = cmbCustomer.SelectedItem.Text; sCustomerID = Convert.ToInt32(cmbCustomer.SelectedItem.Value); dpurAmt = Convert.ToDouble(txtpuramt.Text); ddochr = Convert.ToDouble(txtdocchr.Text); dintamt = Convert.ToDouble(txtintamt.Text); dfinpay = Convert.ToDouble(txtfinpay.Text); dnoinst = Convert.ToDouble(txtnoinst1.Text); txtoth = txtothers.Text; dpay = Convert.ToDouble(txtinipay.Text); dpaydate = txtdatepay.Text.Trim(); dstartdate = txtduedate.Text.Trim(); deachpay = Convert.ToDouble(Txteach.Text); try { //int billNo = bl.InsertHirePurchase(sBilldate, sCustomerID, sCustomerName, dpurAmt,dlnAmt, ddochr, dintamt, dfinpay, dnoinst, txtoth,dpay,dpaydate,dstartdate,deachpay, Username); //pnlVisitDetails.Visible = false; ModalPopupExtender1.Hide(); lnkBtnAdd.Visible = true; Reset(); GrdViewSerVisit.DataBind(); GrdViewSerVisit.Visible = true; ScriptManager.RegisterStartupScript(Page, Page.GetType(), Guid.NewGuid().ToString(), "alert('Hire Purchase added successfully ');", true); return; } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } } } catch (Exception ex) { TroyLiteExceptionManager.HandleException(ex); } }