/// <summary> /// To Get Land Info Priv Spose /// </summary> /// <param name="PRIVATELANDID"></param> /// <returns></returns> public PAPRelationList GetLandInfoPrivSpose(int PRIVATELANDID) { PAP_RelationBO objRelation = null; PAPRelationList Relations = new PAPRelationList(); OracleConnection con = new OracleConnection(AppConfiguration.ConnectionString); OracleCommand cmd; string proc = "USP_TRN_GET_PAP_LND_SPOSE"; cmd = new OracleCommand(proc, con); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("PRIVATELANDIDIN", PRIVATELANDID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (dr.Read()) { objRelation = new PAP_RelationBO(); if (!dr.IsDBNull(dr.GetOrdinal("pap_hh_relationid"))) { objRelation.RelationID = dr.GetInt32(dr.GetOrdinal("pap_hh_relationid")); } if (!dr.IsDBNull(dr.GetOrdinal("privatelandid"))) { objRelation.HolderTypeID = dr.GetInt32(dr.GetOrdinal("privatelandid")); } Relations.Add(objRelation); } dr.Close(); return(Relations); }
/// <summary> /// to save the data to the database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSaveHolder_Click(object sender, EventArgs e) { string message = string.Empty; ChangeRequestStatusHolderType(); PAP_RelationBO objRelation = new PAP_RelationBO(); objRelation.HouseholdID = Convert.ToInt32(Session["HH_ID"]); objRelation.HolderTypeID = Convert.ToInt32(ViewState["HOLDERTYPE_ID"]); objRelation.HolderName = txtHolderName.Text.Trim(); if (dpDateOfBirth.Text.Trim().Length > 0 && Convert.ToDateTime(dpDateOfBirth.Text) != DateTime.MinValue) { objRelation.DateOfBirth = Convert.ToDateTime(dpDateOfBirth.Text); } objRelation.CurrentSchoolStatusID = Convert.ToInt32(ddlCurrentSchoolStatus.SelectedItem.Value); objRelation.NeverAttendedSchoolID = Convert.ToInt32(ddlNeverAttendedSchool.SelectedItem.Value); objRelation.SchoolDropReasonID = Convert.ToInt32(ddlSchoolDropReason.SelectedItem.Value); objRelation.LiteracyLevelID = Convert.ToInt32(ddlLiteracyLevel.SelectedItem.Value); objRelation.Sex = ddlGender.SelectedItem.Value; if (chkResideOnAffectedLand.Checked) { objRelation.ResideOnAffectedLand = "YES"; } else { objRelation.ResideOnAffectedLand = "NO"; } if (Convert.ToInt32(ViewState["RELATION_ID"]) > 0) { objRelation.RelationID = Convert.ToInt32(ViewState["RELATION_ID"]); objRelation.UpdatedBy = Convert.ToInt32(Session["USER_ID"]); ClearDetails(); message = (new PAP_RelationBLL()).UpdateRelation(objRelation); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data updated successfully"; } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('" + message + "');", true); } else { objRelation.CreatedBy = Convert.ToInt32(Session["USER_ID"]); message = (new PAP_RelationBLL()).AddRelation(objRelation); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('" + message + "');", true); } projectFrozen(); ClearDetails(); BindHolderTypes(); SetUpdateMode(false); }
/// <summary> /// Bind Child Data to Chkchildrenlist /// </summary> /// <param name="HHHH_ID"></param> protected void BindChild(int HHHH_ID) { PAP_RelationBLL objPAPRBLL = new PAP_RelationBLL(); PAPRelationList objPAPRelationList = new PAPRelationList(); PAPRelationList objPAPRelationList2 = new PAPRelationList(); objPAPRelationList = objPAPRBLL.GetRelations(HHHH_ID, 2); objPAPRelationList2 = objPAPRBLL.GetRelations(HHHH_ID, 3); PAP_RelationBO objRelation = null; for (int i = 0; i < objPAPRelationList2.Count; i++) { objRelation = new PAP_RelationBO(); objRelation.RelationID = objPAPRelationList2[i].RelationID; objRelation.HouseholdID = objPAPRelationList2[i].HouseholdID; objRelation.HolderName = objPAPRelationList2[i].HolderName; objRelation.ResideOnAffectedLand = objPAPRelationList2[i].ResideOnAffectedLand; objRelation.DateOfBirth = objPAPRelationList2[i].DateOfBirth; objRelation.LiteracyStatus = objPAPRelationList2[i].LiteracyStatus; objRelation.IsDeleted = objPAPRelationList2[i].IsDeleted; objPAPRelationList.Add(objRelation); } if (objPAPRelationList.Count > 0) { Chkchildrenlist.DataSource = objPAPRelationList; Chkchildrenlist.DataTextField = "HOLDERNAME"; Chkchildrenlist.DataValueField = "RelationID"; Chkchildrenlist.DataBind(); } else { chkmsg.Text = "Children Not Available"; } }
/// <summary> /// To Update Relation /// </summary> /// <param name="objRelation"></param> /// <returns></returns> public string UpdateRelation(PAP_RelationBO objRelation) { return((new PAP_RelationDAL()).UpdateRelation(objRelation)); }
/// <summary> /// To Add Relation /// </summary> /// <param name="objRelation"></param> /// <returns></returns> public string AddRelation(PAP_RelationBO objRelation) { return((new PAP_RelationDAL()).AddRelation(objRelation)); }
/// <summary> /// To Sava and Update Private land Data info in to data base /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { PrivateLandInfoBO objPrivateLF = new PrivateLandInfoBO(); objPrivateLF.HIDPriv = Convert.ToInt32(Session["HH_ID"]); objPrivateLF.Lnd_TENUREIDPriv = Convert.ToInt32(ddlLandTenure.SelectedItem.Value); objPrivateLF.LANDLORDNAME = txtlandlord.Text; objPrivateLF.CLAIMANTNAME = txtwhoclaims.Text.Trim(); objPrivateLF.WHENFARMINGBEGAN = txtwhenbeginfarm.Text.Trim(); objPrivateLF.WHEREFARMEDBEFORE = txtwheredidfarm.Text.Trim(); //objPrivateLF.DOSPOUSESFARM = Chkspouse.Text; if (Chkspouse.Checked == true) { objPrivateLF.DOSPOUSESFARM = "Yes"; //BO.PAP_Relation objPAPR = new BO.PAP_Relation(); //BO.PAP_RelationBLL objPAPRBLL = new BO.PAP_RelationBLL(); //Chkspouselist.DataSource = objPAPRBLL.GetRelations(2,3); } else if (Chkspouse.Checked == false) { objPrivateLF.DOSPOUSESFARM = "No"; } if (ChkChildren.Checked == true) { objPrivateLF.DOCHILDRENFARM = "Yes"; } else if (ChkChildren.Checked == false) { objPrivateLF.DOCHILDRENFARM = "No"; } string sagr = txtagrrement.Text.Trim(); string sPro = txtprodutive.Text.Trim(); if (sagr.Length > 999) { sagr = sagr.Substring(0, 999); } if (sPro.Length > 999) { sPro = sPro.Substring(0, 999); } objPrivateLF.AGREEMENTTYPE = sagr; objPrivateLF.PRODASSETOPPORTUNITIES = sPro; objPrivateLF.Useridpriv = Convert.ToInt32(Session["USER_ID"]); LandInfoPrivateBLL objLFPrivateBLL = new LandInfoPrivateBLL(); //if (objPrivateLF.HIDPriv != 0) //{ // objLFPrivateBLL.AddLandInfoPrivate(objPrivateLF); // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Private Land Info added successfully');", true); //} //else //{ objLFPrivateBLL.UpdateLandInfoPrivate(objPrivateLF); PAPRelationList RelationsSpose = new PAPRelationList(); if (Chkspouse.Checked == true) { PAP_RelationBO objRelation = null; for (int i = 0; i < Chkspouselist.Items.Count; i++) { if (Chkspouselist.Items[i].Selected) { objRelation = new PAP_RelationBO(); objRelation.RelationID = Convert.ToInt32(Chkspouselist.Items[i].Value); objRelation.HouseholdID = Convert.ToInt32(Session["HH_ID"]); objRelation.CreatedBy = Convert.ToInt32(Session["USER_ID"]); RelationsSpose.Add(objRelation); } } } objLFPrivateBLL.InsertUpdateRelationsSpose(RelationsSpose); PAPRelationList RelationsChild = new PAPRelationList(); if (ChkChildren.Checked == true) { PAP_RelationBO objRelation = null; for (int i = 0; i < Chkchildrenlist.Items.Count; i++) { if (Chkchildrenlist.Items[i].Selected) { objRelation = new PAP_RelationBO(); objRelation.RelationID = Convert.ToInt32(Chkchildrenlist.Items[i].Value); objRelation.HouseholdID = Convert.ToInt32(Session["HH_ID"]); objRelation.CreatedBy = Convert.ToInt32(Session["USER_ID"]); RelationsChild.Add(objRelation); } } } objLFPrivateBLL.InsertUpdateRelationsChild(RelationsChild); ChangeRequestStatusITML(); projectFrozen(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('Data updated successfully');", true); btn_SavePrivate.Text = "Save"; //ClearDetailspriv(); //} }
/// <summary> /// To Get Relation By ID /// </summary> /// <param name="relationID"></param> /// <returns></returns> public PAP_RelationBO GetRelationByID(int relationID) { proc = "USP_TRN_GET_PAPRELATIONBYID"; cnn = new OracleConnection(con); PAP_RelationBO objRelation = null; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("PAP_HH_RELATIONID_", relationID); cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output; try { cmd.Connection.Open(); OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (dr.Read()) { objRelation = new PAP_RelationBO(); if (!dr.IsDBNull(dr.GetOrdinal("PAP_HH_RELATIONID"))) { objRelation.RelationID = dr.GetInt32(dr.GetOrdinal("PAP_HH_RELATIONID")); } if (!dr.IsDBNull(dr.GetOrdinal("HHID"))) { objRelation.HouseholdID = dr.GetInt32(dr.GetOrdinal("HHID")); } if (!dr.IsDBNull(dr.GetOrdinal("HOLDERNAME"))) { objRelation.HolderName = dr.GetString(dr.GetOrdinal("HOLDERNAME")); } if (!dr.IsDBNull(dr.GetOrdinal("RESIDEONAFFECTEDLAND"))) { objRelation.ResideOnAffectedLand = dr.GetString(dr.GetOrdinal("RESIDEONAFFECTEDLAND")); } if (!dr.IsDBNull(dr.GetOrdinal("DATEOFBIRTH"))) { objRelation.DateOfBirth = dr.GetDateTime(dr.GetOrdinal("DATEOFBIRTH")); } if (!dr.IsDBNull(dr.GetOrdinal("LITERACYLEVELID"))) { objRelation.LiteracyLevelID = dr.GetInt32(dr.GetOrdinal("LITERACYLEVELID")); } if (!dr.IsDBNull(dr.GetOrdinal("CUR_SCH_STATUSID"))) { objRelation.CurrentSchoolStatusID = dr.GetInt32(dr.GetOrdinal("CUR_SCH_STATUSID")); } if (!dr.IsDBNull(dr.GetOrdinal("NVR_ATT_SCH_REASONID"))) { objRelation.NeverAttendedSchoolID = dr.GetInt32(dr.GetOrdinal("NVR_ATT_SCH_REASONID")); } if (!dr.IsDBNull(dr.GetOrdinal("SCH_DRP_REASONID"))) { objRelation.SchoolDropReasonID = dr.GetInt32(dr.GetOrdinal("SCH_DRP_REASONID")); } if (!dr.IsDBNull(dr.GetOrdinal("GENDER"))) { objRelation.Sex = dr.GetString(dr.GetOrdinal("GENDER")); } } dr.Close(); } catch (Exception ex) { throw ex; } return(objRelation); }
/// <summary> /// To Add Relation /// </summary> /// <param name="objRelation"></param> /// <returns></returns> public string AddRelation(PAP_RelationBO objRelation) { string returnResult = string.Empty; cnn = new OracleConnection(con); proc = "USP_TRN_INS_PAPRELATION"; cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Connection.Open(); cmd.Parameters.Add("HOUSEHOLDID_", objRelation.HouseholdID); cmd.Parameters.Add("HOLDERTYPEID_", objRelation.HolderTypeID); cmd.Parameters.Add("HOLDERNAME_", objRelation.HolderName); cmd.Parameters.Add("RESIDEONAFFECTEDLAND_", objRelation.ResideOnAffectedLand); if (objRelation.DateOfBirth != null && objRelation.DateOfBirth != DateTime.MinValue) { cmd.Parameters.Add("DATEOFBIRTH_", objRelation.DateOfBirth); } else { cmd.Parameters.Add("DATEOFBIRTH_", DBNull.Value); } cmd.Parameters.Add("GENDER_", objRelation.Sex); if (objRelation.LiteracyLevelID > 0) { cmd.Parameters.Add("LITERACYLEVELID_", objRelation.LiteracyLevelID); } else { cmd.Parameters.Add("LITERACYLEVELID_", DBNull.Value); } if (objRelation.CurrentSchoolStatusID > 0) { cmd.Parameters.Add("CUR_SCH_STATUSID_", objRelation.CurrentSchoolStatusID); } else { cmd.Parameters.Add("CUR_SCH_STATUSID_", DBNull.Value); } if (objRelation.NeverAttendedSchoolID > 0) { cmd.Parameters.Add("NVR_ATT_SCH_REASONID_", objRelation.NeverAttendedSchoolID); } else { cmd.Parameters.Add("NVR_ATT_SCH_REASONID_", DBNull.Value); } if (objRelation.SchoolDropReasonID > 0) { cmd.Parameters.Add("SCH_DRP_REASONID_", objRelation.SchoolDropReasonID); } else { cmd.Parameters.Add("SCH_DRP_REASONID_", DBNull.Value); } cmd.Parameters.Add("CREATEDBY_", objRelation.CreatedBy); cmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output; cmd.ExecuteNonQuery(); if (cmd.Parameters["errorMessage_"].Value != null) { returnResult = cmd.Parameters["errorMessage_"].Value.ToString(); } else { returnResult = string.Empty; } cmd.Connection.Close(); return(returnResult); }
/// <summary> /// Set edit mode for edit comand /// Delete data from the database for delete comand /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void grdHolders_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditRow") { ViewState["RELATION_ID"] = e.CommandArgument; PAP_RelationBO objRelation = (new PAP_RelationBLL()).GetRelationByID(Convert.ToInt32(ViewState["RELATION_ID"])); if (objRelation != null) { txtHolderName.Text = objRelation.HolderName; if (objRelation.DateOfBirth != DateTime.MinValue) { dpDateOfBirth.Text = objRelation.DateOfBirth.ToString(UtilBO.DateFormat); } ddlCurrentSchoolStatus.ClearSelection(); if (ddlCurrentSchoolStatus.Items.FindByValue(objRelation.CurrentSchoolStatusID.ToString()) != null) { ddlCurrentSchoolStatus.Items.FindByValue(objRelation.CurrentSchoolStatusID.ToString()).Selected = true; } ddlNeverAttendedSchool.ClearSelection(); if (ddlNeverAttendedSchool.Items.FindByValue(objRelation.NeverAttendedSchoolID.ToString()) != null) { ddlNeverAttendedSchool.Items.FindByValue(objRelation.NeverAttendedSchoolID.ToString()).Selected = true; } ddlSchoolDropReason.ClearSelection(); if (ddlSchoolDropReason.Items.FindByValue(objRelation.SchoolDropReasonID.ToString()) != null) { ddlSchoolDropReason.Items.FindByValue(objRelation.SchoolDropReasonID.ToString()).Selected = true; } ddlLiteracyLevel.ClearSelection(); if (ddlLiteracyLevel.Items.FindByValue(objRelation.LiteracyLevelID.ToString()) != null) { ddlLiteracyLevel.Items.FindByValue(objRelation.LiteracyLevelID.ToString()).Selected = true; } if (objRelation.ResideOnAffectedLand == "YES") { chkResideOnAffectedLand.Checked = true; } else { chkResideOnAffectedLand.Checked = false; } ddlGender.ClearSelection(); if (ddlGender.Items.FindByValue(objRelation.Sex) != null) { ddlGender.Items.FindByValue(objRelation.Sex).Selected = true; } } SetUpdateMode(true); BindHolderTypes(); } else if (e.CommandName == "DeleteRow") { string message = string.Empty; PAP_RelationBLL objPAPRelationBLL = new PAP_RelationBLL(); message = objPAPRelationBLL.DeleteRelation(Convert.ToInt32(e.CommandArgument)); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data Deleted successfully"; } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('" + message + "');", true); ViewState["RELATION_ID"] = "0"; ClearDetails(); SetUpdateMode(false); BindHolderTypes(); } }