Example #1
0
        /// <summary>
        /// to get the data from the database and bind it to the gridview
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>

        private void BindGrid(bool addRow, bool deleteRow)
        {
            try
            {
                objSurveyBLL         = new SurveyBLL();
                objLandLivingOffList = new LandLivingOffList();
                objLandLivingOffList = objSurveyBLL.GetLivingOFF(Convert.ToInt32(Session["HH_ID"]));
                grdLandInfoRespondentsOff.DataSource = objLandLivingOffList;
                grdLandInfoRespondentsOff.DataBind();
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #2
0
        /// <summary>
        /// to save the data to the database
        /// call  ClearDetails() to clear the Details Fields
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>

        protected void btnSave_Click(object sender, EventArgs e)
        {
            objSurveyLandLivingOff = new LandLivingOffBO();
            objSurveyBLL           = new SurveyBLL();

            try
            {
                objSurveyLandLivingOff.LivingOffID = Convert.ToInt32(ViewState["LIVINGOFFID"]);
                objSurveyLandLivingOff.HouseholdID = Convert.ToInt32(Session["HH_ID"]);

                objSurveyLandLivingOff.DwellingID   = Convert.ToInt32(ddlDwelling.SelectedValue);
                objSurveyLandLivingOff.NoofRooms    = txtNoRooms.Text.Trim();
                objSurveyLandLivingOff.Str_TenureID = Convert.ToInt32(ddlTenureType.SelectedValue);
                objSurveyLandLivingOff.RoofID       = Convert.ToInt32(ddlRoof.SelectedValue);
                objSurveyLandLivingOff.WallID       = Convert.ToInt32(ddlWalls.SelectedValue);
                objSurveyLandLivingOff.FloorID      = Convert.ToInt32(ddlFloor.SelectedValue);
                objSurveyLandLivingOff.UpdatedBy    = Convert.ToInt32(Session["USER_ID"]);

                if (!string.IsNullOrEmpty(txttenure.Text))
                {
                    objSurveyLandLivingOff.Tenure = Convert.ToInt32(txttenure.Text);
                }
                else
                {
                    objSurveyLandLivingOff.Tenure = 0;
                }

                int i = objSurveyBLL.AddLandLivingOFF(objSurveyLandLivingOff);

                if (btnSave.Text == "Save")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('Data saved successfully');", true);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('Data updated successfully');", true);
                }
                ChangeRequestStatusLandInfoResOFF();
                ClearDetails();
                BindGrid(true, false);
                SetUpdateMode(false);
                projectFrozen();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertError", "alert('Error: " + ex.Message + "');", true);
            }
        }
Example #3
0
        /// <summary>
        /// Save and Update Data into Database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string message = string.Empty;

            try
            {
                ChangeRequestStatusAcrValuation();

                objAcreageValuation = new AffectedAcreageValuationBO();

                objSurveyBLL = new SurveyBLL();
                objAcreageValuation.HouseholdID       = Convert.ToInt32(Session["HH_ID"]);
                objAcreageValuation.Landowner         = txtLandOwner.Text.Trim();
                objAcreageValuation.Landblock         = txtLandBlock.Text.Trim();
                objAcreageValuation.Landplot          = txtLandPlot.Text.Trim();
                objAcreageValuation.Proprietorid      = Convert.ToInt32(ddlCurrentOperation.SelectedValue);
                objAcreageValuation.Wholeacreageacres = txtAcreageAcres.Text.Trim();
                objAcreageValuation.Rowacres          = Convert.ToDecimal(lblAcres.Text);
                objAcreageValuation.Rowlandvalueshare = Convert.ToDecimal(ddlRowLandvalshare.SelectedValue);
                objAcreageValuation.Rowrateperacre    = Convert.ToDecimal(txtRatePerAcres.Text.Trim());
                objAcreageValuation.Rowlandvalue      = Convert.ToDecimal(lblRowLandVal.Text);
                objAcreageValuation.Wlacres           = Convert.ToDecimal(lblWayleavesAcres.Text);
                objAcreageValuation.Wllandvalueshare  = Convert.ToDecimal(ddlWayleaveShareLandVal.SelectedValue);
                objAcreageValuation.Dimunitionlevel   = Convert.ToDecimal(ddlDimunition.SelectedValue);
                objAcreageValuation.Wlrateperacre     = Convert.ToDecimal(txtWayleaveRateperAcres.Text.Trim());
                objAcreageValuation.Wllandvalue       = Convert.ToDecimal(lblWayleavelandVal.Text);
                objAcreageValuation.UpdatedBy         = Convert.ToInt32(Session["USER_ID"]);
                objAcreageValuation.LocClassification = ddlLocClassification.SelectedValue;

                message = objSurveyBLL.AddAffectedAcreageValuation(objAcreageValuation);

                if (btnSave.Text == "Save")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "ShowSaveMessage('');", true);
                }
                else
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "ShowUpdateMessage('');", true);
                }
                projectFrozen();
                SetUpdateMode(true);
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('Error: " + ex.Message + "');", true);
            }
        }
