/// <summary> /// To Insert Update Relations Child /// </summary> /// <param name="RelationsChild"></param> public void InsertUpdateRelationsChild(PAPRelationList RelationsChild) { OracleConnection con = new OracleConnection(AppConfiguration.ConnectionString); int result = 0; { try { for (int i = 0; i < RelationsChild.Count; i++) { OracleCommand myCommand; myCommand = new OracleCommand("USP_TRN_UPD_LND_CHILD", con); myCommand.Connection = con; myCommand.CommandType = CommandType.StoredProcedure; myCommand.Parameters.Add("RelationID_", RelationsChild[i].RelationID); myCommand.Parameters.Add("HHID_", RelationsChild[i].HouseholdID); myCommand.Parameters.Add("CREATEDBY", RelationsChild[i].CreatedBy); con.Open(); result = myCommand.ExecuteNonQuery(); con.Close(); } } catch (Exception ex) { throw ex; } } }
/// <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 see Spouse details for selected Pap /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void Chkspouse_CheckedChanged(object sender, EventArgs e) { //for getting spouse name we r passing id int HHH_ID = Convert.ToInt32(Session["HH_ID"]); if (Chkspouse.Checked == true) { //PAP_Relation objPAPR = new PAP_Relation(); PAP_RelationBLL objPAPRBLL = new PAP_RelationBLL(); PAPRelationList objPAPRelationList = new PAPRelationList(); objPAPRelationList = objPAPRBLL.GetRelations(HHH_ID, 1); if (objPAPRelationList.Count > 0) { Chkspouselist.DataSource = objPAPRelationList; Chkspouselist.DataTextField = "HOLDERNAME"; Chkspouselist.DataValueField = "RelationID"; Chkspouselist.DataBind(); } else { chkmsg1.Text = "Spouses Not Available"; } } else { Chkspouselist.Items.Clear(); chkmsg1.Text = ""; } }
/// <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 Insert Update Relations Child /// </summary> /// <param name="RelationsChild"></param> public void InsertUpdateRelationsChild(PAPRelationList RelationsChild) { (new LandInfoPrivateDAL()).InsertUpdateRelationsChild(RelationsChild); }
/// <summary> /// To Insert Update Relations Spose /// </summary> /// <param name="RelationsSpose"></param> public void InsertUpdateRelationsSpose(PAPRelationList RelationsSpose) { (new LandInfoPrivateDAL()).InsertUpdateRelationsSpose(RelationsSpose); }
/// <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> /// Get Land Info Details for Selected PAP /// </summary> private void GetLandInfo() { LandInfoBLL objLandInfoBLL = new LandInfoBLL(); PublicLandInfoBO objLandInfo = objLandInfoBLL.GetLandInfo(Convert.ToInt32(Session["HH_ID"])); if (objLandInfo != null) { ddlLandTenure.ClearSelection(); if (ddlLandTenure.Items.FindByValue(objLandInfo.LND_TENUREID.ToString()) != null) { ddlLandTenure.Items.FindByValue(objLandInfo.LND_TENUREID.ToString()).Selected = true; } ddlReceivedFromWhom.ClearSelection(); if (ddlReceivedFromWhom.Items.FindByValue(objLandInfo.LandRecivedfromid.ToString()) != null) { ddlReceivedFromWhom.Items.FindByValue(objLandInfo.LandRecivedfromid.ToString()).Selected = true; } if (ddlReceivedFromWhom.SelectedItem.Text == "Other" || ddlReceivedFromWhom.SelectedItem.Text == "Individual") { txtfromwhom.Enabled = true; } else { txtfromwhom.Enabled = false; } txtyear.Text = objLandInfo.YEAROFACQUISITION; txtfromwhom.Text = objLandInfo.FROMWHOM; txtcoments.Text = objLandInfo.COMMENTS; txtland.Text = objLandInfo.WHOCLAIMSLAND; if (objLandInfo.HASTITLEDETAILS.ToUpper() == "YES") { Chkhasitdetails.Checked = true; } if (objLandInfo.LIVEDSINCEBIRTH.ToUpper() == "YES") { chkLivedSinceBirth.Checked = true; } if (objLandInfo.ISMORTGAGED.ToUpper() == "YES") { ChkMortagelies.Checked = true; } txtyearmoved.Text = objLandInfo.MOVEDYEAR; txtwherebefore.Text = objLandInfo.WHERELIVEDBEFORE; txtmortagedetails.Text = objLandInfo.MORTGAGEDETAILS; pnlPublic.Visible = true; //ddlLandTenure.Enabled = false; } else { LandInfoPrivateBLL objLandInfoPrivBLL = new LandInfoPrivateBLL(); PrivateLandInfoBO objPrivLandInfo = objLandInfoPrivBLL.GetLandInfoPriv(Convert.ToInt32(Session["HH_ID"])); if (objPrivLandInfo != null) { ddlLandTenure.ClearSelection(); if (ddlLandTenure.Items.FindByValue(objPrivLandInfo.Lnd_TENUREIDPriv.ToString()) != null) { ddlLandTenure.Items.FindByValue(objPrivLandInfo.Lnd_TENUREIDPriv.ToString()).Selected = true; } txtlandlord.Text = objPrivLandInfo.LANDLORDNAME; txtwhoclaims.Text = objPrivLandInfo.CLAIMANTNAME; txtwhenbeginfarm.Text = objPrivLandInfo.WHENFARMINGBEGAN; txtwheredidfarm.Text = objPrivLandInfo.WHEREFARMEDBEFORE; if (objPrivLandInfo.DOSPOUSESFARM.ToUpper() == "YES") { Chkspouse.Checked = true; PAP_RelationBLL objPAPRBLL = new PAP_RelationBLL(); PAPRelationList objPAPRelationList = new PAPRelationList(); objPAPRelationList = objPAPRBLL.GetRelations(Convert.ToInt32(Session["HH_ID"]), 1); if (objPAPRelationList.Count > 0) { Chkspouselist.DataSource = objPAPRelationList; Chkspouselist.DataTextField = "HOLDERNAME"; Chkspouselist.DataValueField = "RelationID"; Chkspouselist.DataBind(); } else { chkmsg1.Text = "Spouses Not Available"; } if (Chkspouselist.Items.Count > 0) { PAPRelationList RelationsSpose = objLandInfoPrivBLL.GetLandInfoPrivSpose(Convert.ToInt32(objPrivLandInfo.PRIVATELANDID)); if (RelationsSpose != null) { for (int i = 0; i < RelationsSpose.Count; i++) { Chkspouselist.Items.FindByValue(RelationsSpose[i].RelationID.ToString()).Selected = true; } } } } if (objPrivLandInfo.DOCHILDRENFARM.ToUpper() == "YES") { ChkChildren.Checked = true; BindChild(Convert.ToInt32(Session["HH_ID"])); if (Chkchildrenlist.Items.Count > 0) { PAPRelationList RelationsSpose = objLandInfoPrivBLL.GetLandInfoPrivChild(Convert.ToInt32(objPrivLandInfo.PRIVATELANDID)); if (RelationsSpose != null) { for (int i = 0; i < RelationsSpose.Count; i++) { Chkchildrenlist.Items.FindByValue(RelationsSpose[i].RelationID.ToString()).Selected = true; } } } } txtagrrement.Text = objPrivLandInfo.AGREEMENTTYPE; txtprodutive.Text = objPrivLandInfo.PRODASSETOPPORTUNITIES; pnlMailo.Visible = true; //ddlLandTenure.Enabled = false; } } }
/// <summary> /// To Get Relations /// </summary> /// <param name="householdID"></param> /// <param name="holderTypeID"></param> /// <returns></returns> public PAPRelationList GetRelations(int householdID, int holderTypeID) { proc = "USP_TRN_GET_PAPRELATIONS"; cnn = new OracleConnection(con); PAP_RelationBO objRelation = null; PAPRelationList Relations = new PAPRelationList(); cmd = new OracleCommand(proc, cnn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.Add("HOUSEHOLDID_", householdID); cmd.Parameters.Add("HOLDERTYPEID_", holderTypeID); 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("LTR_STATUS"))) { objRelation.LiteracyStatus = dr.GetString(dr.GetOrdinal("LTR_STATUS")); } if (!dr.IsDBNull(dr.GetOrdinal("CUR_SCH_STATUS"))) { objRelation.CurrentSchoolStatus = dr.GetString(dr.GetOrdinal("CUR_SCH_STATUS")); } if (!dr.IsDBNull(dr.GetOrdinal("NVR_ATT_SCH_REASON"))) { objRelation.NeverAttendedSchool = dr.GetString(dr.GetOrdinal("NVR_ATT_SCH_REASON")); } if (!dr.IsDBNull(dr.GetOrdinal("SCH_DRP_REASON"))) { objRelation.SchoolDropReason = dr.GetString(dr.GetOrdinal("SCH_DRP_REASON")); } if (!dr.IsDBNull(dr.GetOrdinal("ISDELETED"))) { objRelation.IsDeleted = dr.GetString(dr.GetOrdinal("ISDELETED")); } if (!dr.IsDBNull(dr.GetOrdinal("GENDER"))) { objRelation.Sex = dr.GetString(dr.GetOrdinal("GENDER")); } Relations.Add(objRelation); } dr.Close(); } catch (Exception ex) { throw ex; } return(Relations); }