Ejemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            ChangeRequestStatusInstitution();

            PAP_InstitutionBO objInstitution = new PAP_InstitutionBO();

            objInstitution.HHID              = Convert.ToInt32(Session["HH_ID"]);
            objInstitution.Paptype           = ddlPaptype.SelectedValue;
            objInstitution.InstitutionNameIN = txtName.Text;
            objInstitution.DistrictIN        = ddlDistrict.SelectedItem.Text;
            objInstitution.CountyIN          = ddlCounty.SelectedItem.Text;
            objInstitution.SubCountyIN       = ddlSubCounty.SelectedItem.Text;
            objInstitution.ParishIN          = ddlParish.SelectedItem.Text;
            objInstitution.VillageIN         = ddlVillage.SelectedItem.Text;
            objInstitution.OptionGroupIdIN   = Convert.ToInt32(ddloptionGroup.SelectedItem.Value);
            objInstitution.NoofplotsIN       = Convert.ToInt32(txtPlots.Text);
            objInstitution.PlotReferenceIN   = txtPlotReference.Text;
            objInstitution.DateofBirthIN     = Convert.ToDateTime(dpDateofBirth.Text.ToString());
            objInstitution.IsResidentIN      = rdlResident.SelectedItem.Text;
            objInstitution.SexIN             = ddlGender.SelectedItem.Text;
            objInstitution.SurnameIN         = txtSurname.Text;
            objInstitution.FirstnameIN       = txtfirstname.Text;
            objInstitution.OthernameIN       = txtOthername.Text;
            objInstitution.UpdatedbyIN       = Convert.ToInt32(Session["USER_ID"]);
            objInstitution.POSITIONID        = Convert.ToInt32(ddlPosition.SelectedValue);
            objInstitution.CONT_DISTRICT     = ddlCPDistrict.SelectedItem.Text;
            objInstitution.CONT_COUNTY       = ddlCPCounty.SelectedItem.Text;
            objInstitution.CONT_SUBCOUNTY    = ddlCPSubCounty.SelectedItem.Text;
            objInstitution.CONT_PARISH       = ddlCPParish.SelectedItem.Text;
            objInstitution.CONT_VILLAGE      = ddlCPVillage.SelectedItem.Text;
            objInstitution.Gouallowance      = ddlGouAllowance.SelectedValue;
            objInstitution.Undertakingperiod = ddlUnderTakingPeriod.SelectedValue;
            objInstitution.CONTACTPHONE1     = txtTelephoneNo1.Text;
            objInstitution.CONTACTPHONE2     = txtTelephoneNo2.Text;
            objInstitution.CreatedBy         = Convert.ToInt32(Session["USER_ID"]);
            objInstitution.UpdatedBy         = Convert.ToInt32(Session["USER_ID"]);
            objInstitution.Papuid            = txtPapUid.Text.Trim();
            if (dpCapturedDate.Text.ToString().Trim() != "" && dpCapturedDate.Text.ToString().Trim() != "1/1/0001")
            {
                objInstitution.CapturedDate = dpCapturedDate.Text.ToString();
            }
            objInstitution.CapturedBy = txtCapturedBy.Text;

            PAP_InstitutionBLL objInstBll = new PAP_InstitutionBLL();
            string             message    = objInstBll.UpdateInstitutionDetails(objInstitution);

            //Edwin: 19SEP2016 Reload Pap Details
            ReCache(Convert.ToInt32(Session["HH_ID"]));

            txtFullname.Text = txtSurname.Text + " " + txtfirstname.Text;
            projectFrozen();
            checkApprovalExitOrNot();
            if (string.IsNullOrEmpty(message) || message == "" || message == "null")
            {
                message = "Data saved successfully";
            }
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  to get the Instruction Data from the database
        /// </summary>

        private void GetInstContactData()
        {
            int HHID = Convert.ToInt32(Session["HH_ID"]);
            PAP_HouseholdBLL objHouseHoldBLL = new PAP_HouseholdBLL();
            PAP_HouseholdBO  objHouseHold    = objHouseHoldBLL.GetHouseHoldData(HHID);

            if (objHouseHold != null)
            {
                txtHouseHoldID.Text   = Convert.ToString(objHouseHold.HhId);
                txtName.Text          = Convert.ToString(objHouseHold.InstitutionName);
                txtPlots.Text         = Convert.ToString(objHouseHold.Noofplots);
                txtPlotReference.Text = Convert.ToString(objHouseHold.PlotReference);
                txtSurname.Text       = Convert.ToString(objHouseHold.Surname);
                txtfirstname.Text     = Convert.ToString(objHouseHold.Firstname);
                txtOthername.Text     = Convert.ToString(objHouseHold.Othername);
                //Ediwn: 27SEP2016
                txtFullname.Text = txtSurname.Text + " " + txtfirstname.Text + " " + txtOthername.Text;
                txtPapUid.Text   = Convert.ToString(objHouseHold.Papuid);

                if (objHouseHold.CapturedDate.Trim() != "")
                {
                    dpCapturedDate.Text = Convert.ToDateTime(objHouseHold.CapturedDate).ToString(UtilBO.DateFormat);
                }
                txtCapturedBy.Text = Convert.ToString(objHouseHold.CapturedBy);

                ddlGouAllowance.ClearSelection();
                if (ddlGouAllowance.Items.FindByValue(objHouseHold.GouStatus.ToString()) != null)
                {
                    ddlGouAllowance.Items.FindByValue(objHouseHold.GouStatus.ToString()).Selected = true;
                }

                ddlUnderTakingPeriod.ClearSelection();
                if (ddlUnderTakingPeriod.Items.FindByValue(objHouseHold.UnderTakingPeriod.ToString()) != null)
                {
                    ddlUnderTakingPeriod.Items.FindByValue(objHouseHold.UnderTakingPeriod.ToString()).Selected = true;
                }

                rdlResident.ClearSelection();
                if (objHouseHold.Isresident == "No")
                {
                    rdlResident.Items[1].Selected = true;
                }
                else
                {
                    rdlResident.Items[0].Selected = true;
                }
                ddloptionGroup.SelectedValue = Convert.ToString(objHouseHold.OptiongroupId);

                ddlGender.ClearSelection();
                if (ddlGender.Items.FindByValue(objHouseHold.Sex) != null)
                {
                    ddlGender.Items.FindByValue(objHouseHold.Sex).Selected = true;
                }

                if (objHouseHold.DateofBirth.Trim() != "")
                {
                    dpDateofBirth.Text = Convert.ToDateTime(objHouseHold.DateofBirth).ToString(UtilBO.DateFormat);
                }

                ddlDistrict.ClearSelection();
                if (ddlDistrict.Items.FindByText(Convert.ToString(objHouseHold.District).ToUpper()) != null)
                {
                    ddlDistrict.Items.FindByText(Convert.ToString(objHouseHold.District).ToUpper()).Selected = true;
                }

                if (ddlDistrict.SelectedIndex > 0)
                {
                    BindCounties(ddlDistrict.SelectedItem.Value, ddlCounty);

                    if (Convert.ToString(objHouseHold.County) != "")
                    {
                        ddlCounty.ClearSelection();
                        if (ddlCounty.Items.FindByText(Convert.ToString(objHouseHold.County).ToUpper()) != null)
                        {
                            ddlCounty.Items.FindByText(Convert.ToString(objHouseHold.County).ToUpper()).Selected = true;
                        }
                    }
                }

                if (ddlCounty.SelectedIndex > 0)
                {
                    BindSubCounties(ddlCounty.SelectedItem.Value, ddlSubCounty);
                    if (Convert.ToString(objHouseHold.SubCounty) != "")
                    {
                        ddlSubCounty.ClearSelection();
                        if (ddlSubCounty.Items.FindByText(Convert.ToString(objHouseHold.SubCounty).ToUpper()) != null)
                        {
                            ddlSubCounty.Items.FindByText(Convert.ToString(objHouseHold.SubCounty).ToUpper()).Selected = true;
                        }
                    }
                }

                if (ddlSubCounty.SelectedIndex > 0)
                {
                    BindVillages(ddlSubCounty.SelectedItem.Value, ddlVillage);
                    if (Convert.ToString(objHouseHold.Village) != "")
                    {
                        ddlVillage.ClearSelection();
                        if (ddlVillage.Items.FindByText(Convert.ToString(objHouseHold.Village).ToUpper()) != null)
                        {
                            ddlVillage.Items.FindByText(Convert.ToString(objHouseHold.Village).ToUpper()).Selected = true;
                        }
                    }
                    BindParish(ddlSubCounty.SelectedItem.Value, ddlParish);
                    if (Convert.ToString(objHouseHold.Village) != "")
                    {
                        ddlParish.ClearSelection();
                        if (ddlParish.Items.FindByText(Convert.ToString(objHouseHold.Parish).ToUpper()) != null)
                        {
                            ddlParish.Items.FindByText(Convert.ToString(objHouseHold.Parish).ToUpper()).Selected = true;
                        }
                    }
                }
                PAP_InstitutionBLL  objInstitutionBLL      = new PAP_InstitutionBLL();
                PAP_InstitutionList objPAP_InstitutionList = objInstitutionBLL.GetInstContactByHHID(HHID);
                if (objPAP_InstitutionList.Count > 0)
                {
                    ddlPosition.ClearSelection();
                    ddlPosition.SelectedValue = (Convert.ToString(objPAP_InstitutionList[0].POSITIONID));

                    ddlCPDistrict.ClearSelection();
                    if (ddlCPDistrict.Items.FindByText(Convert.ToString(objPAP_InstitutionList[0].CONT_DISTRICT).ToUpper()) != null)
                    {
                        ddlCPDistrict.Items.FindByText(Convert.ToString(objPAP_InstitutionList[0].CONT_DISTRICT).ToUpper()).Selected = true;
                    }

                    if (ddlCPDistrict.SelectedIndex > 0)
                    {
                        BindCounties(ddlCPDistrict.SelectedItem.Value, ddlCPCounty);

                        if (Convert.ToString(objHouseHold.County) != "")
                        {
                            ddlCPCounty.ClearSelection();
                            if (ddlCPCounty.Items.FindByText(Convert.ToString(objPAP_InstitutionList[0].CONT_COUNTY).ToUpper()) != null)
                            {
                                ddlCPCounty.Items.FindByText(Convert.ToString(objPAP_InstitutionList[0].CONT_COUNTY).ToUpper()).Selected = true;
                            }
                        }
                    }

                    if (ddlCPCounty.SelectedIndex > 0)
                    {
                        BindSubCounties(ddlCPCounty.SelectedItem.Value, ddlCPSubCounty);
                        uplCPSubCounty.Update();
                        if (Convert.ToString(objHouseHold.SubCounty) != "")
                        {
                            ddlCPSubCounty.ClearSelection();
                            if (ddlCPSubCounty.Items.FindByText(Convert.ToString(objPAP_InstitutionList[0].CONT_SUBCOUNTY).ToUpper()) != null)
                            {
                                ddlCPSubCounty.Items.FindByText(Convert.ToString(objPAP_InstitutionList[0].CONT_SUBCOUNTY).ToUpper()).Selected = true;
                            }
                        }
                    }


                    if (ddlCPSubCounty.SelectedIndex > 0)
                    {
                        BindVillages(ddlCPSubCounty.SelectedItem.Value, ddlCPVillage);
                        uplCPVillage.Update();
                        if (Convert.ToString(objHouseHold.Village) != "")
                        {
                            ddlCPVillage.ClearSelection();
                            if (ddlCPVillage.Items.FindByText(Convert.ToString(objPAP_InstitutionList[0].CONT_VILLAGE).ToUpper()) != null)
                            {
                                ddlCPVillage.Items.FindByText(Convert.ToString(objPAP_InstitutionList[0].CONT_VILLAGE).ToUpper()).Selected = true;
                            }
                        }
                        BindParish(ddlCPSubCounty.SelectedItem.Value, ddlCPParish);
                        uplCPParish.Update();
                        if (Convert.ToString(objHouseHold.Village) != "")
                        {
                            ddlCPParish.ClearSelection();
                            if (ddlCPParish.Items.FindByText(Convert.ToString(objPAP_InstitutionList[0].CONT_PARISH).ToUpper()) != null)
                            {
                                ddlCPParish.Items.FindByText(Convert.ToString(objPAP_InstitutionList[0].CONT_PARISH).ToUpper()).Selected = true;
                            }
                        }
                    }
                    txtTelephoneNo1.Text = Convert.ToString(objPAP_InstitutionList[0].CONTACTPHONE1);
                    txtTelephoneNo2.Text = Convert.ToString(objPAP_InstitutionList[0].CONTACTPHONE2);
                }

                getImage(HHID);
                //imgPAPPhoto.ImageUrl = "~/ShowImage.ashx?photoModule=PAP&perStuID=0&id=" + HHID.ToString();
            }
        }