Example #4
0
        /// <summary>
        /// Get Affected Acreage Valuation Data
        /// </summary>
        private void GetAffectedAcreageValuation()
        {
            objSurveyBLL        = new SurveyBLL();
            objAcreageValuation = objSurveyBLL.GetAffectedAcreageValuation(Convert.ToInt32(Session["HH_ID"]));

            if (objAcreageValuation != null)
            {
                txtLandOwner.Text = objAcreageValuation.Landowner;
                txtLandBlock.Text = objAcreageValuation.Landblock;
                txtLandPlot.Text  = objAcreageValuation.Landplot;
                //BindProprietor();
                ddlCurrentOperation.ClearSelection();
                if (ddlCurrentOperation.Items.FindByValue(objAcreageValuation.Proprietorid.ToString()) != null)
                {
                    ddlCurrentOperation.Items.FindByValue(objAcreageValuation.Proprietorid.ToString()).Selected = true;
                }
                txtAcreageAcres.Text = objAcreageValuation.Wholeacreageacres;

                txtRightWay.Text = Convert.ToString(objAcreageValuation.Rowacres);
                lblAcres.Text    = Convert.ToString(objAcreageValuation.Rowacres);
                if (ddlRowLandvalshare.Items.FindByValue(objAcreageValuation.Rowlandvalueshare.ToString()) != null)
                {
                    ddlRowLandvalshare.Items.FindByValue(objAcreageValuation.Rowlandvalueshare.ToString()).Selected = true;
                }
                txtRatePerAcres.Text   = UtilBO.CurrencyFormat(objAcreageValuation.Rowrateperacre);
                lblRowLandVal.Text     = UtilBO.CurrencyFormat(objAcreageValuation.Rowlandvalue);//Convert.ToString(objAcreageValuation.Rowlandvalue);
                txtWayleave.Text       = Convert.ToString(objAcreageValuation.Wlacres);
                lblWayleavesAcres.Text = Convert.ToString(objAcreageValuation.Wlacres);
                if (ddlDimunition.Items.FindByValue(objAcreageValuation.Dimunitionlevel.ToString()) != null)
                {
                    ddlDimunition.Items.FindByValue(objAcreageValuation.Dimunitionlevel.ToString()).Selected = true;
                }
                if (ddlWayleaveShareLandVal.Items.FindByValue(objAcreageValuation.Wllandvalueshare.ToString()) != null)
                {
                    ddlWayleaveShareLandVal.Items.FindByValue(objAcreageValuation.Wllandvalueshare.ToString()).Selected = true;
                }
                txtWayleaveRateperAcres.Text = UtilBO.CurrencyFormat(objAcreageValuation.Wlrateperacre);

                lblWayleavelandVal.Text = UtilBO.CurrencyFormat(objAcreageValuation.Wllandvalue);// Convert.ToString(objAcreageValuation.Wllandvalue);

                if (txtRightWay.Text.Trim() != "" && txtWayleave.Text.Trim() != "")
                {
                    lblTotal.Text = Math.Round((Convert.ToDecimal(txtRightWay.Text.Trim()) + Convert.ToDecimal(txtWayleave.Text.Trim())), 2).ToString("N2");
                }

                string str1 = txtAcreageAcres.Text.Trim();
                if (string.IsNullOrEmpty(str1) == false)
                {
                    double t  = Convert.ToDouble(txtAcreageAcres.Text.Trim());
                    double Ha = Math.Round((t / acrehaconvert), 4);
                    txtAcreageHA.Text = Ha.ToString();
                }
                upnAcreageHA.Update();

                RightOfWayUnitConversion(ddlMeasure.SelectedItem.Value);
                WayLeaveUnitConversion(ddlMeasure.SelectedItem.Value);
                TotalUnitConversion(ddlMeasure.SelectedItem.Value);
                if (txtLandOwner.Text.Trim() == "")
                {
                    SetUpdateMode(false);
                }
                else
                {
                    SetUpdateMode(true);
                }
            }
        }
