Ejemplo n.º 1
0
        /// <summary>
        /// Update Database Make data as Obsoluted
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void IsObsolete_CheckedChanged(Object sender, EventArgs e)
        {
            string message = string.Empty;

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

                string structureCategoryID = ((Literal)gr.FindControl("litStructureCategoryID")).Text;
                objStructureCategoryBLL = new StructureCategoryBLL();

                message = objStructureCategoryBLL.ObsoleteStructureCategoty(Convert.ToInt32(structureCategoryID), 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;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// to assign values to dropdownlist
        /// </summary>
        private void GetCategory()
        {
            StructureCategoryBLL BLLobj = new StructureCategoryBLL();

            categoryDropDownList.DataSource     = BLLobj.GetStructureCategory();
            categoryDropDownList.DataTextField  = "StructureCategoryName";
            categoryDropDownList.DataValueField = "StructureCategoryID";
            categoryDropDownList.DataBind();
            categoryDropDownList.Items.Insert(0, new ListItem("--Select--", "0"));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e
        private void BindGrid(bool addRow, bool deleteRow)
        {
            objStructureCategoryBLL = new StructureCategoryBLL();
            objStructureCategory    = new StructureCategoryBO();

            objStructureCategory.StructureCategoryName = string.Empty;
            objStructureCategory.StructureCategoryID   = 0;

            grdStructureCategory.DataSource = objStructureCategoryBLL.GetAllStructureCategory();
            grdStructureCategory.DataBind();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string message      = string.Empty;
            string AlertMessage = string.Empty;

            objStructureCategory    = new StructureCategoryBO();
            objStructureCategoryBLL = new StructureCategoryBLL();

            //Assignement
            objStructureCategory.StructureCategoryName = txtStructureCategory.Text.Trim();

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

            objStructureCategory.IsDeleted = "False";

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

            if (objStructureCategory.StructureCategoryID < 1)
            {
                //If StructureCategoryID does Not exists then SaveStructureCategory
                objStructureCategory.StructureCategoryID = -1;//For New StructureCategory
                message = objStructureCategoryBLL.AddStructureCategory(objStructureCategory);

                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('Structure Category Added Successfully!!');", true);
            }
            else
            {
                //If StructureCategoryID exists then UpdateStructureCategory
                message = objStructureCategoryBLL.UpdateStructureCategory(objStructureCategory); //For Updating StructureCategory
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully.";
                    ClearDetails();
                    BindGrid(true, false);
                }
                //ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('Structure Category updated successfully!!');", true);
            }
            //ClearDetails();
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
            SetUpdateMode(false);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// To fetch data from database and assign to textbox
        /// </summary>
        private void GetStructureCategoryDetails()
        {
            objStructureCategoryBLL = new StructureCategoryBLL();
            int StructureCategoryID = 0;

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

            objStructureCategory = new StructureCategoryBO();
            objStructureCategory = objStructureCategoryBLL.GetStructureCategoryById(StructureCategoryID);

            txtStructureCategory.Text = objStructureCategory.StructureCategoryName;
        }
Ejemplo n.º 6
0
        /// <summary>
        /// To delete record from database based on structureCategoryID
        /// </summary>
        private void DeleteStructureCategory(string structureCategoryID)
        {
            objStructureCategoryBLL = new StructureCategoryBLL();
            string message = string.Empty;

            message = objStructureCategoryBLL.DeleteStructureCategory(Convert.ToInt32(structureCategoryID));

            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);
            }
        }