Ejemplo n.º 1
0
        /// <summary>
        /// Set edit mode for edit comand
        /// Delete data from the database for delete comand
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void gvGoalName_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "EditRow")
            {
                ViewState["GOALID"] = e.CommandArgument;

                MNEGoalBLL objMNEGoalBLL = new MNEGoalBLL();
                MNEGoalBO  objMNEGoalBO  = new MNEGoalBO();
                objMNEGoalBO     = objMNEGoalBLL.GetMNEGoalNameDetailsbyID(Convert.ToInt32(ViewState["GOALID"]));
                txtGoalName.Text = objMNEGoalBO.GoalName;

                SetUpdateMode(true);
                ScriptManager.RegisterStartupScript(this, this.GetType(), "Added", "setDirty();", true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                string     message       = string.Empty;
                MNEGoalBLL objMNEGoalBLL = new MNEGoalBLL();
                message = objMNEGoalBLL.DeleteGoalName(Convert.ToInt32(e.CommandArgument));

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }
                if (message != "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "alert('" + message + "');", true);
                }
                ClearData();
                SetUpdateMode(false);
                BindGrid();
            }
        }
Ejemplo n.º 2
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;

                int        GoalID        = Convert.ToInt32(((Literal)gr.FindControl("litGOALID")).Text);
                MNEGoalBLL objMNEGoalBLL = new MNEGoalBLL();

                message = objMNEGoalBLL.ObsoleteGoalName(GoalID, Convert.ToString(chk.Checked));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                BindGrid();
                if (message != "")
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e
        private void BindGrid()
        {
            MNEGoalBLL MNEGoalBLLObj = new MNEGoalBLL();

            gvGoalName.DataSource = MNEGoalBLLObj.GetAllGoalNameDetails();
            gvGoalName.DataBind();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>



        private void SaveGoalNameDetails()
        {
            MNEGoalBO MNEGoalBOObj = null;
            string    message      = "";

            if (Convert.ToInt32(ViewState["GOALID"]) == 0)
            {
                try
                {
                    MNEGoalBOObj = new MNEGoalBO();
                    MNEGoalBLL MNEGoalBLLObj = new MNEGoalBLL();
                    MNEGoalBOObj.GoalName  = txtGoalName.Text.ToString().Trim();
                    MNEGoalBOObj.CreatedBy = Convert.ToInt32(Session["USER_ID"].ToString());
                    message = MNEGoalBLLObj.InsertMNEGoalDetails(MNEGoalBOObj);
                    ClearData();
                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                    }
                    if (message != "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "alert('" + message + "');", true);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
            }
            else
            {
                try
                {
                    MNEGoalBOObj = new MNEGoalBO();
                    MNEGoalBLL MNEGoalBLLObj = new MNEGoalBLL();

                    MNEGoalBOObj.GoalID    = Convert.ToInt32(ViewState["GOALID"]);
                    MNEGoalBOObj.GoalName  = txtGoalName.Text.ToString().Trim();
                    MNEGoalBOObj.CreatedBy = Convert.ToInt32(Session["USER_ID"].ToString());
                    message = MNEGoalBLLObj.UpdateMNEGoalDetails(MNEGoalBOObj);
                    ClearData();
                    SetUpdateMode(false);
                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data updated successfully";
                    }

                    if (message != "")
                    {
                        ScriptManager.RegisterStartupScript(this.Page, this.GetType(), "tmp", "alert('" + message + "');", true);
                    }
                }
                catch (Exception ex)
                {
                    throw ex;
                }
                finally
                {
                    MNEGoalBOObj = null;
                }
            }
        }