public FrmGoodIncome()
        {
            InitializeComponent();
            Goods              = new List <ClsGood>();
            goodsPreSize       = 0;
            goodsCurSize       = 0;
            LblPurchaseID.Text = (PurchaseDao.QueryAll().Last().PurchaseID + 1).ToString();
            List <EtStaff> staffs = StaffDao.QueryByRole((int)ERole.采购员);

            foreach (EtStaff staff in staffs)
            {
                CmbOperator.Items.Add(staff.StaffName);
            }
        }
Example #2
0
        public FrmSale()
        {
            InitializeComponent();
            Sales        = new List <EtSale>();
            salesPreSize = 0;
            salesCurSize = 0;
            hasUpdated   = false;
            List <EtStaff> staffs = StaffDao.QueryByRole((int)ERole.销售员);

            LblSaleID.Text = (SaleDao.QueryAll().Last().SaleID + 1).ToString();
            foreach (EtStaff staff in staffs)
            {
                CmbOperator.Items.Add(staff.StaffName);
            }
        }
        //private void CmbStaffRole_SelectedIndexChanged(object sender, EventArgs e) {
        //    if (CmbStaffRole.SelectedIndex == 0)
        //        staffs = StaffDao.QueryAll();
        //    else
        //        staffs = StaffDao.QueryByRole(CmbStaffRole.SelectedIndex-1);
        //    DgvStaffData.Rows.Clear();
        //    foreach (EtStaff staff in staffs)
        //        DgvStaffData.Rows.Add(new object[] {
        //            staff.StaffID,
        //            staff.StaffName,
        //            staff.StaffPhone,
        //            staff.Role
        //        });
        //    TxtStaffSearch.Text = "";
        //}

        private void BtnStaffSearch_Click(object sender, EventArgs e)
        {
            List <EtStaff> list1, list2;
            int            index = CmbStaffRole.SelectedIndex;

            if (0 == index)
            {
                list1 = StaffDao.QueryAll();
            }
            else
            {
                list1 = StaffDao.QueryByRole(index - 1);
            }
            string idOrName = TxtStaffSearch.Text;

            if ("".Equals(idOrName))
            {
                staffs = list1;
            }
            else
            {
                string RegexStr = "^[0-9]+$";
                if (Regex.IsMatch(idOrName, RegexStr))
                {
                    list2 = StaffDao.QueryByStaffID(int.Parse(idOrName));
                }
                else
                {
                    list2 = StaffDao.QueryByStaffName(idOrName);
                }
                staffs = list1.Intersect(list2, new MyCompare()).ToList();
            }
            DgvStaffData.Rows.Clear();
            foreach (EtStaff staff in staffs)
            {
                DgvStaffData.Rows.Add(new object[] {
                    staff.StaffID,
                    staff.StaffName,
                    staff.StaffPhone,
                    staff.Role
                });
            }
        }