Esempio n. 1
0
        private void DeleteWallType(string wallTypeID)
        {
            WallTypeBO oWallType = new WallTypeBO();

            objWallTypeBLL = new WallTypeBLL();
            string message = string.Empty;

            try
            {
                oWallType.WallTypeID = Convert.ToInt32(wallTypeID);
                oWallType.UserID     = Convert.ToInt32(Session["USER_ID"].ToString());
                message = objWallTypeBLL.DeleteWallType(oWallType);

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }
                ClearDetails();
                BindGrid(false, true);
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// To Update Wall Type
        /// </summary>
        /// <param name="oWallType"></param>
        /// <returns></returns>
        public string UpdateWallType(WallTypeBO oWallType)
        {
            string returnResult;

            cnn = new OracleConnection(con);

            proc = "USP_MST_UPD_WALL";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Connection.Open();
            cmd.Parameters.Add("wallid_", oWallType.WallTypeID);
            cmd.Parameters.Add("WallType_", oWallType.WallTypeName);

            cmd.Parameters.Add("updatedby_", oWallType.UserID);
            cmd.Parameters.Add("errorMessage_", OracleDbType.Varchar2, 500).Direction = ParameterDirection.Output;
            cmd.ExecuteNonQuery();
            if (cmd.Parameters["errorMessage_"].Value != null)
            {
                returnResult = cmd.Parameters["errorMessage_"].Value.ToString();
            }
            else
            {
                returnResult = string.Empty;
            }
            return(returnResult);
        }
Esempio n. 3
0
        /// <summary>
        /// Load the data into grid and bind
        /// </summary>
        #region Load Grid / Bind Grid
        private void BindGrid(bool addRow, bool deleteRow)
        {
            objWallTypeBLL = new WallTypeBLL();
            objWallType    = new WallTypeBO();

            objWallType.WallTypeName = string.Empty;
            objWallType.WallTypeID   = 0;

            grdWallType.DataSource = objWallTypeBLL.GetAllWallType();
            grdWallType.DataBind();
        }
Esempio n. 4
0
        /// <summary>
        /// Save the data.
        /// </summary>
        #region Save Record
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string message      = string.Empty;
            string AlertMessage = string.Empty;

            objWallType    = new WallTypeBO();
            objWallTypeBLL = new WallTypeBLL();

            //Assignement
            objWallType.WallTypeName = txtWallType.Text.Trim();

            if (ViewState["WallTypeID"] != null)
            {
                objWallType.WallTypeID = Convert.ToInt32(ViewState["WallTypeID"].ToString());
            }

            objWallType.IsDeleted = "False";

            //if (Session["USER_ID"] != null)
            objWallType.UserID = Convert.ToInt32(Session["USER_ID"].ToString());

            if (objWallType.WallTypeID < 1)
            {
                //If WallTypeID does Not exists then SaveWallType
                objWallType.WallTypeID = -1;//For New WallType
                message = objWallTypeBLL.AddWallType(objWallType);
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Wall Type Added Successfully');", true);
                AlertMessage = "alert('" + message + "');";

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                    ClearDetails();
                    BindGrid(true, false);
                }
            }
            else
            {
                //If WallTypeID exists then UpdateWallType
                message = objWallTypeBLL.UpdateWallType(objWallType); //For Updating WallType
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('Wall Type updated successfully');", true);
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                    ClearDetails();
                    BindGrid(true, false);
                }
            }
            //ClearDetails();
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
            //BindGrid(true, false);
        }
Esempio n. 5
0
        /// <summary>
        /// Edit the data.
        /// </summary>
        #region Edit Record
        private void GetWallTypeDetails()
        {
            objWallTypeBLL = new WallTypeBLL();
            int WallTypeID = 0;

            if (ViewState["WallTypeID"] != null)
            {
                WallTypeID = Convert.ToInt32(ViewState["WallTypeID"].ToString());
            }

            objWallType = new WallTypeBO();
            objWallType = objWallTypeBLL.GetWallTypeById(WallTypeID);

            txtWallType.Text = objWallType.WallTypeName;
        }