Example #5
0
        /// <summary>
        /// For Edit and delete command
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void grdLandInfoRespondentsOff_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditRow")
            {
                ViewState["LIVINGOFFID"] = e.CommandArgument;
                objSurveyBLL             = new SurveyBLL();
                objSurveyLandLivingOff   = objSurveyBLL.GetLivingOFFByID(Convert.ToInt32(ViewState["LIVINGOFFID"]));
                //bindDDLDwelling();
                //bindDDLTenure();
                //bindDDLRoofs();
                //bindDDLWall();
                //bindDDLFloor();

                ddlDwelling.ClearSelection();
                if (ddlDwelling.Items.FindByValue(objSurveyLandLivingOff.DwellingID.ToString()) != null)
                {
                    ddlDwelling.Items.FindByValue(objSurveyLandLivingOff.DwellingID.ToString()).Selected = true;
                }
                ddlTenureType.ClearSelection();
                if (ddlTenureType.Items.FindByValue(objSurveyLandLivingOff.Str_TenureID.ToString()) != null)
                {
                    ddlTenureType.Items.FindByValue(objSurveyLandLivingOff.Str_TenureID.ToString()).Selected = true;
                }
                ddlRoof.ClearSelection();
                if (ddlRoof.Items.FindByValue(objSurveyLandLivingOff.RoofID.ToString()) != null)
                {
                    ddlRoof.Items.FindByValue(objSurveyLandLivingOff.RoofID.ToString()).Selected = true;
                }
                ddlWalls.ClearSelection();
                if (ddlWalls.Items.FindByValue(objSurveyLandLivingOff.WallID.ToString()) != null)
                {
                    ddlWalls.Items.FindByValue(objSurveyLandLivingOff.WallID.ToString()).Selected = true;
                }
                ddlFloor.ClearSelection();
                if (ddlFloor.Items.FindByValue(objSurveyLandLivingOff.FloorID.ToString()) != null)
                {
                    ddlFloor.Items.FindByValue(objSurveyLandLivingOff.FloorID.ToString()).Selected = true;
                }

                txtNoRooms.Text = objSurveyLandLivingOff.NoofRooms;

                //ddlTenureType.ClearSelection();
                //if (ddlTenureType.Items.FindByValue(objSurveyLandLivingOff.Str_Tenure.ToString()) != null)
                //    ddlTenureType.Items.FindByValue(objSurveyLandLivingOff.Str_Tenure.ToString()).Selected = true;

                if (objSurveyLandLivingOff.Tenure > 0)
                {
                    txttenure.Text = objSurveyLandLivingOff.Tenure.ToString();
                }

                SetUpdateMode(true);
            }

            else if (e.CommandName == "DeleteRow")
            {
                int livingoffID = Convert.ToInt32(e.CommandArgument);
                objSurveyBLL = new SurveyBLL();
                objSurveyBLL.DeleteLivingOFF(livingoffID);
                ClearDetails();
                BindGrid(false, true);
                SetUpdateMode(false);
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Data deleted successfully');", true);
            }
        }
        /// <summary>
        /// to get the Land info fro the database
        /// </summary>
        private void GetLandInfo()
        {
            SurveyBLL      objSurveyBLL = new SurveyBLL();
            LandLivingOnBO objSurvey    = objSurveyBLL.GetLandLivingOnByHHID(Convert.ToInt32(Session["HH_ID"]));

            if (objSurvey != null)
            {
                txtLivingbefore.Text = objSurvey.WhereLivedBefore;
                //txtVillage.Text = objSurvey.PreferredVillege;
                if (objSurvey.IsOtherLandHold == "Yes")
                {
                    chkLandHold.Checked    = true;
                    txtYesLandHold.Text    = objSurvey.WhichLandHold;
                    txtYesLandHold.Enabled = true;
                }
                else if (objSurvey.IsOtherLandHold == "No")
                {
                    chkLandHold.Checked    = false;
                    txtYesLandHold.Text    = "";
                    txtYesLandHold.Enabled = false;
                }

                if (objSurvey.RequireTransport == "Yes")
                {
                    chkTransport.Checked = true;
                }
                else if (objSurvey.RequireTransport == "No")
                {
                    chkTransport.Checked = false;
                }

                if (objSurvey.MovenearRelatives == "Yes")
                {
                    chkRelative.Checked = true;
                }
                else if (objSurvey.MovenearRelatives == "No")
                {
                    chkRelative.Checked = false;
                }

                if (objSurvey.BuriedFamilyMemonLand == "Yes")
                {
                    chkFamilyMember.Checked = true;
                    txtBuried.Enabled       = true;
                }
                else if (objSurvey.BuriedFamilyMemonLand == "No")
                {
                    chkFamilyMember.Checked = false;
                    txtBuried.Enabled       = false;
                }

                txtBuried.Text = objSurvey.HowmanyBuried;

                if (objSurvey.RelocateAncestors == "Yes")
                {
                    chkAncestors.Checked = true;
                }
                else if (objSurvey.RelocateAncestors == "No")
                {
                    chkAncestors.Checked = false;
                }

                ddlDistrict.ClearSelection();
                if (ddlDistrict.Items.FindByText(objSurvey.District) != null)
                {
                    ddlDistrict.Items.FindByText(objSurvey.District).Selected = true;
                }

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

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

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

                if (ddlSubCounty.SelectedIndex > 0)
                {
                    BindVillages(ddlSubCounty.SelectedItem.Value);
                    if (Convert.ToString(objSurvey.Village) != "")
                    {
                        ddlVillage.ClearSelection();
                        if (ddlVillage.Items.FindByText(objSurvey.Village) != null)
                        {
                            ddlVillage.Items.FindByText(objSurvey.Village).Selected = true;
                        }
                    }
                }
            }
        }
        /// <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)
        {
            ChangeRequestStatusLandInfoResOn();

            LandLivingOnBO objLand = new LandLivingOnBO();

            try
            {
                string message = string.Empty;
                objLand.HouseholdID      = Convert.ToInt32(Session["HH_ID"]);
                objLand.WhereLivedBefore = txtLivingbefore.Text.Trim();
                //objLand.PreferredVillege = txtVillage.Text.Trim();

                objLand.District  = ddlDistrict.SelectedItem.Text;
                objLand.County    = ddlCounty.SelectedItem.Text;
                objLand.Subcounty = ddlSubCounty.SelectedItem.Text;
                objLand.Village   = ddlVillage.SelectedItem.Text;
                if (chkLandHold.Checked == true)
                {
                    objLand.IsOtherLandHold = "Yes";
                    objLand.WhichLandHold   = txtYesLandHold.Text.Trim();
                    txtYesLandHold.Enabled  = true;
                }
                else if (chkLandHold.Checked == false)
                {
                    objLand.IsOtherLandHold = "No";
                    objLand.WhichLandHold   = "";
                    txtYesLandHold.Enabled  = false;
                }
                if (chkTransport.Checked == true)
                {
                    objLand.RequireTransport = "Yes";
                }
                else if (chkTransport.Checked == false)
                {
                    objLand.RequireTransport = "No";
                }
                if (chkRelative.Checked == true)
                {
                    objLand.MovenearRelatives = "Yes";
                }
                else if (chkRelative.Checked == false)
                {
                    objLand.MovenearRelatives = "No";
                }

                if (chkFamilyMember.Checked == true)
                {
                    objLand.BuriedFamilyMemonLand = "Yes";
                    objLand.HowmanyBuried         = txtBuried.Text.Trim();
                    txtBuried.Enabled             = true;
                }
                else if (chkFamilyMember.Checked == false)
                {
                    objLand.BuriedFamilyMemonLand = "No";
                    objLand.HowmanyBuried         = "";
                    txtBuried.Enabled             = false;
                }

                if (chkAncestors.Checked == true)
                {
                    objLand.RelocateAncestors = "Yes";
                }
                else if (chkAncestors.Checked == false)
                {
                    objLand.RelocateAncestors = "No";
                }
                objLand.UpdatedBy = Convert.ToInt32(Session["USER_ID"]);
                SurveyBLL objSurveyBLL = new SurveyBLL();

                message = objSurveyBLL.AddLandLivingOn(objLand);

                if (message == "I")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('Data saved successfully');", true);
                }
                else if (message == "U")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "", "alert('Data updated successfully');", true);
                }
                projectFrozen();
            }
            catch (Exception ex)
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "AlertError", "alert('Error: " + ex.Message + "');", true);
            }
        }