protected void GrDelete(object sender, CommandEventArgs e)
        {
            int nPageNumber             = int.Parse(txtPageNumber.Text);
            int nPageSize               = int.Parse(txtPageSize.Text);
            SessionUserLogin nUserLogin = (SessionUserLogin)Session["UserLogin"];

            nUserLogin.CheckRole("CU0014");
            if (!nUserLogin.Role.Del)
            {
                Response.Write("<script >alert('Bạn không có quyền xóa danh mục này!')</script>");
            }
            else
            {
                try
                {
                    int mKey = int.Parse(e.CommandArgument.ToString());
                    CooperativePurchasing_Info info = new CooperativePurchasing_Info(mKey);
                    //if ((DateTime.Now - info.Datetime).TotalDays > 7)
                    //{
                    //    Response.Write("<script >alert('Dữ liệu đã quá 7 ngày, không được phép xóa!')</script>");
                    //}
                    //else
                    {
                        info.Delete();
                        DataTable nTable  = CooperativePurchasing_Data.GetList(nPageSize, nPageNumber, Session["CooperativeKey"].ToInt());
                        DateTime  dtfrom  = DateTime.ParseExact(txtfromDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        DateTime  dtto    = DateTime.ParseExact(txttoDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                        DataTable nTable2 = CooperativePurchasing_Data.GetListSale(dtfrom, dtto, nPageSize, nPageNumber, Session["CooperativeKey"].ToInt());
                        if (nTable.Rows.Count == 0)
                        {
                            nTable.Rows.Add("", DateTime.Now, "", 0, 0, 0, "", DateTime.Now, "", 0, 0, 0, "");
                        }
                        if (nTable2.Rows.Count == 0)
                        {
                            nTable2.Rows.Add(0, DateTime.Now, "", 0, 0, "", 0, 0, 0, "");
                        }
                        GV_HarvestedForSale.DataSource = nTable;
                        GV_HarvestedForSale.DataBind();
                        ListSale.DataSource = nTable2;
                        ListSale.DataBind();
                        LoadPages();
                    }
                }
                catch
                {
                    Response.Write("<script >alert('Có lỗi gì đó vui lòng thử lại!')</script>");
                }
            }
        }
        protected void cmdView_Click1(object sender, ImageClickEventArgs e)
        {
            //txtPageNumber.Text = "1";
            //int nPageNumber = int.Parse(txtPageNumber.Text);
            //int nPageSize = int.Parse(txtPageSize.Text);
            //DateTime dtfrom = DateTime.ParseExact(txtfromDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            //DateTime dtto = DateTime.ParseExact(txttoDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            //DataTable nTable = CooperativePurchasing_Data.GetList(dtfrom, dtto, Convert.ToInt16(Session["EmployeeKey"]), nPageSize, nPageNumber, DDLSeeds.SelectedValue);
            //if (nTable.Rows.Count == 0)
            //{
            //    nTable.Rows.Add(0, null, "", 0, 0, "", 0, "", 0, "");
            //}
            //GV_HarvestedForSale.DataSource = nTable;
            //GV_HarvestedForSale.DataBind();
            //LoadPages();
            int nPageNumber = int.Parse(txtPageNumber.Text);
            int nPageSize   = int.Parse(txtPageSize.Text);

            Session["dtfrom"] = txtfromDatetime.Text;
            Session["dtto"]   = txttoDatetime.Text;
            DateTime  dtfrom  = DateTime.ParseExact(txtfromDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DateTime  dtto    = DateTime.ParseExact(txttoDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DataTable nTable  = CooperativePurchasing_Data.GetList(nPageSize, nPageNumber, Session["CooperativeKey"].ToInt());
            DataTable nTable2 = CooperativePurchasing_Data.GetListSale(dtfrom, dtto, nPageSize, nPageNumber, Session["CooperativeKey"].ToInt());

            if (nTable.Rows.Count == 0)
            {
                nTable.Rows.Add("", DateTime.Now, "", 0, 0, 0, "", DateTime.Now, "", 0, 0, 0, "");
            }
            if (nTable2.Rows.Count == 0)
            {
                nTable2.Rows.Add(0, DateTime.Now, "", 0, 0, "", 0, 0, 0, "");
            }
            GV_HarvestedForSale.DataSource = nTable;
            ListSale.DataSource            = nTable2;
            ListSale.DataBind();
            GV_HarvestedForSale.DataBind();
            DateTime dt = DateTime.Now;

            txtfromDatetime.Text = "01/" + DateTime.Now.ToString("MM/yyyy");
            txttoDatetime.Text   = DateTime.Now.ToString("dd/MM/yyyy");
            LoadPages();
            LoadPages2();
        }
        public void LoadData()
        {
            int nPageNumber = int.Parse(txtPageNumber.Text);
            int nPageSize   = int.Parse(txtPageSize.Text);

            txtfromDatetime.Text = "01/" + DateTime.Now.ToString("MM/yyyy");
            txttoDatetime.Text   = DateTime.Now.ToString("dd/MM/yyyy");
            DateTime dtfrom;
            DateTime dtto;

            if (Session["dtfrom"] != null)
            {
                dtfrom = DateTime.ParseExact(Session["dtfrom"].ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
                dtto   = DateTime.ParseExact(Session["dtto"].ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
            }
            else
            {
                dtfrom = DateTime.ParseExact(txtfromDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
                dtto   = DateTime.ParseExact(txttoDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            }
            DataTable nTable  = CooperativePurchasing_Data.GetList(nPageSize, nPageNumber, Session["CooperativeKey"].ToInt());
            DataTable nTable2 = CooperativePurchasing_Data.GetListSale(dtfrom, dtto, nPageSize, nPageNumber, Session["CooperativeKey"].ToInt());

            if (nTable.Rows.Count == 0)
            {
                nTable.Rows.Add("", DateTime.Now, "", 0, 0, 0, "", DateTime.Now, "", 0, 0, 0, "");
            }
            if (nTable2.Rows.Count == 0)
            {
                nTable2.Rows.Add(0, DateTime.Now, "", 0, 0, "", 0, 0, 0, "");
            }
            GV_HarvestedForSale.DataSource = nTable;
            ListSale.DataSource            = nTable2;
            ListSale.DataBind();

            GV_HarvestedForSale.DataBind();
            DateTime dt = DateTime.Now;

            txtfromDatetime.Text = "01/" + DateTime.Now.ToString("MM/yyyy");
            txttoDatetime.Text   = DateTime.Now.ToString("dd/MM/yyyy");
            LoadPages();
        }
Esempio n. 4
0
        protected void cmdView_Click1(object sender, ImageClickEventArgs e)
        {
            txtPageNumber.Text = "1";
            int nPageNumber = int.Parse(txtPageNumber.Text);
            int nPageSize   = int.Parse(txtPageSize.Text);

            Session["dtfrom"] = txtfromDatetime.Text;
            Session["dtto"]   = txttoDatetime.Text;
            DateTime  dtfrom = DateTime.ParseExact(txtfromDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DateTime  dtto   = DateTime.ParseExact(txttoDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DataTable nTable = CooperativeSale_Data.GetList(dtfrom, dtto, nPageSize, nPageNumber, Session["CooperativeKey"].ToInt());

            if (nTable.Rows.Count == 0)
            {
                nTable.Rows.Add("", 0, "", DateTime.Now, "", 0, "", 0);
            }
            ListSale.DataSource = nTable;
            ListSale.DataBind();
            LoadPages();
        }
Esempio n. 5
0
        public void LoadData()
        {
            txtfromDatetime.Text = "01/01/2013";
            txttoDatetime.Text   = DateTime.Now.ToString("dd/MM/yyyy");
            //LoadDataToToolboxWeb.DropDown_DDL(DDLSeeds, "Select SeedsKey,SeedsName from PUL_Seeds where SeedsKey IN (Select SeedsKey FROM PUL_CheckEquipment WHERE MemberKey = " + Convert.ToInt16(Session["EmployeeKey"]) + ")", false);
            int       nPageNumber = int.Parse(txtPageNumber.Text);
            int       nPageSize   = int.Parse(txtPageSize.Text);
            DateTime  dtfrom      = DateTime.ParseExact(txtfromDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DateTime  dtto        = DateTime.ParseExact(txttoDatetime.Text, "dd/MM/yyyy", CultureInfo.InvariantCulture);
            DataTable nTable      = CooperativeSale_Data.GetList(dtfrom, dtto, nPageSize, nPageNumber, Session["CooperativeKey"].ToInt());

            ListSale.DataSource = nTable;
            if (nTable.Rows.Count == 0)
            {
                nTable.Rows.Add("", 0, "", DateTime.Now, "", 0, "", 0);
            }
            ListSale.DataBind();
            DateTime dt = DateTime.Now;

            LoadPages();
        }