Пример #1
0
        private void DeleteWindowType(string windowTypeID)
        {
            WindowTypeBO oWindowType = new WindowTypeBO();

            objWindowTypeBLL = new WindowTypeBLL();
            string message = string.Empty;

            try
            {
                oWindowType.WindowTypeID = Convert.ToInt32(windowTypeID);
                oWindowType.UserID       = Convert.ToInt32(Session["USER_ID"].ToString());
                message = objWindowTypeBLL.DeleteWindowType(oWindowType);

                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;
            }
        }
Пример #2
0
        /// <summary>
        /// To Update Window Type
        /// </summary>
        /// <param name="oWindowType"></param>
        /// <returns></returns>
        public string UpdateWindowType(WindowTypeBO oWindowType)
        {
            string returnResult;

            cnn = new OracleConnection(con);

            proc = "USP_MST_UPD_Window";

            cmd             = new OracleCommand(proc, cnn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Connection.Open();
            cmd.Parameters.Add("Windowid_", oWindowType.WindowTypeID);
            cmd.Parameters.Add("WindowType_", oWindowType.WindowTypeName);

            cmd.Parameters.Add("updatedby_", oWindowType.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);
        }
Пример #3
0
 /// <summary>
 /// Set Grid Data source
 /// </summary>
 /// <param name="addRow"></param>
 /// <param name="deleteRow"></param>
 #region Load Grid / Bind Grid
 private void BindGrid(bool addRow, bool deleteRow)
 {
     objWindowTypeBLL             = new WindowTypeBLL();
     objWindowType                = new WindowTypeBO();
     objWindowType.WindowTypeName = string.Empty;
     objWindowType.WindowTypeID   = 0;
     grdWindowType.DataSource     = objWindowTypeBLL.GetAllWindowType();//(objWindowType);
     grdWindowType.DataBind();
 }
Пример #4
0
        /// <summary>
        /// Save and Update Data into Database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        #region Save Record
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string message      = string.Empty;
            string AlertMessage = string.Empty;

            objWindowType    = new WindowTypeBO();
            objWindowTypeBLL = new WindowTypeBLL();

            //Assignement
            objWindowType.WindowTypeName = txtWindowType.Text.Trim();

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

            objWindowType.IsDeleted = "False";

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

            if (objWindowType.WindowTypeID < 1)
            {
                //If WindowTypeID does Not exists then SaveWindowType
                objWindowType.WindowTypeID = -1;//For New WindowType
                message      = objWindowTypeBLL.AddWindowType(objWindowType);
                AlertMessage = "alert('" + message + "');";

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data saved successfully";
                    ClearDetails();
                    BindGrid(true, false);
                }
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('Window Type Added Successfully');", true);
            }
            else
            {
                //If WindowTypeID exists then UpdateWindowType
                message = objWindowTypeBLL.UpdateWindowType(objWindowType); //For Updating WindowType
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                    ClearDetails();
                    BindGrid(true, false);
                }
                // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('Window Type updated successfully');", true);
            }
            // ClearDetails();
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
            //BindGrid(true, false);
        }
Пример #5
0
        /// <summary>
        /// Edit Data into Database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        #region Edit Record
        private void GetWindowTypeDetails()
        {
            objWindowTypeBLL = new WindowTypeBLL();
            int WindowTypeID = 0;

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

            objWindowType = new WindowTypeBO();
            objWindowType = objWindowTypeBLL.GetWindowTypeById(WindowTypeID);

            txtWindowType.Text = objWindowType.WindowTypeName;
        }
Пример #6
0
        /// <summary>
        /// To Get Window Type
        /// </summary>
        /// <returns></returns>
        public WindowTypeList GetWindowType()
        {
            proc = "USP_MST_GET_WINDOW";
            cnn  = new OracleConnection(con);
            WindowTypeBO objWindowType = null;

            WindowTypeList lstWindowTypeList = new WindowTypeList();

            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())
                {
                    objWindowType = new WindowTypeBO();

                    if (ColumnExists(dr, "windowid") && !dr.IsDBNull(dr.GetOrdinal("windowid")))
                    {
                        objWindowType.WindowTypeID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("windowid")));
                    }
                    if (ColumnExists(dr, "windowtype") && !dr.IsDBNull(dr.GetOrdinal("windowtype")))
                    {
                        objWindowType.WindowTypeName = dr.GetString(dr.GetOrdinal("windowtype"));
                    }
                    if (ColumnExists(dr, "IsDeleted") && !dr.IsDBNull(dr.GetOrdinal("IsDeleted")))
                    {
                        objWindowType.IsDeleted = dr.GetString(dr.GetOrdinal("IsDeleted"));
                    }
                    lstWindowTypeList.Add(objWindowType);
                }

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

            return(lstWindowTypeList);
        }
Пример #7
0
        /// <summary>
        /// To Get Window Type By Id
        /// </summary>
        /// <param name="WindowTypeID"></param>
        /// <returns></returns>
        public WindowTypeBO GetWindowTypeById(int WindowTypeID)
        {
            cnn = new OracleConnection(con);

            proc = "USP_MST_GET_WINDOW_BYID";

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

            cmd.Connection.Open();

            OracleDataReader dr            = cmd.ExecuteReader(CommandBehavior.CloseConnection);
            WindowTypeBO     objWindowType = null;


            while (dr.Read())
            {
                objWindowType = new WindowTypeBO();

                if (ColumnExists(dr, "Windowid") && !dr.IsDBNull(dr.GetOrdinal("Windowid")))
                {
                    objWindowType.WindowTypeID = Convert.ToInt32(dr.GetValue(dr.GetOrdinal("Windowid")));
                }
                if (ColumnExists(dr, "WindowType") && !dr.IsDBNull(dr.GetOrdinal("WindowType")))
                {
                    objWindowType.WindowTypeName = dr.GetString(dr.GetOrdinal("WindowType"));
                }
                if (ColumnExists(dr, "IsDeleted") && !dr.IsDBNull(dr.GetOrdinal("IsDeleted")))
                {
                    objWindowType.IsDeleted = dr.GetString(dr.GetOrdinal("IsDeleted"));
                }
            }
            dr.Close();

            return(objWindowType);
        }
Пример #8
0
 /// <summary>
 /// To Delete Window Type
 /// </summary>
 /// <param name="oWindowType"></param>
 /// <returns></returns>
 public string DeleteWindowType(WindowTypeBO oWindowType)
 {
     objWindowTypeDAL = new WindowTypeDAL();
     return(objWindowTypeDAL.DeleteWindowType(oWindowType));
 }
Пример #9
0
        /// <summary>
        /// To Update Window Type
        /// </summary>
        /// <param name="oWindowType"></param>
        /// <returns></returns>
        public string UpdateWindowType(WindowTypeBO oWindowType)
        {
            objWindowTypeDAL = new WindowTypeDAL();

            return(objWindowTypeDAL.UpdateWindowType(oWindowType));
        }
Пример #10
0
        /// <summary>
        /// To Save Window Type
        /// </summary>
        /// <param name="oWindowType"></param>
        /// <returns></returns>
        public string AddWindowType(WindowTypeBO oWindowType)
        {
            objWindowTypeDAL = new WindowTypeDAL();

            return(objWindowTypeDAL.SaveWindowType(oWindowType));
        }