public int UpdateSupplier(SupplierFormUI supplierFormUI) { int resutl = 0; resutl = supplierFormDAL.UpdateSupplier(supplierFormUI); return(resutl); }
public int DeleteSupplier(SupplierFormUI supplierFormUI) { int resutl = 0; resutl = supplierFormDAL.DeleteSupplier(supplierFormUI); return(resutl); }
public DataTable GetSupplierListById(SupplierFormUI supplierFormUI) { DataTable dtb = new DataTable(); dtb = supplierFormDAL.GetSupplierListById(supplierFormUI); return(dtb); }
public int AddSupplier(SupplierFormUI supplierFormUI) { int resutl = 0; resutl = supplierFormDAL.AddSupplier(supplierFormUI); return(resutl); }
protected override void Page_Load(object sender, EventArgs e) { SupplierFormUI supplierFormUI = new SupplierFormUI(); if (!Page.IsPostBack) { if (Request.QueryString["SupplierId"] != null) { supplierFormUI.Tbl_SupplierId = Request.QueryString["SupplierId"]; BindStatuDropDown(); FillForm(supplierFormUI); btnSave.Visible = false; btnClear.Visible = false; btnUpdate.Visible = true; btnDelete.Visible = true; lblHeading.Text = "Update Supplier"; } else { BindStatuDropDown(); btnSave.Visible = true; btnClear.Visible = true; btnUpdate.Visible = false; btnDelete.Visible = false; lblHeading.Text = "Add New Supplier"; } } }
protected void btnDelete_Click(object sender, EventArgs e) { SupplierFormUI supplierFormUI = new SupplierFormUI(); try { supplierFormUI.Tbl_SupplierId = Request.QueryString["SupplierId"]; if (supplierFormBAL.DeleteSupplier(supplierFormUI) == 1) { divSuccess.Visible = true; lblSuccess.Text = Resources.GlobalResource.msgRecordDeleteSuccessfully; this.Page.ClientScript.RegisterStartupScript(this.GetType(), "clearform", "ClearForm();", true); } else { divError.Visible = true; lblError.Text = Resources.GlobalResource.msgCouldNotDeleteRecord; this.Page.ClientScript.RegisterStartupScript(this.GetType(), "clearform", "ClearForm();", true); } } catch (Exception exp) { logExcpUIobj.MethodName = "btnDelete_Click()"; logExcpUIobj.ResourceName = "System_Settings_BatchForm.CS"; logExcpUIobj.RecordId = supplierFormUI.Tbl_SupplierId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[System_Settings_BatchForm : btnDelete_Click] An error occured in the processing of Record Id : " + supplierFormUI.Tbl_SupplierId + ". Details : [" + exp.ToString() + "]"); } }
protected void btnUpdate_Click(object sender, EventArgs e) { SupplierFormUI supplierFormUI = new SupplierFormUI(); try { supplierFormUI.ModifiedBy = SessionContext.UserGuid; supplierFormUI.Tbl_OrganizationId = SessionContext.OrganizationId; supplierFormUI.Tbl_SupplierId = Request.QueryString["SupplierId"]; supplierFormUI.SupplierCode = txtSupplierCode.Text; supplierFormUI.Name = txtName.Text; supplierFormUI.ShortName = txtShortName.Text; supplierFormUI.ChequeName = txtChequeName.Text; supplierFormUI.Contact = txtContact.Text; supplierFormUI.Address = txtAddress.Text; supplierFormUI.City = txtCity.Text; supplierFormUI.ZipCode = txtZipCode.Text; supplierFormUI.Tbl_CountryId = txtCountryGuid.Text; supplierFormUI.Phone = txtPhone.Text; supplierFormUI.Mobile = txtMobile.Text; supplierFormUI.FaxNo = txtFaxNo.Text; supplierFormUI.Email = txtEmail.Text; supplierFormUI.Comment1 = txtComment1.Text; supplierFormUI.Comment2 = txtComment2.Text; supplierFormUI.Opt_Status = Convert.ToInt32(ddlStatus.SelectedValue); supplierFormUI.Tbl_SupplierGroupId = txtSupplierGroupGuid.Text; if (chkOnHold.Checked == true) { supplierFormUI.OnHold = true; } else { supplierFormUI.OnHold = false; } if (supplierFormBAL.UpdateSupplier(supplierFormUI) == 1) { divSuccess.Visible = true; lblSuccess.Text = Resources.GlobalResource.msgRecordUpdatedSuccessfully; } else { divError.Visible = true; lblError.Text = Resources.GlobalResource.msgCouldNotUpdateRecord; } } catch (Exception exp) { logExcpUIobj.MethodName = "btnUpdate_Click()"; logExcpUIobj.ResourceName = "System_Settings_BatchForm.CS"; logExcpUIobj.RecordId = supplierFormUI.Tbl_SupplierId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[System_Settings_BatchForm : btnUpdate_Click] An error occured in the processing of Record Id : " + supplierFormUI.Tbl_SupplierId + ". Details : [" + exp.ToString() + "]"); } }
private void FillForm(SupplierFormUI supplierFormUI) { try { DataTable dtb = supplierFormBAL.GetSupplierListById(supplierFormUI); if (dtb.Rows.Count > 0) { txtSupplierCode.Text = dtb.Rows[0]["SupplierCode"].ToString(); txtName.Text = dtb.Rows[0]["Name"].ToString(); txtShortName.Text = dtb.Rows[0]["ShortName"].ToString(); txtChequeName.Text = dtb.Rows[0]["ChequeName"].ToString(); txtContact.Text = dtb.Rows[0]["Contact"].ToString(); txtAddress.Text = dtb.Rows[0]["Address"].ToString(); txtCity.Text = dtb.Rows[0]["City"].ToString(); txtZipCode.Text = dtb.Rows[0]["ZipCode"].ToString(); txtCountryGuid.Text = dtb.Rows[0]["tbl_CountryId"].ToString(); txtCountry.Text = dtb.Rows[0]["CountryName"].ToString(); txtPhone.Text = dtb.Rows[0]["Phone"].ToString(); txtMobile.Text = dtb.Rows[0]["Mobile"].ToString(); txtFaxNo.Text = dtb.Rows[0]["FaxNo"].ToString(); txtEmail.Text = dtb.Rows[0]["Email"].ToString(); txtComment1.Text = dtb.Rows[0]["Comment1"].ToString(); txtComment2.Text = dtb.Rows[0]["Comment2"].ToString(); ddlStatus.SelectedValue = dtb.Rows[0]["Opt_Status"].ToString(); txtSupplierGroupGuid.Text = dtb.Rows[0]["tbl_SupplierGroupId"].ToString(); txtSupplierGroup.Text = dtb.Rows[0]["SupplierGroupName"].ToString(); if (Convert.ToBoolean(dtb.Rows[0]["OnHold"]) == true) { chkOnHold.Checked = true; } else { chkOnHold.Checked = false; } } else { lblError.Text = Resources.GlobalResource.msgCouldNotLoadData; divError.Visible = true; } } catch (Exception exp) { logExcpUIobj.MethodName = "FillForm()"; logExcpUIobj.ResourceName = "Finance_Accounts_Payable_Supplier_Supplier_Master_Creation_SupplierForm.CS"; logExcpUIobj.RecordId = supplierFormUI.Tbl_SupplierGroupId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[Finance_Accounts_Payable_Supplier_Supplier_Master_Creation_SupplierForm : FillForm] An error occured in the processing of Record Id : " + supplierFormUI.Tbl_SupplierGroupId + ". Details : [" + exp.ToString() + "]"); } }
public DataTable GetSupplierListById(SupplierFormUI supplierFormUI) { DataSet ds = new DataSet(); DataTable dtbl = new DataTable(); try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SqlCommand sqlCmd = new SqlCommand("SP_Supplier_SelectById", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@tbl_SupplierId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_SupplierId"].Value = supplierFormUI.Tbl_SupplierId; using (SqlDataAdapter adapter = new SqlDataAdapter(sqlCmd)) { adapter.Fill(ds); } } if (ds.Tables.Count > 0) { dtbl = ds.Tables[0]; } } catch (Exception exp) { logExcpUIobj.MethodName = "getSupplierListById()"; logExcpUIobj.ResourceName = "SupplierFormDAL.CS"; logExcpUIobj.RecordId = supplierFormUI.Tbl_SupplierId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[SupplierFormDAL : getSupplierListById] An error occured in the processing of Record Id : " + supplierFormUI.Tbl_SupplierId + ". Details : [" + exp.ToString() + "]"); } finally { ds.Dispose(); } return(dtbl); }
public int DeleteSupplier(SupplierFormUI supplierFormUI) { int result = 0; try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SupportCon.Open(); SqlCommand sqlCmd = new SqlCommand("SP_Supplier_Delete", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@tbl_SupplierId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_SupplierId"].Value = supplierFormUI.Tbl_SupplierId; result = sqlCmd.ExecuteNonQuery(); sqlCmd.Dispose(); SupportCon.Close(); } } catch (Exception exp) { logExcpUIobj.MethodName = "DeleteSupplier()"; logExcpUIobj.ResourceName = "SupplierFormDAL.CS"; logExcpUIobj.RecordId = supplierFormUI.Tbl_SupplierId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[SupplierFormDAL : DeleteSupplier] An error occured in the processing of Record Id : " + supplierFormUI.Tbl_SupplierId + ". Details : [" + exp.ToString() + "]"); } return(result); }
public int AddSupplier(SupplierFormUI supplierFormUI) { int result = 0; try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SupportCon.Open(); SqlCommand sqlCmd = new SqlCommand("SP_Supplier_Insert", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar); sqlCmd.Parameters["@CreatedBy"].Value = supplierFormUI.CreatedBy; sqlCmd.Parameters.Add("@tbl_OrganizationId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_OrganizationId"].Value = supplierFormUI.Tbl_OrganizationId; sqlCmd.Parameters.Add("@SupplierCode", SqlDbType.NVarChar); sqlCmd.Parameters["@SupplierCode"].Value = supplierFormUI.SupplierCode; sqlCmd.Parameters.Add("@Name", SqlDbType.NVarChar); sqlCmd.Parameters["@Name"].Value = supplierFormUI.Name; sqlCmd.Parameters.Add("@ShortName", SqlDbType.NVarChar); sqlCmd.Parameters["@ShortName"].Value = supplierFormUI.ShortName; sqlCmd.Parameters.Add("@ChequeName", SqlDbType.NVarChar); sqlCmd.Parameters["@ChequeName"].Value = supplierFormUI.ChequeName; sqlCmd.Parameters.Add("@Contact", SqlDbType.NVarChar); sqlCmd.Parameters["@Contact"].Value = supplierFormUI.Contact; sqlCmd.Parameters.Add("@Address", SqlDbType.NVarChar); sqlCmd.Parameters["@Address"].Value = supplierFormUI.Address; sqlCmd.Parameters.Add("@City", SqlDbType.NVarChar); sqlCmd.Parameters["@City"].Value = supplierFormUI.City; sqlCmd.Parameters.Add("@ZipCode", SqlDbType.NVarChar); sqlCmd.Parameters["@ZipCode"].Value = supplierFormUI.ZipCode; sqlCmd.Parameters.Add("@tbl_CountryId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_CountryId"].Value = supplierFormUI.Tbl_CountryId; sqlCmd.Parameters.Add("@Phone", SqlDbType.NVarChar); sqlCmd.Parameters["@Phone"].Value = supplierFormUI.Phone; sqlCmd.Parameters.Add("@Mobile", SqlDbType.NVarChar); sqlCmd.Parameters["@Mobile"].Value = supplierFormUI.Mobile; sqlCmd.Parameters.Add("@FaxNo", SqlDbType.NVarChar); sqlCmd.Parameters["@FaxNo"].Value = supplierFormUI.FaxNo; sqlCmd.Parameters.Add("@Email", SqlDbType.NVarChar); sqlCmd.Parameters["@Email"].Value = supplierFormUI.Email; sqlCmd.Parameters.Add("@Comment1", SqlDbType.NVarChar); sqlCmd.Parameters["@Comment1"].Value = supplierFormUI.Comment1; sqlCmd.Parameters.Add("@Comment2", SqlDbType.NVarChar); sqlCmd.Parameters["@Comment2"].Value = supplierFormUI.Comment2; sqlCmd.Parameters.Add("@Opt_Status", SqlDbType.TinyInt); sqlCmd.Parameters["@Opt_Status"].Value = supplierFormUI.Opt_Status; sqlCmd.Parameters.Add("@tbl_SupplierGroupId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_SupplierGroupId"].Value = supplierFormUI.Tbl_SupplierGroupId; sqlCmd.Parameters.Add("@OnHold", SqlDbType.Bit); sqlCmd.Parameters["@OnHold"].Value = supplierFormUI.OnHold; result = sqlCmd.ExecuteNonQuery(); sqlCmd.Dispose(); SupportCon.Close(); } } catch (Exception exp) { logExcpUIobj.MethodName = "AddSupplier()"; logExcpUIobj.ResourceName = "SupplierFormDAL.CS"; logExcpUIobj.RecordId = ""; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[SupplierFormDAL : AddSupplier] An error occured in the processing of Record. Details : [" + exp.ToString() + "]"); } return(result); }