Exemplo 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          GOUALLOWANCECATEGORYID = ((Literal)gr.FindControl("litSchoolDropID")).Text;
                GOUAllowanceBLL GOUAllowanceBLLObj     = new GOUAllowanceBLL();
                message = GOUAllowanceBLLObj.Obsolete(Convert.ToInt32(GOUALLOWANCECATEGORYID), Convert.ToString(chk.Checked));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                BindGrid();
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// to link to other page on click of link  in grid
        /// </summary>
        /// <returns></returns>
        protected void gv_Details_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ViewState["GOUALLOWANCECATEGORYID"] = e.CommandArgument;

                GetGouAllowanceDetails();
                SetUpdateMode(true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                int             reasonid           = Convert.ToInt32(e.CommandArgument);
                GOUAllowanceBLL GOUAllowanceBLLObj = new GOUAllowanceBLL();
                message = GOUAllowanceBLLObj.Delete(Convert.ToInt32(e.CommandArgument));

                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data Deleted successfully";
                }

                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                cleardetails();
                SetUpdateMode(false);
                BindGrid();
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// To save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private string Insert()
        {
            string AlertMessage = string.Empty;
            string message      = string.Empty;

            string uID = Session["USER_ID"].ToString();

            GOUAllowanceBOobj = new GOUAllowanceBO();
            GOUAllowanceBOobj.GOUAllowanceCategory = txtGOUAllowanceCat.Text.ToString();
            GOUAllowanceBOobj.GOUAllowanceValue    = Convert.ToDecimal(txtGOUAllowanceVal.Text);
            GOUAllowanceBOobj.Createddate          = System.DateTime.Now;
            GOUAllowanceBOobj.Isdeleted            = false;
            GOUAllowanceBOobj.Createdby            = Convert.ToInt32(uID);
            GOUAllowanceBLL GOUAllowanceBLLObj = new GOUAllowanceBLL();

            try
            {
                message = GOUAllowanceBLLObj.Insert(GOUAllowanceBOobj);
            }
            catch (Exception ex)
            {
                string errorMsg = ex.Message.ToString();
                Response.Write(errorMsg);
            }
            finally
            {
                GOUAllowanceBLLObj = null;
            }
            return(message);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Set Grid Data source
        /// </summary>
        /// <param name="addRow"></param>
        /// <param name="deleteRow"></param>e
        private void BindGrid()
        {
            GOUAllowanceBLL GOUAllowanceBLLObj = new GOUAllowanceBLL();

            gv_Details.DataSource = GOUAllowanceBLLObj.GetAllGouAllowance();
            gv_Details.DataBind();
        }
Exemplo n.º 5
0
        /// <summary>
        /// to get the GouAllowance from the database and bind it to the DropDown
        /// </summary>
        private void BindGouAllowanc()
        {
            GOUAllowanceBLL GOUAllowanceBLLObj = new GOUAllowanceBLL();

            ddlGouAllowance.DataSource     = GOUAllowanceBLLObj.GetGouAllowance();
            ddlGouAllowance.DataTextField  = "GOUAllowanceCategory";
            ddlGouAllowance.DataValueField = "GOUALLOWANCECATEGORYID";
            ddlGouAllowance.DataBind();
        }
Exemplo n.º 6
0
        /// <summary>
        /// To fetch details
        /// </summary>
        private void GetGouAllowanceDetails()
        {
            GOUAllowanceBLL GOUAllowanceBLLObj     = new GOUAllowanceBLL();
            int             GOUALLOWANCECATEGORYID = 0;

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

            GOUAllowanceBOobj       = new GOUAllowanceBO();
            GOUAllowanceBOobj       = GOUAllowanceBLLObj.GetGouAllowancebyID(GOUALLOWANCECATEGORYID);
            txtGOUAllowanceCat.Text = GOUAllowanceBOobj.GOUAllowanceCategory;
            txtGOUAllowanceVal.Text = GOUAllowanceBOobj.GOUAllowanceValue.ToString();
        }
Exemplo n.º 7
0
        /// <summary>
        /// calls method save details to the database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected void btnSave_Click(object sender, EventArgs e)
        {
            string AlertMessage = string.Empty;
            string message      = string.Empty;

            try
            {
                if (ViewState["GOUALLOWANCECATEGORYID"].ToString() == "0")
                {
                    message = Insert();


                    AlertMessage = "alert('" + message + "');";

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data saved successfully";
                        cleardetails();
                    }
                }
                else
                {
                    string uID      = Session["USER_ID"].ToString();
                    int    reasonid = Convert.ToInt32(ViewState["GOUALLOWANCECATEGORYID"]);
                    GOUAllowanceBOobj = new GOUAllowanceBO();
                    GOUAllowanceBOobj.GOUAllowanceCategory = txtGOUAllowanceCat.Text.ToString();
                    GOUAllowanceBOobj.GOUAllowanceValue    = Convert.ToDecimal(txtGOUAllowanceVal.Text);
                    GOUAllowanceBOobj.Createdby            = Convert.ToInt32(uID);;
                    GOUAllowanceBLL GOUAllowanceBLLObj = new GOUAllowanceBLL();
                    message = GOUAllowanceBLLObj.Update(GOUAllowanceBOobj, reasonid);

                    if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                    {
                        message = "Data updated successfully";
                        cleardetails();
                        SetUpdateMode(false);
                    }
                }
                BindGrid();
            }
            catch (Exception ex)
            {
                string errorMsg = ex.Message.ToString();
                Response.Write(errorMsg);
            }
            AlertMessage = "alert('" + message + "');";
            ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", AlertMessage, true);
        }