Пример #1
0
        /// <summary>
        /// To Add Land Living On
        /// </summary>
        /// <param name="objSurvey"></param>
        /// <returns></returns>
        public string AddLandLivingOn(LandLivingOnBO objSurvey)
        {
            string           result = string.Empty;
            OracleConnection myConnection;
            OracleCommand    myCommand;

            myConnection          = new OracleConnection(AppConfiguration.ConnectionString);
            myCommand             = new OracleCommand("USP_TRN_UPD_LANDLIVINGON", myConnection);
            myCommand.Connection  = myConnection;
            myCommand.CommandType = CommandType.StoredProcedure;
            myCommand.Parameters.Add("HHID_", objSurvey.HouseholdID);
            myCommand.Parameters.Add("WHERELIVEDBEFORE_", objSurvey.WhereLivedBefore);
            myCommand.Parameters.Add("PREFERREDVILLAGE_", objSurvey.PreferredVillege);
            myCommand.Parameters.Add("ISOTHERLANDHOLDING_", objSurvey.IsOtherLandHold);
            myCommand.Parameters.Add("WHICHLANDHOLDING_", objSurvey.WhichLandHold);
            myCommand.Parameters.Add("REQUIRETRANSPORT_", objSurvey.RequireTransport);
            myCommand.Parameters.Add("MOVENEARRELATIVES_", objSurvey.MovenearRelatives);
            myCommand.Parameters.Add("BURIEDFAMILYMEMONLAND_", objSurvey.BuriedFamilyMemonLand);
            myCommand.Parameters.Add("HOWMANYBURIED_", objSurvey.HowmanyBuried);
            myCommand.Parameters.Add("RELOCATEANCESTORS_", objSurvey.RelocateAncestors);
            myCommand.Parameters.Add("DISTRICT_", objSurvey.District);
            myCommand.Parameters.Add("COUNTY_", objSurvey.County);
            myCommand.Parameters.Add("SUBCOUNTY_", objSurvey.Subcounty);
            myCommand.Parameters.Add("VILLAGE_", objSurvey.Village);
            myCommand.Parameters.Add("UPDATEDBY_", objSurvey.UpdatedBy);
            myCommand.Parameters.Add("errormessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output;
            myConnection.Open();
            myCommand.ExecuteNonQuery();
            if (myCommand.Parameters["errormessage_"].Value != null)
            {
                result = myCommand.Parameters["errormessage_"].Value.ToString();
            }
            myConnection.Close();
            return(result);
        }
Пример #2
0
        /// <summary>
        /// To Get Land Living On By HHID
        /// </summary>
        /// <param name="HHID"></param>
        /// <returns></returns>
        public LandLivingOnBO GetLandLivingOnByHHID(int HHID)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;
            string           proc = "USP_TRN_GET_LANDLIVINGON";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("HHID_", HHID);
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;
            cmd.Connection.Open();
            OracleDataReader dr       = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            LandLivingOnBO   obSurvey = null;

            while (dr.Read())
            {
                obSurvey = new LandLivingOnBO();
                if (!dr.IsDBNull(dr.GetOrdinal("WHERELIVEDBEFORE")))
                {
                    obSurvey.WhereLivedBefore = dr.GetString(dr.GetOrdinal("WHERELIVEDBEFORE"));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("PREFERREDVILLAGE")))
                {
                    obSurvey.PreferredVillege = dr.GetString(dr.GetOrdinal("PREFERREDVILLAGE"));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("ISOTHERLANDHOLDING")))
                {
                    obSurvey.IsOtherLandHold = dr.GetString(dr.GetOrdinal("ISOTHERLANDHOLDING"));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("WHICHLANDHOLDING")))
                {
                    obSurvey.WhichLandHold = dr.GetString(dr.GetOrdinal("WHICHLANDHOLDING"));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("REQUIRETRANSPORT")))
                {
                    obSurvey.RequireTransport = dr.GetString(dr.GetOrdinal("REQUIRETRANSPORT"));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("MOVENEARRELATIVES")))
                {
                    obSurvey.MovenearRelatives = dr.GetString(dr.GetOrdinal("MOVENEARRELATIVES"));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("BURIEDFAMILYMEMONLAND")))
                {
                    obSurvey.BuriedFamilyMemonLand = dr.GetString(dr.GetOrdinal("BURIEDFAMILYMEMONLAND"));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("HOWMANYBURIED")))
                {
                    obSurvey.HowmanyBuried = dr.GetString(dr.GetOrdinal("HOWMANYBURIED"));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("RELOCATEANCESTORS")))
                {
                    obSurvey.RelocateAncestors = dr.GetString(dr.GetOrdinal("RELOCATEANCESTORS"));
                }

                if (!dr.IsDBNull(dr.GetOrdinal("DISTRICT")))
                {
                    obSurvey.District = dr.GetString(dr.GetOrdinal("DISTRICT"));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("COUNTY")))
                {
                    obSurvey.County = dr.GetString(dr.GetOrdinal("COUNTY"));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("SUBCOUNTY")))
                {
                    obSurvey.Subcounty = dr.GetString(dr.GetOrdinal("SUBCOUNTY"));
                }
                if (!dr.IsDBNull(dr.GetOrdinal("VILLAGE")))
                {
                    obSurvey.Village = dr.GetString(dr.GetOrdinal("VILLAGE"));
                }
            }
            dr.Close();
            return(obSurvey);
        }
Пример #3
0
        /// <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);
            }
        }
Пример #4
0
        /// <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;
                        }
                    }
                }
            }
        }
Пример #5
0
        /// <summary>
        /// To Add Land Living On
        /// </summary>
        /// <param name="objSurvey"></param>
        /// <returns></returns>
        public string AddLandLivingOn(LandLivingOnBO objSurvey)
        {
            SurveyDAL objAddLandLivingDAL = new SurveyDAL();

            return(objAddLandLivingDAL.AddLandLivingOn(objSurvey));
        }