private void FillForm(AssetPurchaseDistributionFormUI assetPurchaseDistributionFormUI) { try { DataTable dtb = assetPurchaseDistributionFormBAL.GetAssetPurchaseDistributionListById(assetPurchaseDistributionFormUI); if (dtb.Rows.Count > 0) { txtAssetPurchaseGuid.Text = dtb.Rows[0]["tbl_AssetPurchaseId"].ToString(); txtAssetPurchase.Text = dtb.Rows[0]["tbl_AssetPurchase"].ToString(); txtGLAccountGuid.Text = dtb.Rows[0]["tbl_GLAccountId"].ToString(); txtGLAccount.Text = dtb.Rows[0]["tbl_GLAccount"].ToString(); ddlopt_GLAccountType.SelectedValue = dtb.Rows[0]["GLAccountType"].ToString(); txtDescription.Text = dtb.Rows[0]["Description"].ToString(); txtDistributionReference.Text = dtb.Rows[0]["DistributionReference"].ToString(); txtDebit.Text = dtb.Rows[0]["Debit"].ToString(); txtCredit.Text = dtb.Rows[0]["Credit"].ToString(); } } catch (Exception exp) { logExcpUIobj.MethodName = "FillForm()"; logExcpUIobj.ResourceName = "Asset_Purchase_AssetPurchaseDistributionForm.CS"; logExcpUIobj.RecordId = this.assetPurchaseDistributionFormUI.Tbl_AssetPurchaseDistributionId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[Asset_Purchase_AssetPurchaseDistributionForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]"); } }
protected void Page_Load(object sender, EventArgs e) { AssetPurchaseDistributionFormUI assetPurchaseDistributionFormUI = new AssetPurchaseDistributionFormUI(); if (!Page.IsPostBack) { if (Request.QueryString["AssetPurchaseDistributionId"] != null) { assetPurchaseDistributionFormUI.Tbl_AssetPurchaseDistributionId = Request.QueryString["AssetPurchaseDistributionId"]; BindOptionSetLisDropDown(); FillForm(assetPurchaseDistributionFormUI); btnSave.Visible = false; btnClear.Visible = false; btnUpdate.Visible = true; btnDelete.Visible = true; lblHeading.Text = "Update Asset Purchase Distribution"; } else { BindOptionSetLisDropDown(); btnSave.Visible = true; btnClear.Visible = true; btnUpdate.Visible = false; btnDelete.Visible = false; lblHeading.Text = "Add New Asset Purchase Distribution"; } } }
public int DeleteAssetPurchaseDistribution(AssetPurchaseDistributionFormUI assetPurchaseDistributionFormUI) { int resutl = 0; resutl = assetPurchaseDistributionFormDAL.DeleteAssetPurchaseDistribution(assetPurchaseDistributionFormUI); return(resutl); }
public DataTable GetAssetPurchaseDistributionListById(AssetPurchaseDistributionFormUI assetPurchaseDistributionFormUI) { DataTable dtb = new DataTable(); dtb = assetPurchaseDistributionFormDAL.GetAssetPurchaseDistributionListById(assetPurchaseDistributionFormUI); return(dtb); }
public int AddAssetPurchaseDistribution(AssetPurchaseDistributionFormUI assetPurchaseDistributionFormUI) { int result = 0; try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SupportCon.Open(); SqlCommand sqlCmd = new SqlCommand("SP_AssetPurchaseDistribution_Insert", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@CreatedBy", SqlDbType.NVarChar); sqlCmd.Parameters["@CreatedBy"].Value = assetPurchaseDistributionFormUI.CreatedBy; sqlCmd.Parameters.Add("@tbl_OrganizationId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_OrganizationId"].Value = assetPurchaseDistributionFormUI.Tbl_OrganizationId; sqlCmd.Parameters.Add("@tbl_AssetPurchaseId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_AssetPurchaseId"].Value = assetPurchaseDistributionFormUI.Tbl_AssetPurchaseId; sqlCmd.Parameters.Add("@tbl_GLAccountId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_GLAccountId"].Value = assetPurchaseDistributionFormUI.Tbl_GLAccountId; sqlCmd.Parameters.Add("@opt_GLAccountType", SqlDbType.TinyInt); sqlCmd.Parameters["@opt_GLAccountType"].Value = assetPurchaseDistributionFormUI.opt_GLAccountType; sqlCmd.Parameters.Add("@Description", SqlDbType.NVarChar); sqlCmd.Parameters["@Description"].Value = assetPurchaseDistributionFormUI.Description; sqlCmd.Parameters.Add("@DistributionReference", SqlDbType.NVarChar); sqlCmd.Parameters["@DistributionReference"].Value = assetPurchaseDistributionFormUI.DistributionReference; sqlCmd.Parameters.Add("@Debit", SqlDbType.Decimal); sqlCmd.Parameters["@Debit"].Value = assetPurchaseDistributionFormUI.Debit; sqlCmd.Parameters.Add("@Credit", SqlDbType.Decimal); sqlCmd.Parameters["@Credit"].Value = assetPurchaseDistributionFormUI.Credit; result = sqlCmd.ExecuteNonQuery(); sqlCmd.Dispose(); SupportCon.Close(); } } catch (Exception exp) { logExcpUIobj.MethodName = "AddAssetPurchaseDistribution()"; logExcpUIobj.ResourceName = "AssetPurchaseDistributionFormDAL.CS"; logExcpUIobj.RecordId = ""; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[AssetPurchaseDistributionFormDAL : AddAssetPurchaseDistribution] An error occured in the processing of Record. Details : [" + exp.ToString() + "]"); } return(result); }
public DataTable GetAssetPurchaseDistributionListById(AssetPurchaseDistributionFormUI assetPurchaseDistributionFormUI) { DataSet ds = new DataSet(); DataTable dtbl = new DataTable(); try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SqlCommand sqlCmd = new SqlCommand("SP_AssetPurchaseDistribution_SelectById", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@tbl_AssetPurchaseDistributionId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_AssetPurchaseDistributionId"].Value = assetPurchaseDistributionFormUI.Tbl_AssetPurchaseDistributionId; using (SqlDataAdapter adapter = new SqlDataAdapter(sqlCmd)) { adapter.Fill(ds); } } if (ds.Tables.Count > 0) { dtbl = ds.Tables[0]; } } catch (Exception exp) { logExcpUIobj.MethodName = "getAssetPurchaseDistributionListById()"; logExcpUIobj.ResourceName = "AssetPurchaseDistributionFormDAL.CS"; logExcpUIobj.RecordId = assetPurchaseDistributionFormUI.Tbl_AssetPurchaseDistributionId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[AssetPurchaseDistributionFormDAL : getAssetPurchaseDistributionListById] An error occured in the processing of Record Id : " + assetPurchaseDistributionFormUI.Tbl_AssetPurchaseDistributionId + ". Details : [" + exp.ToString() + "]"); } finally { ds.Dispose(); } return(dtbl); }
public int DeleteAssetPurchaseDistribution(AssetPurchaseDistributionFormUI assetPurchaseDistributionFormUI) { int result = 0; try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SupportCon.Open(); SqlCommand sqlCmd = new SqlCommand("SP_AssetPurchaseDistribution_Delete", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@tbl_AssetPurchaseDistributionId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_AssetPurchaseDistributionId"].Value = assetPurchaseDistributionFormUI.Tbl_AssetPurchaseDistributionId; result = sqlCmd.ExecuteNonQuery(); sqlCmd.Dispose(); SupportCon.Close(); } } catch (Exception exp) { logExcpUIobj.MethodName = "DeleteAssetPurchaseDistribution()"; logExcpUIobj.ResourceName = "AssetPurchaseDistributionFormDAL.CS"; logExcpUIobj.RecordId = assetPurchaseDistributionFormUI.Tbl_AssetPurchaseDistributionId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[AssetPurchaseDistributionFormDAL : DeleteAssetPurchaseDistribution] An error occured in the processing of Record Id : " + assetPurchaseDistributionFormUI.Tbl_AssetPurchaseDistributionId + ". Details : [" + exp.ToString() + "]"); } return(result); }