//get all data in mst_Concern table using USP_MST_GET_PSTATUS-SP /// <summary> /// To Get Pap's status /// </summary> /// <returns></returns> public object GetPstatus() { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_SEL_PSTATUS"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("Sp_recordset", Oracle.DataAccess.Client.OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); PstatusBO objPstatus = null; PstatusList Pstatus = new PstatusList(); while (dr.Read()) { objPstatus = new PstatusBO(); objPstatus.PAPDESIGNATIONID1 = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("PAPDESIGNATIONID"))); objPstatus.PAPDESIGNATION1 = dr.GetString(dr.GetOrdinal("PAPDESIGNATION")); objPstatus.ISDELETED1 = dr.GetString(dr.GetOrdinal("ISDELETED")); Pstatus.Add(objPstatus); } dr.Close(); return(Pstatus); }
//get the data in mst_Concern table using USP_MST_GETSELECTCONCERN-SP signal Data based on ID /// <summary> /// To Get Pap's status by ID /// </summary> /// <param name="PAPDESIGNATIONID"></param> /// <returns></returns> public PstatusBO GetPstatusById(int PAPDESIGNATIONID) { OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_MST_GET_PSTATUS"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("p_papdesignationid", PAPDESIGNATIONID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); PstatusBO objPstatus = null; PstatusList Users = new PstatusList(); objPstatus = new PstatusBO(); while (dr.Read()) { if (ColumnExists(dr, "PAPDESIGNATION") && !dr.IsDBNull(dr.GetOrdinal("PAPDESIGNATION"))) { objPstatus.PAPDESIGNATION1 = dr.GetString(dr.GetOrdinal("PAPDESIGNATION")); } if (ColumnExists(dr, "PAPDESIGNATIONID") && !dr.IsDBNull(dr.GetOrdinal("PAPDESIGNATIONID"))) { objPstatus.PAPDESIGNATIONID1 = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("PAPDESIGNATIONID"))); } } dr.Close(); return(objPstatus); }
/// <summary> /// Get Pap data From database and set to Labels /// </summary> private void GetHouseholdDetails() { int householdID = Convert.ToInt32(Session["HH_ID"]); PAP_HouseholdBLL objHouseHoldBLL = new PAP_HouseholdBLL(); PAP_HouseholdBO objHouseHold = objHouseHoldBLL.GetHouseHoldData(householdID); lblDistrict.Text = objHouseHold.District; lblCounty.Text = objHouseHold.County; lblSubCounty.Text = objHouseHold.SubCounty; lblParish.Text = objHouseHold.Parish; lblVillage.Text = objHouseHold.Village; lblStakeholdDesignation.Text = objHouseHold.Designation; ddlLocClassification.ClearSelection(); if (ddlLocClassification.Items.FindByValue(objHouseHold.LocClassification) != null) { ddlLocClassification.Items.FindByValue(objHouseHold.LocClassification).Selected = true; } PstatusBLL objPstatusBLL = new PstatusBLL(); PstatusBO objPstatus = objPstatusBLL.GetPstatusById(objHouseHold.PapstatusId); if (objPstatus != null) { lblStatus.Text = objPstatus.PAPDESIGNATION1; } }
/// <summary> /// To save details to database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void SaveButton_Click(object sender, EventArgs e) { string message = ""; PstatusBLL BLLobj = null; try { BLLobj = new PstatusBLL(); PstatusBO objPstatus = new PstatusBO(); if (Convert.ToInt32(ViewState["PAPDESIGNATIONID"]) > 0) { objPstatus.PAPDESIGNATION1 = pstatusTextBox.Text.Trim(); objPstatus.PAPDESIGNATIONID1 = Convert.ToInt32(ViewState["PAPDESIGNATIONID"]); message = BLLobj.EDITPstatus(objPstatus); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; } SetUpdateMode(false); } else { objPstatus.PAPDESIGNATION1 = pstatusTextBox.Text.Trim(); objPstatus.CREATEDBY1 = Convert.ToInt32(Session["USER_ID"]); message = BLLobj.insert(objPstatus); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; } } if (message != "") { ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); } clearfields(); BindGrid(true, true); } catch (Exception ex) { throw ex; } finally { BLLobj = null; } }
// <summary> /// get the Grid value into textBox /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void GetPstatusDetails() { PstatusBLL PstatusBLLobj = new PstatusBLL(); int PAPDESIGNATIONID = 0; if (ViewState["PAPDESIGNATIONID"] != null) { PAPDESIGNATIONID = Convert.ToInt32(ViewState["PAPDESIGNATIONID"]); } PstatusBO PstatusObj = new PstatusBO(); PstatusObj = PstatusBLLobj.GetPstatusById(PAPDESIGNATIONID); pstatusTextBox.Text = PstatusObj.PAPDESIGNATION1; }
/// <summary> /// To EDIT Pap status /// </summary> /// <param name="objPstatus"></param> /// <returns></returns> public string EDITPstatus(PstatusBO objPstatus) { PstatusDAL PstatusDAlobj = new PstatusDAL(); //Data pass -to Database Layer try { return(PstatusDAlobj.EDITPstatus(objPstatus)); } catch { throw; } finally { PstatusDAlobj = null; } }
// to check the Column are Exists or not /// <summary> /// To EDIT Pap status /// </summary> /// <param name="objPstatus"></param> /// <returns></returns> public string EDITPstatus(PstatusBO objPstatus) { string returnResult = ""; OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString); cnn.Open(); OracleCommand dcmd = new OracleCommand("USP_MST_UPD_PSTATUS", cnn); dcmd.CommandType = CommandType.StoredProcedure; int count = Convert.ToInt32(dcmd.CommandType); try { dcmd.Parameters.Add("p_papdesignation", objPstatus.PAPDESIGNATION1); dcmd.Parameters.Add("p_papdesignationid", objPstatus.PAPDESIGNATIONID1); dcmd.Parameters.Add("UpdatedBY", objPstatus.CREATEDBY1); dcmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output; dcmd.ExecuteNonQuery(); if (dcmd.Parameters["errorMessage_"].Value != null) { returnResult = dcmd.Parameters["errorMessage_"].Value.ToString(); } return(returnResult); } catch { throw; } finally { dcmd.Dispose(); cnn.Close(); cnn.Dispose(); } }