public int DeletePaymentTerms(PaymentTermsFormUI paymentTermsFormUI) { int resutl = 0; resutl = paymentTermsFormDAL.DeletePaymentTerms(paymentTermsFormUI); return(resutl); }
public int AddPaymentTerms(PaymentTermsFormUI paymentTermsFormUI) { int resutl = 0; resutl = paymentTermsFormDAL.AddPaymentTerms(paymentTermsFormUI); return(resutl); }
public DataTable GetPaymentTermsListById(PaymentTermsFormUI paymentTermsFormUI) { DataTable dtb = new DataTable(); dtb = paymentTermsFormDAL.GetPaymentTermsListById(paymentTermsFormUI); return(dtb); }
protected override void Page_Load(object sender, EventArgs e) { PaymentTermsFormUI paymentTermsFormUI = new PaymentTermsFormUI(); if (!Page.IsPostBack) { BindDiscountTypeDropDownList(); if (Request.QueryString["PaymentTerms_Id"] != null) { paymentTermsFormUI.Tbl_PaymentTermsId = Request.QueryString["PaymentTerms_Id"]; BindDiscountTypeDropDownList(); FillForm(paymentTermsFormUI); btnSave.Visible = false; btnClear.Visible = false; btnUpdate.Visible = true; btnDelete.Visible = true; lblHeading.Text = "Update PaymentTerm"; } else { BindDiscountTypeDropDownList(); btnSave.Visible = true; btnClear.Visible = true; btnUpdate.Visible = false; btnDelete.Visible = false; lblHeading.Text = "Add New PaymentTerm"; } } }
private void FillForm(PaymentTermsFormUI paymentTermsFormUI) { try { DataTable dtb = paymentTermsFormBAL.GetPaymentTermsListById(paymentTermsFormUI); if (dtb.Rows.Count > 0) { txtDiscountInDays.Text = dtb.Rows[0]["DiscountInDays"].ToString(); txtDiscountTypeValue.Text = dtb.Rows[0]["DiscountTypeValue"].ToString(); txtDueInDays.Text = dtb.Rows[0]["DueInDays"].ToString(); txtName.Text = dtb.Rows[0]["PaymentTermsName"].ToString(); ddlOpt_DiscountType.SelectedValue = dtb.Rows[0]["Opt_DiscountType"].ToString(); chkSalesOrPurchase.Checked = Convert.ToBoolean(dtb.Rows[0]["SalesOrPurchase"].ToString()); } else { lblError.Text = Resources.GlobalResource.msgCouldNotLoadData; divError.Visible = true; } } catch (Exception exp) { logExcpUIobj.MethodName = "FillForm()"; logExcpUIobj.ResourceName = "Finance_Accounts_Payable_Supplier_Master_Creation_PaymentTermsForm.CS"; logExcpUIobj.RecordId = this.paymentTermsFormUI.Tbl_PaymentTermsId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[Finance_Accounts_Payable_Supplier_Master_Creation_PaymentTermsForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]"); } }
public int UpdatePaymentTerms(PaymentTermsFormUI paymentTermsFormUI) { int result = 0; try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SupportCon.Open(); SqlCommand sqlCmd = new SqlCommand("SP_PaymentTerms_Update", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@tbl_PaymentTermsId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_PaymentTermsId"].Value = paymentTermsFormUI.Tbl_PaymentTermsId; sqlCmd.Parameters.Add("@ModifiedBy", SqlDbType.NVarChar); sqlCmd.Parameters["@ModifiedBy"].Value = paymentTermsFormUI.ModifiedBy; sqlCmd.Parameters.Add("@tbl_OrganizationId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_OrganizationId"].Value = paymentTermsFormUI.Tbl_OrganizationId; sqlCmd.Parameters.Add("@PaymentTermsName", SqlDbType.NVarChar); sqlCmd.Parameters["@PaymentTermsName"].Value = paymentTermsFormUI.PaymentTermsName; sqlCmd.Parameters.Add("@DueInDays", SqlDbType.Int); sqlCmd.Parameters["@DueInDays"].Value = paymentTermsFormUI.DueInDays; sqlCmd.Parameters.Add("@DiscountInDays", SqlDbType.Int); sqlCmd.Parameters["@DiscountInDays"].Value = paymentTermsFormUI.DiscountInDays; sqlCmd.Parameters.Add("@Opt_DiscountType", SqlDbType.TinyInt); sqlCmd.Parameters["@Opt_DiscountType"].Value = paymentTermsFormUI.Opt_DiscountType; sqlCmd.Parameters.Add("@DiscountTypeValue", SqlDbType.Decimal); sqlCmd.Parameters["@DiscountTypeValue"].Value = paymentTermsFormUI.DiscountTypeValue; sqlCmd.Parameters.Add("@SalesOrPurchase", SqlDbType.Bit); sqlCmd.Parameters["@SalesOrPurchase"].Value = paymentTermsFormUI.SalesOrPurchase; result = sqlCmd.ExecuteNonQuery(); sqlCmd.Dispose(); SupportCon.Close(); } } catch (Exception exp) { logExcpUIobj.MethodName = "UpdatePaymentTerms()"; logExcpUIobj.ResourceName = "PaymentTermsFormDAL.CS"; logExcpUIobj.RecordId = paymentTermsFormUI.Tbl_PaymentTermsId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[PaymentTermsFormDAL : UpdatePaymentTerms] An error occured in the processing of Record Id : " + paymentTermsFormUI.Tbl_PaymentTermsId + ". Details : [" + exp.ToString() + "]"); } return(result); }
protected void btnUpdate_Click(object sender, EventArgs e) { PaymentTermsFormUI paymentTermsFormUI = new PaymentTermsFormUI(); try { paymentTermsFormUI.ModifiedBy = SessionContext.UserGuid; paymentTermsFormUI.Tbl_OrganizationId = SessionContext.OrganizationId; paymentTermsFormUI.PaymentTermsName = txtName.Text; paymentTermsFormUI.DiscountTypeValue = decimal.Parse(txtDiscountTypeValue.Text); paymentTermsFormUI.Opt_DiscountType = int.Parse(ddlOpt_DiscountType.SelectedValue); paymentTermsFormUI.DueInDays = int.Parse(txtDueInDays.Text); paymentTermsFormUI.DiscountInDays = int.Parse(txtDiscountInDays.Text); paymentTermsFormUI.Tbl_PaymentTermsId = Request.QueryString["PaymentTerms_Id"]; if (chkSalesOrPurchase.Checked) { paymentTermsFormUI.SalesOrPurchase = true; } else { paymentTermsFormUI.SalesOrPurchase = false; } if (paymentTermsFormBAL.UpdatePaymentTerms(paymentTermsFormUI) == 1) { divSuccess.Visible = true; divError.Visible = false; lblSuccess.Text = Resources.GlobalResource.msgRecordUpdatedSuccessfully; paymentTermsFormUI.Tbl_PaymentTermsId = Request.QueryString["PaymentTerms_Id"]; BindDiscountTypeDropDownList(); FillForm(paymentTermsFormUI); } else { divError.Visible = true; divSuccess.Visible = false; lblError.Text = Resources.GlobalResource.msgCouldNotUpdateRecord; } } catch (Exception exp) { logExcpUIobj.MethodName = "btnUpdate_Click()"; logExcpUIobj.ResourceName = "Finance_Accounts_Payable_Supplier_Master_Creation_PaymentTermsForm.CS"; logExcpUIobj.RecordId = ""; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[Finance_Accounts_Payable_Supplier_Master_Creation_PaymentTermsForm : btnUpdate_Click] An error occured in the processing of Record Id : " + paymentTermsFormUI.Tbl_PaymentTermsId + ". Details : [" + exp.ToString() + "]"); } }
public DataTable GetPaymentTermsListById(PaymentTermsFormUI paymentTermsFormUI) { DataSet ds = new DataSet(); DataTable dtbl = new DataTable(); try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SqlCommand sqlCmd = new SqlCommand("SP_PaymentTerms_SelectById", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@tbl_PaymentTermsId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_PaymentTermsId"].Value = paymentTermsFormUI.Tbl_PaymentTermsId; using (SqlDataAdapter adapter = new SqlDataAdapter(sqlCmd)) { adapter.Fill(ds); } } if (ds.Tables.Count > 0) { dtbl = ds.Tables[0]; } } catch (Exception exp) { logExcpUIobj.MethodName = "getPaymentTermsListById()"; logExcpUIobj.ResourceName = "PaymentTermsFormDAL.CS"; logExcpUIobj.RecordId = paymentTermsFormUI.Tbl_PaymentTermsId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[PaymentTermsFormDAL : getPaymentTermsListById] An error occured in the processing of Record Id : " + paymentTermsFormUI.Tbl_PaymentTermsId + ". Details : [" + exp.ToString() + "]"); } finally { ds.Dispose(); } return(dtbl); }
public int DeletePaymentTerms(PaymentTermsFormUI paymentTermsFormUI) { int result = 0; try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SupportCon.Open(); SqlCommand sqlCmd = new SqlCommand("SP_PaymentTerms_Delete", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@tbl_PaymentTermsId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_PaymentTermsId"].Value = paymentTermsFormUI.Tbl_PaymentTermsId; result = sqlCmd.ExecuteNonQuery(); sqlCmd.Dispose(); SupportCon.Close(); } } catch (Exception exp) { logExcpUIobj.MethodName = "DeletePaymentTerms()"; logExcpUIobj.ResourceName = "PaymentTermsFormDAL.CS"; logExcpUIobj.RecordId = paymentTermsFormUI.Tbl_PaymentTermsId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[PaymentTermsFormDAL : DeletePaymentTerms] An error occured in the processing of Record Id : " + paymentTermsFormUI.Tbl_PaymentTermsId + ". Details : [" + exp.ToString() + "]"); } return(result); }