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  CDAPBUDGETID = ((Literal)gr.FindControl("litCategoryID")).Text;
                ITEMBLL objItemBLL   = new ITEMBLL();
                message = objItemBLL.ObsoleteCDAPBudgetMaster(Convert.ToInt32(CDAPBUDGETID), Convert.ToString(chk.Checked), Convert.ToInt32(Session["USER_ID"]));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data updated successfully";
                }
                ClearData();
                BindGrid();
                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Obsoleted", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Ejemplo n.º 2
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 grdBudgetItem_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            string message = string.Empty;

            if (e.CommandName == "EditRow")
            {
                ViewState["CDAPBUDGETID"] = e.CommandArgument;
                GetBudgetItem();
                SetUpdateMode(true);
            }
            else if (e.CommandName == "DeleteRow")
            {
                // ViewState["CDAPBUDGETID"] = e.CommandArgument;
                ITEMBLL objItemBLL = new ITEMBLL();
                message = objItemBLL.DeleteCDAPBudgetMaster(Convert.ToInt32(e.CommandArgument));
                if (string.IsNullOrEmpty(message) || message == "" || message == "null")
                {
                    message = "Data deleted successfully";
                }
                SetUpdateMode(false);
                BindGrid();
                ClearData();
            }

            else if (e.CommandName == "ViewROW")
            {
                ViewState["CDAPBUDGETID"] = e.CommandArgument;
                getClanDetails();
            }

            if (message != "")
            {
                ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
            }
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Set Grid Data source
 /// </summary>
 /// <param name="addRow"></param>
 /// <param name="deleteRow"></param>
 private void BindGrid()
 {
     try
     {
         ITEMBLL objItemBLL = new ITEMBLL();
         grdBudgetItem.DataSource = objItemBLL.GetAllCDAPBudgetItems();
         grdBudgetItem.DataBind();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 4
0
 /// <summary>
 /// Set Grid Data source
 /// </summary>
 /// <param name="addRow"></param>
 /// <param name="deleteRow"></param>
 private void BindGrid()
 {
     try
     {
         ITEMBLL objItemBLL = new ITEMBLL();
         grdBudgetItem.DataSource = objItemBLL.GetAllCDAPBudgetSubItems(Convert.ToInt32(ViewState["CATEGORY_ID"]));
         grdBudgetItem.DataBind();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Ejemplo n.º 5
0
        /// <summary>
        /// used to fetch details from  database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void GetBudgetItem()
        {
            ITEMBLL objItemBLL = new ITEMBLL();

            CDAPBudgetMasterBO objBudget = objItemBLL.GetCDAPBudgetItemByID(Convert.ToInt32(ViewState["CDAPBUDGETID"]));

            if (objBudget != null)
            {
                txtBudgetItem.Text = objBudget.CategoryName;
            }

            objBudget  = null;
            objItemBLL = null;
        }
Ejemplo n.º 6
0
        /// <summary>
        ///  used to update details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void UpdateBudgetItem()
        {
            ITEMBLL objItemBLL = new ITEMBLL();
            CDAPBudgetDescrMasterBO objBudget = new CDAPBudgetDescrMasterBO();
            string message = "";

            try
            {
                if (ViewState["CDAPBUDGETDESCRID"] != null)
                {
                    objBudget.SubCategoryID = Convert.ToInt32(ViewState["CDAPBUDGETDESCRID"].ToString());
                }

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

                objBudget.CategoryID      = Convert.ToInt32(ViewState["CATEGORY_ID"]);
                objBudget.SubCategoryName = txtBudgetItem.Text.Trim();
                objBudget.UpdatedBy       = Convert.ToInt32(uID);

                message = objItemBLL.UpdateCDAPBudgetSubItem(objBudget);

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

                ClearData();
                SetUpdateMode(false);
                BindGrid();

                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Updated", "alert('" + message + "');", true);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            finally
            {
                objItemBLL = null;
            }
        }
Ejemplo n.º 7
0
        /// <summary>
        /// used to save details to database
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SaveBudgetItem()
        {
            ITEMBLL objItemBLL = new ITEMBLL();
            CDAPBudgetDescrMasterBO objBudget = new CDAPBudgetDescrMasterBO();

            string message = "";

            string Tribe = string.Empty;
            string uID   = string.Empty;

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

            objBudget.CategoryID      = Convert.ToInt32(ViewState["CATEGORY_ID"]);
            objBudget.SubCategoryName = txtBudgetItem.Text.Trim();
            objBudget.CreatedBy       = Convert.ToInt32(uID);

            try
            {
                message = objItemBLL.AddCDAPBudgetSubItem(objBudget);

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

                if (message != "")
                {
                    ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "Added", "alert('" + message + "');", true);
                }

                ClearData();
                BindGrid();
            }
            catch (Exception ee)
            {
                throw ee;
            }
            finally
            {
                objItemBLL = null;
            }
        }
Ejemplo n.º 8
0
        /// <summary>
        /// To bind data to Drop down ddlItemDesc
        /// </summary>
        /// <param name="CatID"></param>
        private void BindSubItem(int CatID)
        {
            objITEMBLL  = new ITEMBLL();
            objItemList = objITEMBLL.GetSubItem(CatID);
            ddlItemDesc.Items.Clear();
            ListItem lst;

            if (objItemList.Count > 0)
            {
                ddlItemDesc.DataSource     = objItemList;
                ddlItemDesc.DataTextField  = "ItemsubcatName";
                ddlItemDesc.DataValueField = "ItemsubcatId";
                ddlItemDesc.DataBind();
                lst = new ListItem("--Select--", "0");
                ddlItemDesc.Items.Insert(0, lst);
            }
            else
            {
                lst = new ListItem("No Sub Items", "0");
                ddlItemDesc.Items.Insert(0, lst);
            }
        }
Ejemplo n.º 9
0
        /// <summary>
        /// To bind data to Drop down ddlItem
        /// </summary>
        private void BindItem()
        {
            objITEMBLL  = new ITEMBLL();
            objItemList = objITEMBLL.GetItem();
            ddlItem.Items.Clear();
            ListItem lst;

            if (objItemList.Count > 0)
            {
                ddlItem.DataSource     = objItemList;
                ddlItem.DataTextField  = "ItemName";
                ddlItem.DataValueField = "ItemcatId";
                ddlItem.DataBind();
                lst = new ListItem("--Select--", "0");
                ddlItem.Items.Insert(0, lst);
            }
            else
            {
                lst = new ListItem("No Items", "0");
                ddlItem.Items.Insert(0, lst);
                ddlItem.DataBind();
            }
        }