private void FillForm(AssetGroupFormUI assetGroupFormUI) { try { DataTable dtb = assetGroupFormBAL.GetAssetGroupListById(assetGroupFormUI); if (dtb.Rows.Count > 0) { txtDescription.Text = dtb.Rows[0]["Description"].ToString(); txtAssetAndGroupAccountIdGuid.Text = dtb.Rows[0]["tbl_AssetAndGroupAccountId"].ToString(); txtAssetAndGroupAccountId.Text = dtb.Rows[0]["tbl_AssetAndGroupAccount"].ToString(); txtInsuranceIdGuid.Text = dtb.Rows[0]["tbl_InsuranceId"].ToString(); txtInsuranceId.Text = dtb.Rows[0]["tbl_Insurance"].ToString(); } else { lblError.Text = Resources.GlobalResource.msgCouldNotLoadData; divError.Visible = true; } } catch (Exception exp) { logExcpUIobj.MethodName = "FillForm()"; logExcpUIobj.ResourceName = "System_Settings_AssetGroupForm.CS"; logExcpUIobj.RecordId = assetGroupFormUI.Tbl_AssetGroupId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[System_Settings_AssetGroupForm : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]"); } }
protected void Page_Load(object sender, EventArgs e) { AssetGroupFormUI assetGroupFormUI = new AssetGroupFormUI(); if (!Page.IsPostBack) { if (Request.QueryString["AssetGroupId"] != null) { assetGroupFormUI.Tbl_AssetGroupId = Request.QueryString["AssetGroupId"]; FillForm(assetGroupFormUI); btnSave.Visible = false; btnClear.Visible = false; btnUpdate.Visible = true; btnDelete.Visible = true; lblHeading.Text = "Update Asset Group"; } else { btnSave.Visible = true; btnClear.Visible = true; btnUpdate.Visible = false; btnDelete.Visible = false; lblHeading.Text = "Add New Asset Group"; } } }
protected void btnDelete_Click(object sender, EventArgs e) { AssetGroupFormUI assetGroupFormUI = new AssetGroupFormUI(); try { assetGroupFormUI.Tbl_AssetGroupId = Request.QueryString["AssetGroupId"]; if (assetGroupFormBAL.DeleteAssetGroup(assetGroupFormUI) == 1) { divSuccess.Visible = true; divError.Visible = false; lblSuccess.Text = Resources.GlobalResource.msgRecordDeleteSuccessfully; this.Page.ClientScript.RegisterStartupScript(this.GetType(), "clearform", "ClearForm();", true); } else { divError.Visible = true; divSuccess.Visible = false; 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_AssetGroupForm.CS"; logExcpUIobj.RecordId = assetGroupFormUI.Tbl_AssetGroupId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[System_Settings_AssetGroupForm : btnDelete_Click] An error occured in the processing of Record Id : " + assetGroupFormUI.Tbl_AssetGroupId + ". Details : [" + exp.ToString() + "]"); } }
public int DeleteAssetGroup(AssetGroupFormUI assetGroupFormUI) { int resutl = 0; resutl = assetGroupFormDAL.DeleteAssetGroup(assetGroupFormUI); return(resutl); }
public int AddAssetGroup(AssetGroupFormUI assetGroupFormUI) { int resutl = 0; resutl = assetGroupFormDAL.AddAssetGroup(assetGroupFormUI); return(resutl); }
public DataTable GetAssetGroupListById(AssetGroupFormUI assetGroupFormUI) { DataTable dtb = new DataTable(); dtb = assetGroupFormDAL.GetAssetGroupListById(assetGroupFormUI); return(dtb); }
public int UpdateAssetGroup(AssetGroupFormUI assetGroupFormUI) { int result = 0; try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SupportCon.Open(); SqlCommand sqlCmd = new SqlCommand("SP_AssetGroup_Update", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@Tbl_AssetGroupId", SqlDbType.NVarChar); sqlCmd.Parameters["@Tbl_AssetGroupId"].Value = assetGroupFormUI.Tbl_AssetGroupId; sqlCmd.Parameters.Add("@ModifiedBy", SqlDbType.NVarChar); sqlCmd.Parameters["@ModifiedBy"].Value = assetGroupFormUI.ModifiedBy; sqlCmd.Parameters.Add("@tbl_OrganizationId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_OrganizationId"].Value = assetGroupFormUI.Tbl_OrganizationId; sqlCmd.Parameters.Add("@Description", SqlDbType.NVarChar); sqlCmd.Parameters["@Description"].Value = assetGroupFormUI.Description; sqlCmd.Parameters.Add("@tbl_AssetAndGroupAccountId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_AssetAndGroupAccountId"].Value = assetGroupFormUI.Tbl_AssetAndGroupAccountId; sqlCmd.Parameters.Add("@tbl_InsuranceId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_InsuranceId"].Value = assetGroupFormUI.Tbl_InsuranceId; result = sqlCmd.ExecuteNonQuery(); sqlCmd.Dispose(); SupportCon.Close(); } } catch (Exception exp) { logExcpUIobj.MethodName = "UpdateAssetGroup()"; logExcpUIobj.ResourceName = "AssetGroupFormDAL.CS"; logExcpUIobj.RecordId = assetGroupFormUI.Tbl_AssetGroupId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[AssetGroupFormDAL : UpdateAssetGroup] An error occured in the processing of Record Id : " + assetGroupFormUI.Tbl_AssetGroupId + ". Details : [" + exp.ToString() + "]"); } return(result); }
public DataTable GetAssetGroupListById(AssetGroupFormUI assetGroupFormUI) { DataSet ds = new DataSet(); DataTable dtbl = new DataTable(); try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SqlCommand sqlCmd = new SqlCommand("SP_AssetGroup_SelectById", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@tbl_AssetGroupId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_AssetGroupId"].Value = assetGroupFormUI.Tbl_AssetGroupId; using (SqlDataAdapter adapter = new SqlDataAdapter(sqlCmd)) { adapter.Fill(ds); } } if (ds.Tables.Count > 0) { dtbl = ds.Tables[0]; } } catch (Exception exp) { logExcpUIobj.MethodName = "getAssetGroupListById()"; logExcpUIobj.ResourceName = "AssetGroupFormDAL.CS"; logExcpUIobj.RecordId = assetGroupFormUI.Tbl_AssetGroupId; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[AssetGroupFormDAL : getAssetGroupListById] An error occured in the processing of Record Id : " + assetGroupFormUI.Tbl_AssetGroupId + ". Details : [" + exp.ToString() + "]"); } finally { ds.Dispose(); } return(dtbl); }