protected void btn_Result_Click(object sender, EventArgs e)
        {
            Sale sale = new Sale();

            if (user_manage == 0)
            {
                sale.Staffinfo_Id = staffinfo_id;
            }
            sale.Sale_Id    = 0;
            sale.Year_Month = 0;

            if (this.txt_Position.Text != "")
            {
                sale.Sale_Id = Convert.ToInt32(this.txt_Position.Text);
            }
            if (this.txt_Yearmonth.Text != "")
            {
                sale.Year_Month = Convert.ToInt32(this.txt_Yearmonth.Text);
            }
            if (this.txt_Name.Text != "")
            {
                StaffProvider provider1 = new StaffProvider();
                sale.Staffinfo_Id = provider1.GetStaffinfoId(this.txt_Name.Text.ToString());
            }
            SaleProvider provider = new SaleProvider();

            this.ListPager1.RecordCount = provider.GetSize();
            this.BindSource(sale, 0);
            this.ListPager1.PageChange += new PagerEventHandler(ListPager1_PageChange);
        }
Example #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (user_id == 0)
            {
                user_id = Convert.ToInt32(Session["USERID"].ToString());
            }

            if (user_manage == 0)
            {
                user_manage = Convert.ToInt32(Session["USERMANAGE"].ToString());
            }

            if (staffinfo_id == 0)
            {
                StaffProvider provider = new StaffProvider();

                staffinfo_id = provider.GetStaffinfoId(user_id);
            }

            if (!IsPostBack)
            {
                PurchaseProvider provider = new PurchaseProvider();

                Purchase purchase = new Purchase();

                this.GridView1.DataKeyNames = new string[] { "purchase_id", "staffinfo_id", "supplier_id" };

                if (user_manage == 0)
                {
                    purchase.Staffinfo_Id = staffinfo_id;
                    this.txt_Name.Enabled = false;
                }

                this.ListPager1.RecordCount = provider.GetSize();
                this.BindSource(purchase, 0);
            }

            this.account.Text           = GetAccout();// Session["LOGINED"].ToString();
            this.datetime.Text          = this.BindDayWeek();
            this.ListPager1.PageChange += new PagerEventHandler(ListPager1_PageChange);
        }
Example #3
0
        protected void btn_sure_Click(object sender, EventArgs e)
        {
            Users        users    = this.AddUsers();
            UserProvider provider = new UserProvider();

            switch (this.OperationFlag)
            {
            case Operation.Add:
                if (users.User_account == "")
                {
                    this.Alert("²ÎÊý´íÎó£¬ÐÞ¸Äʧ°Ü!!!");
                    break;
                }
                if (this.IsSame() == 1)
                {
                    break;
                }
                if (provider.Insert(users))
                {
                    Staff staff = new Staff();

                    staff = this.AddStaff(users);

                    if (staff.User_id == 0)
                    {
                        provider.Delete(users);
                        this.Alert("user_idΪ0£¬Ìí¼Óʧ°Ü");
                    }

                    StaffProvider staffProvider = new StaffProvider();
                    if (staffProvider.Insert(staff))
                    {
                        this.Alert("Ìí¼Ó³É¹¦!!!");
                        this.TextCancel();
                    }
                    else
                    {
                        provider.Delete(users);
                    }
                }
                break;

            case Operation.Update:
                if (users.User_account == "")
                {
                    this.Alert("²ÎÊý´íÎó£¬ÐÞ¸Äʧ°Ü!!!");
                    break;
                }
                if (provider.Update(users))
                {
                    Staff staff = new Staff();

                    staff = this.AddStaff(users);

                    if (staff.User_id == 0)
                    {
                        provider.Delete(users);
                        this.Alert("user_idΪ0£¬ÐÞ¸Äʧ°Ü");
                    }

                    StaffProvider staffProvider = new StaffProvider();

                    int staffinfo_id = staffProvider.GetStaffinfoId(staff.User_id);
                    if (staffinfo_id == 0)
                    {
                        if (staffProvider.Insert(staff))
                        {
                            this.Alert("Ð޸ijɹ¦!!!");
                        }
                        else
                        {
                            this.Alert("ÐÞ¸Äʧ°Ü!!!");
                        }
                    }
                    else
                    {
                        staff.Staffinfo_id = staffinfo_id;
                        if (staffProvider.Update(staff))
                        {
                            this.Alert("Ð޸ijɹ¦!!!");
                            this.BindText();
                        }
                        else
                        {
                            this.Alert("ÐÞ¸Äʧ°Ü!!!");
                        }
                    }
                    this.BindText();
                }
                break;
            }
        }