public int DeleteDownPaymentToSupplier(DownPaymentToSupplierFormUI downPaymentToSupplierFormUI) { int resutl = 0; resutl = downPaymentToSupplierFormDAL.DeleteDownPaymentToSupplier(downPaymentToSupplierFormUI); return(resutl); }
public int DeleteDownPaymentToSupplier(DownPaymentToSupplierFormUI downPaymentToSupplierFormUI) { int result = 0; try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SupportCon.Open(); SqlCommand sqlCmd = new SqlCommand("SP_DownPaymentToSupplier_Delete", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@tbl_DownPaymentToSupplierId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_DownPaymentToSupplierId"].Value = downPaymentToSupplierFormUI.Tbl_DownPaymentToSupplierId; result = sqlCmd.ExecuteNonQuery(); sqlCmd.Dispose(); SupportCon.Close(); } } catch (Exception exp) { logExcpUIobj.MethodName = "DeleteDownPaymentToSupplier()"; logExcpUIobj.ResourceName = "DownPaymentToSupplierFormDAL.CS"; logExcpUIobj.RecordId = downPaymentToSupplierFormUI.Tbl_DownPaymentToSupplierId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[DownPaymentToSupplierFormDAL : DeleteDownPaymentToSupplier] An error occured in the processing of Record Id : " + downPaymentToSupplierFormUI.Tbl_DownPaymentToSupplierId + ". Details : [" + exp.ToString() + "]"); } return(result); }
public DataTable GetDownPaymentToSupplierListById(DownPaymentToSupplierFormUI downPaymentToSupplierFormUI) { DataTable dtb = new DataTable(); dtb = downPaymentToSupplierFormDAL.GetDownPaymentToSupplierListById(downPaymentToSupplierFormUI); return(dtb); }
protected void Page_Load(object sender, EventArgs e) { DownPaymentToSupplierFormUI downPaymentToSupplierFormUI = new DownPaymentToSupplierFormUI(); if (!Page.IsPostBack) { if (Request.QueryString["DownPaymentToSupplierId"] != null) { downPaymentToSupplierFormUI.Tbl_DownPaymentToSupplierId = Request.QueryString["DownPaymentToSupplierId"]; BindDocumentTypeDropDownList(); FillForm(downPaymentToSupplierFormUI); btnSave.Visible = false; btnClear.Visible = false; btnUpdate.Visible = true; btnDelete.Visible = true; btnApply.Visible = true; btnDistribution.Visible = true; lblHeading.Text = "Update Down Payment To Supplier"; } else { btnSave.Visible = true; btnClear.Visible = true; btnUpdate.Visible = false; btnDelete.Visible = false; btnApply.Visible = false; btnDistribution.Visible = false; lblHeading.Text = "Add New Down Payment To Supplier"; } } }
private void FillForm(DownPaymentToSupplierFormUI downPaymentToSupplierFormUI) { try { DataTable dtb = downPaymentToSupplierFormBAL.GetDownPaymentToSupplierListById(downPaymentToSupplierFormUI); if (dtb.Rows.Count > 0) { txtBatchGuid.Text = dtb.Rows[0]["tbl_BatchId"].ToString(); txtBatch.Text = dtb.Rows[0]["BatchName"].ToString(); txtCurrencyGuid.Text = dtb.Rows[0]["tbl_CurrencyId"].ToString(); txtCurrency.Text = dtb.Rows[0]["CurrencyName"].ToString(); txtPayablesBankGuid.Text = dtb.Rows[0]["tbl_PayablesId_BankTransfer"].ToString(); txtPayablesBank.Text = dtb.Rows[0]["BankName"].ToString(); txtPayablesCashGuid.Text = dtb.Rows[0]["tbl_PayablesId_Cash"].ToString(); txtPayablesCash.Text = dtb.Rows[0]["PayablesTypeCash"].ToString(); txtPayablesChequeGuid.Text = dtb.Rows[0]["tbl_PayablesId_Cheque"].ToString(); txtPayablesCheque.Text = dtb.Rows[0]["PayablesTypeCheque"].ToString(); txtSupplierGuid.Text = dtb.Rows[0]["tbl_SupplierId"].ToString(); txtSupplier.Text = dtb.Rows[0]["SupplierName"].ToString(); txtPayablesCreditCardGuid.Text = dtb.Rows[0]["tbl_PayablesId_CreditCard"].ToString(); txtPayablesCreditCard.Text = dtb.Rows[0]["CardName"].ToString(); txtSourceDocumentGuid.Text = dtb.Rows[0]["tbl_SourceDocumentId"].ToString(); txtSourceDocument.Text = dtb.Rows[0]["tbl_SourceDocument"].ToString(); txtTotal.Text = dtb.Rows[0]["Total"].ToString(); txtBankTransferAmount.Text = dtb.Rows[0]["BankTransferAmount"].ToString(); txtCashAmount.Text = dtb.Rows[0]["CashAmount"].ToString(); txtChequeAmount.Text = dtb.Rows[0]["ChequeAmount"].ToString(); txtCreditCardAmount.Text = dtb.Rows[0]["CreditCardAmount"].ToString(); txtPaymentNumber.Text = dtb.Rows[0]["PaymentNumber"].ToString(); txtPaymentDate.Text = dtb.Rows[0]["PaymentDate"].ToString(); txtApplied.Text = dtb.Rows[0]["Applied"].ToString(); txtUnapplied.Text = dtb.Rows[0]["Unapplied"].ToString(); chkIsAutoAppliyTo.Checked = Convert.ToBoolean(dtb.Rows[0]["IsAutoAppliyTo"].ToString()); chkIsPosted.Checked = Convert.ToBoolean(dtb.Rows[0]["IsPosted"].ToString()); txtPostingDate.Text = dtb.Rows[0]["PostingDate"].ToString(); txtDocumentNumber.Text = dtb.Rows[0]["DocumentNumber"].ToString(); txtComments.Text = dtb.Rows[0]["Comments"].ToString(); txtApplyDate.Text = dtb.Rows[0]["ApplyDate"].ToString(); ddlOpt_DocumentType.SelectedValue = dtb.Rows[0]["DocumentType"].ToString(); } else { lblError.Text = Resources.GlobalResource.msgCouldNotLoadData; divError.Visible = true; } } catch (Exception exp) { logExcpUIobj.MethodName = "FillForm()"; logExcpUIobj.ResourceName = "Finance_Bank_Accounting_Down_Payment_Suppliers_DownPaymentToSupplierForm.CS"; logExcpUIobj.RecordId = downPaymentToSupplierFormUI.Tbl_DownPaymentToSupplierId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[Finance_Bank_Accounting_Down_Payment_Suppliers_DownPaymentToSupplierForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]"); } }
public DataTable GetDownPaymentToSupplierListById(DownPaymentToSupplierFormUI downPaymentToSupplierFormUI) { DataSet ds = new DataSet(); DataTable dtbl = new DataTable(); try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SqlCommand sqlCmd = new SqlCommand("SP_DownPaymentToSupplier_SelectById", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@tbl_DownPaymentToSupplierId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_DownPaymentToSupplierId"].Value = downPaymentToSupplierFormUI.Tbl_DownPaymentToSupplierId; using (SqlDataAdapter adapter = new SqlDataAdapter(sqlCmd)) { adapter.Fill(ds); } } if (ds.Tables.Count > 0) { dtbl = ds.Tables[0]; } } catch (Exception exp) { logExcpUIobj.MethodName = "GetDownPaymentToSupplierListById()"; logExcpUIobj.ResourceName = "DownPaymentToSupplierFormDAL.CS"; logExcpUIobj.RecordId = downPaymentToSupplierFormUI.Tbl_DownPaymentToSupplierId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[DownPaymentToSupplierFormDAL : GetDownPaymentToSupplierListById] An error occured in the processing of Record Id : " + downPaymentToSupplierFormUI.Tbl_DownPaymentToSupplierId + ". Details : [" + exp.ToString() + "]"); } finally { ds.Dispose(); } return(dtbl); }
public int AddDownPaymentToSupplier(DownPaymentToSupplierFormUI downPaymentToSupplierFormUI) { int result = 0; try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SupportCon.Open(); SqlCommand sqlCmd = new SqlCommand("SP_DownPaymentToSupplier_Insert", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar); sqlCmd.Parameters["@CreatedBy"].Value = downPaymentToSupplierFormUI.CreatedBy; sqlCmd.Parameters.Add("@tbl_OrganizationId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_OrganizationId"].Value = downPaymentToSupplierFormUI.Tbl_OrganizationId; sqlCmd.Parameters.Add("@PaymentNumber", SqlDbType.NVarChar); sqlCmd.Parameters["@PaymentNumber"].Value = downPaymentToSupplierFormUI.PaymentNumber; sqlCmd.Parameters.Add("@PaymentDate", SqlDbType.DateTime); sqlCmd.Parameters["@PaymentDate"].Value = downPaymentToSupplierFormUI.PaymentDate; sqlCmd.Parameters.Add("@tbl_BatchId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_BatchId"].Value = downPaymentToSupplierFormUI.Tbl_BatchId; sqlCmd.Parameters.Add("@tbl_SupplierId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_SupplierId"].Value = downPaymentToSupplierFormUI.Tbl_SupplierId; sqlCmd.Parameters.Add("@tbl_CurrencyId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_CurrencyId"].Value = downPaymentToSupplierFormUI.Tbl_CurrencyId; sqlCmd.Parameters.Add("@tbl_PayablesId_BankTransfer", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_PayablesId_BankTransfer"].Value = downPaymentToSupplierFormUI.Tbl_PayablesId_BankTransfer; sqlCmd.Parameters.Add("@BankTransferAmount", SqlDbType.Decimal); sqlCmd.Parameters["@BankTransferAmount"].Value = downPaymentToSupplierFormUI.BankTransferAmount; sqlCmd.Parameters.Add("@tbl_PayablesId_Cash", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_PayablesId_Cash"].Value = downPaymentToSupplierFormUI.Tbl_PayablesId_Cash; sqlCmd.Parameters.Add("@CashAmount", SqlDbType.Decimal); sqlCmd.Parameters["@CashAmount"].Value = downPaymentToSupplierFormUI.CashAmount; sqlCmd.Parameters.Add("@tbl_PayablesId_Cheque", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_PayablesId_Cheque"].Value = downPaymentToSupplierFormUI.Tbl_PayablesId_Cheque; sqlCmd.Parameters.Add("@ChequeAmount", SqlDbType.Decimal); sqlCmd.Parameters["@ChequeAmount"].Value = downPaymentToSupplierFormUI.ChequeAmount; sqlCmd.Parameters.Add("@tbl_PayablesId_CreditCard", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_PayablesId_CreditCard"].Value = downPaymentToSupplierFormUI.Tbl_PayablesId_CreditCard; sqlCmd.Parameters.Add("@CreditCardAmount", SqlDbType.Decimal); sqlCmd.Parameters["@CreditCardAmount"].Value = downPaymentToSupplierFormUI.CreditCardAmount; sqlCmd.Parameters.Add("@DocumentNumber", SqlDbType.NVarChar); sqlCmd.Parameters["@DocumentNumber"].Value = downPaymentToSupplierFormUI.DocumentNumber; sqlCmd.Parameters.Add("@Comments", SqlDbType.NVarChar); sqlCmd.Parameters["@Comments"].Value = downPaymentToSupplierFormUI.Comments; sqlCmd.Parameters.Add("@Unapplied", SqlDbType.Decimal); sqlCmd.Parameters["@Unapplied"].Value = downPaymentToSupplierFormUI.Unapplied; sqlCmd.Parameters.Add("@Applied", SqlDbType.Decimal); sqlCmd.Parameters["@Applied"].Value = downPaymentToSupplierFormUI.Applied; sqlCmd.Parameters.Add("@Total", SqlDbType.Decimal); sqlCmd.Parameters["@Total"].Value = downPaymentToSupplierFormUI.Total; sqlCmd.Parameters.Add("@IsAutoAppliyTo", SqlDbType.Bit); sqlCmd.Parameters["@IsAutoAppliyTo"].Value = downPaymentToSupplierFormUI.IsAutoAppliyTo; sqlCmd.Parameters.Add("@IsPosted", SqlDbType.Bit); sqlCmd.Parameters["@IsPosted"].Value = downPaymentToSupplierFormUI.IsPosted; sqlCmd.Parameters.Add("@PostingDate", SqlDbType.DateTime); sqlCmd.Parameters["@PostingDate"].Value = downPaymentToSupplierFormUI.PostingDate; sqlCmd.Parameters.Add("@ApplyDate", SqlDbType.DateTime); sqlCmd.Parameters["@ApplyDate"].Value = downPaymentToSupplierFormUI.ApplyDate; sqlCmd.Parameters.Add("@tbl_SourceDocumentId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_SourceDocumentId"].Value = downPaymentToSupplierFormUI.Tbl_SourceDocumentId; sqlCmd.Parameters.Add("@opt_DocumentType", SqlDbType.Int); sqlCmd.Parameters["@opt_DocumentType"].Value = downPaymentToSupplierFormUI.opt_DocumentType; result = sqlCmd.ExecuteNonQuery(); sqlCmd.Dispose(); SupportCon.Close(); } } catch (Exception exp) { logExcpUIobj.MethodName = "AddDownPaymentToSupplier()"; logExcpUIobj.ResourceName = "DownPaymentToSupplierFormDAL.CS"; logExcpUIobj.RecordId = ""; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[DownPaymentToSupplierFormDAL : AddDownPaymentToSupplier] An error occured in the processing of Record. Details : [" + exp.ToString() + "]"); } return(result); }
protected void btnUpdate_Click(object sender, EventArgs e) { DownPaymentToSupplierFormUI downPaymentToSupplierFormUI = new DownPaymentToSupplierFormUI(); try { downPaymentToSupplierFormUI.ModifiedBy = SessionContext.UserGuid; downPaymentToSupplierFormUI.Tbl_OrganizationId = SessionContext.OrganizationId; downPaymentToSupplierFormUI.Tbl_BatchId = txtBatchGuid.Text; downPaymentToSupplierFormUI.Tbl_CurrencyId = txtCurrencyGuid.Text; downPaymentToSupplierFormUI.Tbl_SupplierId = txtSupplierGuid.Text; downPaymentToSupplierFormUI.Tbl_PayablesId_BankTransfer = txtPayablesBankGuid.Text; downPaymentToSupplierFormUI.Tbl_PayablesId_Cash = txtPayablesCashGuid.Text; downPaymentToSupplierFormUI.Tbl_PayablesId_Cheque = txtPayablesChequeGuid.Text; downPaymentToSupplierFormUI.Tbl_PayablesId_CreditCard = txtPayablesCreditCardGuid.Text; downPaymentToSupplierFormUI.Tbl_SourceDocumentId = txtSourceDocumentGuid.Text; downPaymentToSupplierFormUI.PaymentNumber = txtPaymentNumber.Text; downPaymentToSupplierFormUI.PaymentDate = DateTime.Parse(txtPaymentDate.Text.ToString()); downPaymentToSupplierFormUI.BankTransferAmount = Convert.ToDecimal(txtBankTransferAmount.Text); downPaymentToSupplierFormUI.CashAmount = Convert.ToDecimal(txtCashAmount.Text); downPaymentToSupplierFormUI.ChequeAmount = Convert.ToDecimal(txtChequeAmount.Text); downPaymentToSupplierFormUI.CreditCardAmount = Convert.ToDecimal(txtCreditCardAmount.Text); downPaymentToSupplierFormUI.DocumentNumber = txtDocumentNumber.Text; downPaymentToSupplierFormUI.PostingDate = DateTime.Parse(txtPostingDate.Text.ToString()); downPaymentToSupplierFormUI.Comments = txtComments.Text; downPaymentToSupplierFormUI.Unapplied = Decimal.Parse(txtUnapplied.Text.ToString()); downPaymentToSupplierFormUI.Applied = Decimal.Parse(txtApplied.Text.ToString()); downPaymentToSupplierFormUI.Total = Convert.ToDecimal(txtTotal.Text); downPaymentToSupplierFormUI.Tbl_DownPaymentToSupplierId = Request.QueryString["DownPaymentToSupplierId"]; if (chkIsAutoAppliyTo.Checked) { downPaymentToSupplierFormUI.IsAutoAppliyTo = true; } else { downPaymentToSupplierFormUI.IsAutoAppliyTo = false; } if (chkIsPosted.Checked) { downPaymentToSupplierFormUI.IsPosted = true; } else { downPaymentToSupplierFormUI.IsPosted = false; } downPaymentToSupplierFormUI.ApplyDate = DateTime.Parse(txtApplyDate.Text.ToString()); downPaymentToSupplierFormUI.opt_DocumentType = int.Parse(ddlOpt_DocumentType.SelectedValue.ToString()); if (downPaymentToSupplierFormBAL.UpdateDownPaymentToSupplier(downPaymentToSupplierFormUI) == 1) { divSuccess.Visible = true; divError.Visible = false; lblSuccess.Text = Resources.GlobalResource.msgRecordUpdatedSuccessfully; this.Page.ClientScript.RegisterStartupScript(this.GetType(), "clearform", "ClearForm();", true); } else { divError.Visible = true; divSuccess.Visible = false; lblError.Text = Resources.GlobalResource.msgCouldNotUpdateRecord; this.Page.ClientScript.RegisterStartupScript(this.GetType(), "clearform", "ClearForm();", true); } } catch (Exception exp) { logExcpUIobj.MethodName = "btnUpdate_Click()"; logExcpUIobj.ResourceName = "Finance_Bank_Accounting_Down_Payment_Suppliers_DownPaymentToSupplierForm.CS"; logExcpUIobj.RecordId = ""; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[Finance_Bank_Accounting_Down_Payment_Suppliers_DownPaymentToSupplierForm : btnUpdate_Click] An error occured in the processing of Record Id : " + downPaymentToSupplierFormUI.Tbl_DownPaymentToSupplierId + ". Details : [" + exp.ToString() + "]"); } }