Esempio n. 1
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);
            }
        }
Esempio n. 2
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);
            }
        }
Esempio n. 3
0
        /// <summary>
        /// To Add Land Living OFF
        /// </summary>
        /// <param name="objSurveyLandLivingOff"></param>
        /// <returns></returns>
        public int AddLandLivingOFF(LandLivingOffBO objSurveyLandLivingOff)
        {
            int result = 0;
            OracleConnection myConnection;
            OracleCommand    myCommand;

            myConnection          = new OracleConnection(AppConfiguration.ConnectionString);
            myCommand             = new OracleCommand("USP_TRN_UPD_LANDLIVINGOFF", myConnection);
            myCommand.Connection  = myConnection;
            myCommand.CommandType = CommandType.StoredProcedure;
            myCommand.Parameters.Add("LIVINGOFFID_", objSurveyLandLivingOff.LivingOffID);
            myCommand.Parameters.Add("HHID_", objSurveyLandLivingOff.HouseholdID);
            myCommand.Parameters.Add("DWELLINGID_", objSurveyLandLivingOff.DwellingID);
            myCommand.Parameters.Add("NOOFROOMS_", objSurveyLandLivingOff.NoofRooms);

            if (objSurveyLandLivingOff.Str_TenureID > 0)
            {
                myCommand.Parameters.Add("STR_TENUREID_", objSurveyLandLivingOff.Str_TenureID);
            }
            else
            {
                myCommand.Parameters.Add("STR_TENUREID_", DBNull.Value);
            }

            if (objSurveyLandLivingOff.Tenure > 0)
            {
                myCommand.Parameters.Add("TENURE_", objSurveyLandLivingOff.Tenure);
            }
            else
            {
                myCommand.Parameters.Add("TENURE_", DBNull.Value);
            }

            if (objSurveyLandLivingOff.RoofID > 0)
            {
                myCommand.Parameters.Add("ROOFID_", objSurveyLandLivingOff.RoofID);
            }
            else
            {
                myCommand.Parameters.Add("ROOFID_", DBNull.Value);
            }

            if (objSurveyLandLivingOff.WallID > 0)
            {
                myCommand.Parameters.Add("WALLID_", objSurveyLandLivingOff.WallID);
            }
            else
            {
                myCommand.Parameters.Add("WALLID_", DBNull.Value);
            }

            if (objSurveyLandLivingOff.FloorID > 0)
            {
                myCommand.Parameters.Add("FLOORID_", objSurveyLandLivingOff.FloorID);
            }
            else
            {
                myCommand.Parameters.Add("FLOORID_", DBNull.Value);
            }

            myCommand.Parameters.Add("UPDATEDBY_", objSurveyLandLivingOff.UpdatedBy);
            myConnection.Open();
            result = myCommand.ExecuteNonQuery();
            myConnection.Close();
            return(result);
        }
Esempio n. 4
0
        /// <summary>
        /// To Get Living OFF By ID
        /// </summary>
        /// <param name="LivingOffID"></param>
        /// <returns></returns>
        public LandLivingOffBO GetLivingOFFByID(int LivingOffID)
        {
            OracleConnection cnn = new OracleConnection(AppConfiguration.ConnectionString);
            OracleCommand    cmd;
            string           proc = "USP_TRN_GET_LANDLIVINGONBYID";

            LandLivingOffBO objLivingOff = null;

            //SurveyList.LandLivingOffList LandLivingOffLst = new SurveyList.LandLivingOffList();

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("LIVINGOFFID_", LivingOffID);
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            try
            {
                cmd.Connection.Open();
                OracleDataReader dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);

                while (dr.Read())
                {
                    objLivingOff = new LandLivingOffBO();
                    if (!dr.IsDBNull(dr.GetOrdinal("LIVINGOFFID")))
                    {
                        objLivingOff.LivingOffID = dr.GetInt32(dr.GetOrdinal("LIVINGOFFID"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("dwellingid")))
                    {
                        objLivingOff.DwellingID = dr.GetInt32(dr.GetOrdinal("dwellingid"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("noofrooms")))
                    {
                        objLivingOff.NoofRooms = dr.GetString(dr.GetOrdinal("noofrooms"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("str_tenureid")))
                    {
                        objLivingOff.Str_TenureID = dr.GetInt32(dr.GetOrdinal("str_tenureid"));
                    }
                    //   if (!dr.IsDBNull(dr.GetOrdinal("str_tenure"))) objLivingOff.Str_Tenure = dr.GetString(dr.GetOrdinal("str_tenure"));
                    if (!dr.IsDBNull(dr.GetOrdinal("TENURE")))
                    {
                        objLivingOff.Tenure = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("TENURE")));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("roofid")))
                    {
                        objLivingOff.RoofID = dr.GetInt32(dr.GetOrdinal("roofid"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("wallid")))
                    {
                        objLivingOff.WallID = dr.GetInt32(dr.GetOrdinal("wallid"));
                    }
                    if (!dr.IsDBNull(dr.GetOrdinal("floorid")))
                    {
                        objLivingOff.FloorID = dr.GetInt32(dr.GetOrdinal("floorid"));
                    }
                }

                dr.Close();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(objLivingOff);
        }
Esempio n. 5
0
        /// <summary>
        /// To Add Land Living OFF
        /// </summary>
        /// <param name="objSurveyLandLivingOff"></param>
        /// <returns></returns>
        public int AddLandLivingOFF(LandLivingOffBO objSurveyLandLivingOff)
        {
            SurveyDAL objAddLandLivingOFFDAL = new SurveyDAL();

            return(objAddLandLivingOFFDAL.AddLandLivingOFF(objSurveyLandLivingOff));
        }