Example #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;
            }
        }
Example #2
0
        /// <summary>
        /// Update Database Make data as Obsoluted
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        #region Delete Record
        protected void IsObsolete_CheckedChanged(Object sender, EventArgs e)
        {
            string message = string.Empty;

            try
            {
                CheckBox    chk = (CheckBox)sender;
                GridViewRow gr  = (GridViewRow)chk.Parent.Parent;

                string windowTypeID = ((Literal)gr.FindControl("litWindowTypeID")).Text;
                objWindowTypeBLL = new WindowTypeBLL();

                message = objWindowTypeBLL.ObsoleteWindowType(Convert.ToInt32(windowTypeID), Convert.ToString(chk.Checked));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                ClearDetails();
                BindGrid(false, true);
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Example #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();
 }
Example #4
0
        /// <summary>
        /// To get the window material
        /// </summary>
        private void GetWindowMaterial()
        {
            WindowTypeBLL BLLobj = new WindowTypeBLL();

            ddlWindowsMaterial.DataSource     = BLLobj.GetWindowType();
            ddlWindowsMaterial.DataTextField  = "WindowTypeName";
            ddlWindowsMaterial.DataValueField = "WindowTypeID";
            ddlWindowsMaterial.DataBind();
        }
Example #5
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);
        }
Example #6
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;
        }