Esempio n. 6
0
        /// <summary>
        /// To Get Wall Type
        /// </summary>
        /// <returns></returns>
        public WallTypeList GetWallType()
        {
            proc = "USP_MST_GET_WALL";
            cnn  = new OracleConnection(con);
            WallTypeBO objWallType = null;

            WallTypeList lstWallTypeList = new WallTypeList();

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

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

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

                while (dr.Read())
                {
                    objWallType = new WallTypeBO();

                    if (ColumnExists(dr, "wallid") && !dr.IsDBNull(dr.GetOrdinal("wallid")))
                    {
                        objWallType.WallTypeID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("wallid")));
                    }
                    if (ColumnExists(dr, "WallType") && !dr.IsDBNull(dr.GetOrdinal("WallType")))
                    {
                        objWallType.WallTypeName = dr.GetString(dr.GetOrdinal("WallType"));
                    }
                    if (ColumnExists(dr, "IsDeleted") && !dr.IsDBNull(dr.GetOrdinal("IsDeleted")))
                    {
                        objWallType.IsDeleted = dr.GetString(dr.GetOrdinal("IsDeleted"));
                    }
                    lstWallTypeList.Add(objWallType);
                }

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

            return(lstWallTypeList);
        }
Esempio n. 7
0
        /// <summary>
        /// To Get Wall Type By Id
        /// </summary>
        /// <param name="WallTypeID"></param>
        /// <returns></returns>
        public WallTypeBO GetWallTypeById(int WallTypeID)
        {
            cnn = new OracleConnection(con);

            proc = "USP_MST_GET_WALL_BYID";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("wallid_", WallTypeID);
            cmd.Parameters.Add("Sp_recordset", OracleDbType.RefCursor).Direction = ParameterDirection.Output;

            cmd.Connection.Open();

            OracleDataReader dr          = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            WallTypeBO       objWallType = null;


            while (dr.Read())
            {
                objWallType = new WallTypeBO();

                if (ColumnExists(dr, "wallid") && !dr.IsDBNull(dr.GetOrdinal("wallid")))
                {
                    objWallType.WallTypeID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("wallid")));
                }
                if (ColumnExists(dr, "WallType") && !dr.IsDBNull(dr.GetOrdinal("WallType")))
                {
                    objWallType.WallTypeName = dr.GetString(dr.GetOrdinal("WallType"));
                }
                if (ColumnExists(dr, "IsDeleted") && !dr.IsDBNull(dr.GetOrdinal("IsDeleted")))
                {
                    objWallType.IsDeleted = dr.GetString(dr.GetOrdinal("IsDeleted"));
                }
            }
            dr.Close();

            return(objWallType);
        }
Esempio n. 8
0
 /// <summary>
 /// To Delete Wall Type
 /// </summary>
 /// <param name="oWallType"></param>
 /// <returns></returns>
 public string DeleteWallType(WallTypeBO oWallType)
 {
     objWallTypeDAL = new WallTypeDAL();
     return(objWallTypeDAL.DeleteWallType(oWallType));
 }
Esempio n. 9
0
        /// <summary>
        /// To Update Wall Type
        /// </summary>
        /// <param name="oWallType"></param>
        /// <returns></returns>
        public string UpdateWallType(WallTypeBO oWallType)
        {
            objWallTypeDAL = new WallTypeDAL();

            return(objWallTypeDAL.UpdateWallType(oWallType));
        }
Esempio n. 10
0
        /// <summary>
        /// To Add Wall Type
        /// </summary>
        /// <param name="oWallType"></param>
        /// <returns></returns>
        public string AddWallType(WallTypeBO oWallType)
        {
            objWallTypeDAL = new WallTypeDAL();

            return(objWallTypeDAL.SaveWallType(oWallType));
        }