//protected void MonthlyCheckGV_PageIndexChanging(object sender, GridViewPageEventArgs e)
        //{
        //    List<MonthlyCheckModel> itemList = (List<MonthlyCheckModel>)Session["Monthly"];
        //    MonthlyCheckGV.PageIndex = e.NewPageIndex;
        //    MonthlyCheckGV.DataSource = itemList;
        //    MonthlyCheckGV.DataBind();
        //}
        protected void MonthlyCheckGV_OnTextChange(object sender, EventArgs e)
        {
            GridViewRow gridViewRow        = (GridViewRow)(sender as Control).Parent.Parent;
            TextBox     textbox            = (TextBox)sender;
            Label       rowIndex           = (Label)gridViewRow.FindControl("rowIndex");
            int         index              = int.Parse(rowIndex.Text) - 1;
            List <MonthlyCheckModel> model = (List <MonthlyCheckModel>)Session["Monthly"];

            model[index].ActualQuantity = int.Parse(textbox.Text);

            Session["Monthly"]        = model;
            MonthlyCheckGV.DataSource = model;
            MonthlyCheckGV.DataBind();
        }
        // For paganation

        protected void OnPageIndexChanging(object sender, GridViewPageEventArgs e)
        {
            if (e.NewPageIndex < 0)
            {
                MonthlyCheckGV.PageIndex = 0;
            }
            else
            {
                MonthlyCheckGV.PageIndex = e.NewPageIndex;
            }

            MonthlyCheckGV.DataSource = (List <MonthlyCheckModel>)Session["Monthly"];;

            MonthlyCheckGV.DataBind();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            context = new SSISEntities();

            if (!IsPostBack)
            {
                checkDone = CheckIfMonthlyDone();
                List <MonthlyCheckModel> itemList = (List <MonthlyCheckModel>)Session["Monthly"];

                if (itemList == null)
                {
                    itemList = new List <MonthlyCheckModel>();

                    List <Stock_Inventory> stockList = context.Stock_Inventory.Where(x => x.deleted == "N").ToList();
                    foreach (Stock_Inventory i in stockList)
                    {
                        MonthlyCheckModel item = new MonthlyCheckModel(i);
                        itemList.Add(item);
                    }

                    Session["Monthly"] = itemList;
                }


                MonthlyCheckGV.DataSource = itemList;
                MonthlyCheckGV.DataBind();

                UserModel user     = new UserModel(HttpContext.Current.User.Identity.Name);
                UserModel depthead = user.FindDelegateOrDeptHead();
                //CheckLabel.Text = depthead.Username;


                //today = DateTime.Today;
                //DateTB.Text = today.Date.ToString("dd/MM/yyyy");

                itemList = (List <MonthlyCheckModel>)Session["Monthly"];
                //Session["Monthly"] = itemList;
                MonthlyCheckGV.DataSource = itemList;
                MonthlyCheckGV.DataBind();
            }
        }
        protected void DropDownList_JumpToPage_SelectedIndexChanged(object sender, EventArgs e)
        {
            GridViewRow topPagerRow    = MonthlyCheckGV.TopPagerRow;
            GridViewRow bottomPagerRow = MonthlyCheckGV.BottomPagerRow;

            DropDownList topJumpToPage    = (DropDownList)topPagerRow.FindControl("DropDownList_JumpToPage");
            DropDownList bottomJumpToPage = (DropDownList)bottomPagerRow.FindControl("DropDownList_JumpToPage");

            if ((DropDownList)sender == bottomJumpToPage)
            {
                MonthlyCheckGV.PageIndex = bottomJumpToPage.SelectedIndex;
            }
            else
            {
                MonthlyCheckGV.PageIndex = topJumpToPage.SelectedIndex;
            }

            MonthlyCheckGV.DataSource = (List <MonthlyCheckModel>)Session["Monthly"];;

            MonthlyCheckGV.DataBind();
        }