protected override void Page_Load(object sender, EventArgs e) { Segment02FormUI segment02FormUI = new Segment02FormUI(); if (!Page.IsPostBack) { BindDDLSegment01(); if (Request.QueryString["Segment02Id"] != null) { segment02FormUI.Tbl_Segment02Id = Request.QueryString["Segment02Id"]; FillForm(segment02FormUI); btnSave.Visible = false; btnClear.Visible = false; btnUpdate.Visible = true; btnDelete.Visible = true; lblHeading.Text = "Update Segment"; } else { btnSave.Visible = true; btnClear.Visible = true; btnUpdate.Visible = false; btnDelete.Visible = false; lblHeading.Text = "Add New Segment"; } } }
public int DeleteSegment02(Segment02FormUI segment02FormUI) { int resutl = 0; resutl = segment02FormDAL.DeleteSegment02(segment02FormUI); return(resutl); }
private void FillForm(Segment02FormUI segment02FormUI) { try { DataTable dtb = segment02FormBAL.GetSegment02ListById(segment02FormUI); if (dtb.Rows.Count > 0) { txtNumber.Text = dtb.Rows[0]["Number"].ToString(); txtDescription.Text = dtb.Rows[0]["Description"].ToString(); ddlSegment01.SelectedValue = dtb.Rows[0]["tbl_Segment01Id"].ToString(); } else { lblError.Text = Resources.GlobalResource.msgCouldNotLoadData; divError.Visible = true; } } catch (Exception exp) { logExcpUIobj.MethodName = "FillForm()"; logExcpUIobj.ResourceName = "System_Settings_Segment02Form.CS"; logExcpUIobj.RecordId = segment02FormUI.Tbl_Segment02Id; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[System_Settings_Segment02Form : FillForm] An error occured in the processing of Record Details : [" + exp.ToString() + "]"); } }
public int UpdateSegment02(Segment02FormUI segment02FormUI) { int resutl = 0; resutl = segment02FormDAL.UpdateSegment02(segment02FormUI); return(resutl); }
public int AddSegment02(Segment02FormUI segment02FormUI) { int resutl = 0; resutl = segment02FormDAL.AddSegment02(segment02FormUI); return(resutl); }
public DataTable GetSegment02ListById(Segment02FormUI segment02FormUI) { DataTable dtb = new DataTable(); dtb = segment02FormDAL.GetSegment02ListById(segment02FormUI); return(dtb); }
public int UpdateSegment02(Segment02FormUI segment02FormUI) { int result = 0; try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SupportCon.Open(); SqlCommand sqlCmd = new SqlCommand("SP_Segment02_Update", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@ModifiedBy", SqlDbType.NVarChar); sqlCmd.Parameters["@ModifiedBy"].Value = segment02FormUI.ModifiedBy; sqlCmd.Parameters.Add("@tbl_Segment02Id", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_Segment02Id"].Value = segment02FormUI.Tbl_Segment02Id; sqlCmd.Parameters.Add("@tbl_OrganizationId", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_OrganizationId"].Value = segment02FormUI.Tbl_OrganizationId; sqlCmd.Parameters.Add("@Number", SqlDbType.NVarChar); sqlCmd.Parameters["@Number"].Value = segment02FormUI.Number; sqlCmd.Parameters.Add("@Description", SqlDbType.NVarChar); sqlCmd.Parameters["@Description"].Value = segment02FormUI.Description; sqlCmd.Parameters.Add("@tbl_Segment01Id", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_Segment01Id"].Value = segment02FormUI.Tbl_Segment01Id; result = sqlCmd.ExecuteNonQuery(); sqlCmd.Dispose(); SupportCon.Close(); } } catch (Exception exp) { logExcpUIobj.MethodName = "UpdateSegment02()"; logExcpUIobj.ResourceName = "Segment02FormDAL.CS"; logExcpUIobj.RecordId = segment02FormUI.Tbl_Segment02Id; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[Segment02FormDAL : UpdateSegment02] An error occured in the processing of Record Id : " + segment02FormUI.Tbl_Segment02Id + ". Details : [" + exp.ToString() + "]"); } return(result); }
public DataTable GetSegment02ListById(Segment02FormUI segment02FormUI) { DataSet ds = new DataSet(); DataTable dtbl = new DataTable(); try { using (SqlConnection SupportCon = new SqlConnection(connectionString)) { SqlCommand sqlCmd = new SqlCommand("SP_Segment02_SelectById", SupportCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandTimeout = commandTimeout; sqlCmd.Parameters.Add("@tbl_Segment02Id", SqlDbType.NVarChar); sqlCmd.Parameters["@tbl_Segment02Id"].Value = segment02FormUI.Tbl_Segment02Id; using (SqlDataAdapter adapter = new SqlDataAdapter(sqlCmd)) { adapter.Fill(ds); } } if (ds.Tables.Count > 0) { dtbl = ds.Tables[0]; } } catch (Exception exp) { logExcpUIobj.MethodName = "getSegment02ListById()"; logExcpUIobj.ResourceName = "Segment02FormDAL.CS"; logExcpUIobj.RecordId = segment02FormUI.Tbl_Segment02Id; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[Segment02FormDAL : getSegment02ListById] An error occured in the processing of Record Id : " + segment02FormUI.Tbl_Segment02Id + ". Details : [" + exp.ToString() + "]"); } finally { ds.Dispose(); } return(dtbl); }
protected void btnUpdate_Click(object sender, EventArgs e) { Segment02FormUI segment02FormUI = new Segment02FormUI(); try { segment02FormUI.ModifiedBy = SessionContext.UserGuid; segment02FormUI.Tbl_OrganizationId = SessionContext.OrganizationId; segment02FormUI.Number = txtNumber.Text; segment02FormUI.Description = txtDescription.Text; segment02FormUI.Tbl_Segment01Id = ddlSegment01.SelectedValue.ToString(); segment02FormUI.Tbl_Segment02Id = Request.QueryString["Segment02Id"]; if (segment02FormBAL.UpdateSegment02(segment02FormUI) == 1) { divSuccess.Visible = true; divError.Visible = false; lblSuccess.Text = Resources.GlobalResource.msgRecordUpdatedSuccessfully; this.Page.ClientScript.RegisterStartupScript(this.GetType(), "clearform", "ClearForm();", true); } else { divSuccess.Visible = false; divError.Visible = true; lblError.Text = Resources.GlobalResource.msgCouldNotUpdateRecord; } } catch (Exception exp) { logExcpUIobj.MethodName = "btnUpdate_Click()"; logExcpUIobj.ResourceName = "System_Settings_Segment02Form.CS"; logExcpUIobj.RecordId = ""; logExcpUIobj.ExceptionDetails = "Error Occured. System Generated Error is: " + exp.ToString(); logExcpDALobj.SaveExceptionToDB(logExcpUIobj); log.Error("[System_Settings_Segment02Form : btnUpdate_Click] An error occured in the processing of Record Id : " + segment02FormUI.Tbl_Segment02Id + ". Details : [" + exp.ToString() + "]"); } }