/// <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> /// 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 grdAffectedLandUsers_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditRow") { ViewState["LANDUSER_ID"] = e.CommandArgument; PAP_RelationBLL objAffLandUserBLL = new PAP_RelationBLL(); PAP_AffectedLandUserList AffecLandUserList = objAffLandUserBLL.GetAffectedLandUsers(Convert.ToInt32(ViewState["LANDUSER_ID"]), Convert.ToInt32(Session["HH_ID"])); AffectedLandUserBO objAffLandUser = AffecLandUserList[0]; txtAffecLandUserName.Text = objAffLandUser.LandUserName; ddlStatus.ClearSelection(); ddlStatus.Items.FindByValue(objAffLandUser.StatusID.ToString()).Selected = true; txtRelatedTo.Text = objAffLandUser.RelatedTo; txtTimeOnLand.Text = objAffLandUser.TimeOnLand; SetLandUserUPDMode(true); } else if (e.CommandName == "DeleteRow") { ViewState["LANDUSER_ID"] = e.CommandArgument; PAP_RelationBLL objAffLandUserBLL = new PAP_RelationBLL(); objAffLandUserBLL.DeleteAffectedLandUser(Convert.ToInt32(ViewState["LANDUSER_ID"]), Convert.ToInt32(Session["USER_ID"])); ClearLandUserDetails(); SetLandUserUPDMode(false); BindAffectedLandUsers(); } }
/// <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> /// 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> /// 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(); } }