/// <summary> /// to get the data from the database and bind it to the gridview grdGroupMembers /// </summary> private void BindGrid() { int householdID = Convert.ToInt32(Session["HH_ID"]); PAP_GroupOwnershipBLL objGroupOwnershipBLL = new PAP_GroupOwnershipBLL(); grdGroupMembers.DataSource = objGroupOwnershipBLL.GetGroupOwnershipByHHID(householdID); grdGroupMembers.DataBind(); }
/// <summary> /// to save the data to the database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSave_Click(object sender, EventArgs e) { getApprrequtStatusGroupOwnerShip();//add by ramu.s @ 11 /07/2013 PAP_GroupOwnershipBO objGroupOwnership = new PAP_GroupOwnershipBO(); objGroupOwnership.HHID = Convert.ToInt32(Session["HH_ID"]); objGroupOwnership.Paptype = ddlPaptype.SelectedValue; objGroupOwnership.Papuid = txtPapUid.Text.Trim(); objGroupOwnership.DistrictIN = ddlDistrict.SelectedItem.Text; objGroupOwnership.CountyIN = ddlCounty.SelectedItem.Text; objGroupOwnership.SubCountyIN = ddlSubCounty.SelectedItem.Text; objGroupOwnership.ParishIN = ddlParish.SelectedItem.Text; objGroupOwnership.VillageIN = ddlVillage.SelectedItem.Text; objGroupOwnership.OptionGroupIdIN = Convert.ToInt32(ddloptionGroup.SelectedItem.Value); objGroupOwnership.PlotReferenceIN = txtPlotReference.Text; objGroupOwnership.DateofBirthIN = Convert.ToDateTime(dpDateofBirth.Text.ToString()); objGroupOwnership.IsResidentIN = rdlResident.SelectedItem.Text; objGroupOwnership.SexIN = ddlGender.SelectedItem.Text; objGroupOwnership.SurnameIN = txtSurname.Text; objGroupOwnership.FirstnameIN = txtfirstname.Text; objGroupOwnership.OthernameIN = txtOthername.Text; objGroupOwnership.PositionidIN = Convert.ToInt32(ddlPosition.SelectedValue); objGroupOwnership.Contactphone1IN = txtTelephoneNo1.Text; objGroupOwnership.Contactphone2IN = txtTelephoneNo2.Text; objGroupOwnership.Gouallowance = ddlGouAllowance.SelectedValue; objGroupOwnership.Undertakingperiod = ddlUnderTakingPeriod.SelectedValue; objGroupOwnership.Createdby = Convert.ToInt32(Session["USER_ID"]); if (dpCapturedDate.Text.ToString().Trim() != "" && dpCapturedDate.Text.ToString().Trim() != "1/1/0001") { objGroupOwnership.CapturedDate = dpCapturedDate.Text.ToString(); } objGroupOwnership.CapturedBy = txtCapturedBy.Text; PAP_GroupOwnershipBLL objGroupOwnershipBll = new PAP_GroupOwnershipBLL(); string message = objGroupOwnershipBll.UpdateGroupOwnershipDetails(objGroupOwnership); txtFullname.Text = txtSurname.Text + " " + txtfirstname.Text + " " + txtOthername.Text; projectFrozen();//add by ramu.s @ 11 /07/2013 ChangeRequestStatusGroupOwnerShip(); if (string.IsNullOrEmpty(message) || message == "" || message == "null") { message = "Data saved successfully"; } ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true); // Re Cache Pap Details ReCache(Convert.ToInt32(Session["HH_ID"])); }
/// <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 grdGroupMembers_RowCommand(object sender, GridViewCommandEventArgs e) { if (e.CommandName == "EditRow") { ViewState["Groupmemberid"] = e.CommandArgument; PAP_GroupOwnershipBLL objGroupOwnershipBLL = new PAP_GroupOwnershipBLL(); PAP_GroupOwnershipList objGroupOwnershipList = objGroupOwnershipBLL.GetGroupOwnershipByHHID(Convert.ToInt32(Session["HH_ID"])); if (objGroupOwnershipList.Count > 0) { for (int iset = 0; iset < objGroupOwnershipList.Count; iset++) { if (Convert.ToString(ViewState["Groupmemberid"]) == Convert.ToString(objGroupOwnershipList[iset].Groupmemberid)) { txtMeberSurname.Text = objGroupOwnershipList[iset].SurnameIN; txtMeberFirstname.Text = objGroupOwnershipList[iset].FirstnameIN; txtMeberOthername.Text = objGroupOwnershipList[iset].OthernameIN; txtMeberFullname.Text = txtMeberSurname.Text + " " + txtMeberFirstname.Text; btnSavemember.Text = "Update"; btnClearMember.Text = "Cancel"; } } } } else if (e.CommandName == "DeleteRow") { PAP_GroupOwnershipBLL objGroupOwnershipBLL = new PAP_GroupOwnershipBLL(); objGroupOwnershipBLL.DeleteGroupOwnershipByGMID(Convert.ToInt32(e.CommandArgument)); // Reload Pap Details ReCache(Convert.ToInt32(Session["HH_ID"])); ViewState["RELATION_ID"] = "0"; txtMeberSurname.Text = ""; txtMeberFirstname.Text = ""; txtMeberOthername.Text = ""; txtMeberFullname.Text = ""; ViewState["Groupmemberid"] = 0; btnSavemember.Text = "Save"; btnClearMember.Text = "Clear"; BindGrid(); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Selected Group Member Deleted successfully');", true); } }
/// <summary> /// to save the member data to the database /// </summary> /// <param name="sender"></param> /// <param name="e"></param> protected void btnSavemember_Click(object sender, EventArgs e) { PAP_GroupOwnershipBO objGroupOwnership = new PAP_GroupOwnershipBO(); if (ViewState["Groupmemberid"] != null) { objGroupOwnership.Groupmemberid = Convert.ToInt32(ViewState["Groupmemberid"]); } else { objGroupOwnership.Groupmemberid = 0; } objGroupOwnership.HHID = Convert.ToInt32(Session["HH_ID"]); objGroupOwnership.SurnameIN = txtMeberSurname.Text; objGroupOwnership.FirstnameIN = txtMeberFirstname.Text; objGroupOwnership.OthernameIN = txtMeberOthername.Text; objGroupOwnership.Createdby = Convert.ToInt32(Session["USER_ID"]); PAP_GroupOwnershipBLL objGroupOwnershipBll = new PAP_GroupOwnershipBLL(); objGroupOwnershipBll.InsertandUpdateGroupOwnership(objGroupOwnership); // Reload Pap Details ReCache(Convert.ToInt32(Session["HH_ID"])); ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Data saved successfully');", true); txtMeberSurname.Text = ""; txtMeberFirstname.Text = ""; txtMeberOthername.Text = ""; txtMeberFullname.Text = ""; ViewState["Groupmemberid"] = 0; btnSavemember.Text = "Save"; btnClearMember.Text = "Clear"; projectFrozen(); //add by ramu.s @ 11 /07/2013 getApprrequtStatusGroupMemberShip(); //add by ramu.s @ 11 /07/2013 BindGrid(); }