Пример #1
0
        public ActionResult TabPanel(string staffId, string hallNo, string counterId)
        {
            var staff = StaffDao.GetEntity("STAFF_ID", staffId);

            var counter = CounterStateDao.GetEntity("HALL_NO", hallNo, "COUNTER_ID", counterId);

            ViewBag.CounterState = counter;

            var listCamera = hallCameraDefDao.FindList("SEQ", "HALL_NO", hallNo);
            var camera     = listCamera.FirstOrDefault(m => m.MON_COUNTER != null && m.MON_COUNTER.Split('|').Contains(counterId));

            if (camera != null)
            {
                ViewBag.CameraId   = camera.SEQ;
                ViewBag.CameraType = camera.CAMERA_TYP;
            }
            else
            {
                ViewBag.CameraId   = 0;
                ViewBag.CameraType = 0;
            }

            var counterStateService = new CLI_COUNTERSTATE_DAL();

            ViewBag.Number = counterStateService.GetTabNumber(hallNo, counterId);


            return(View(staff));
        }
Пример #2
0
        public static bool checkPassword(int staffID, string password)
        {
            StaffDto dto = null;

            dto = StaffDao.Where(n => n.StaffId == staffID && n.Password.Equals(password)).FirstOrDefault();
            return(dto != null);
        }
Пример #3
0
 private void BtnStaffDelete_Click(object sender, EventArgs e)
 {
     if (DgvStaffData.SelectedRows.Count == 1)
     {
         int index = DgvStaffData.SelectedRows[0].Index;
         Staff = staffs[index];
         StringBuilder sb = new StringBuilder();
         sb.Append("确定删除当前员工?\n");
         sb.Append("员工编号:" + Staff.StaffID.ToString() + "\n");
         sb.Append("员工姓名:" + Staff.StaffName + "\n");
         sb.Append("联系方式:" + Staff.StaffPhone + "\n");
         sb.Append("员工职称:" + Staff.Role);
         if (DialogResult.OK == MsgBoxUtil.QuestionMsgBox(sb.ToString()))
         {
             StaffDao.DeleteByStaffID(Staff.StaffID);
             staffs.RemoveAt(index);
             DgvStaffData.Rows.RemoveAt(index);
             Staff = null;
         }
     }
     else
     {
         MsgBoxUtil.ErrMsgBox("请选择要删除的员工!");
     }
 }
Пример #4
0
        public JsonResult Delete(string staffCode)
        {
            StaffDao staffDao = new StaffDao();
            var      result   = Json(staffDao.Delete(staffCode));

            return(result);
        }
Пример #5
0
        public JsonResult SearchStaffById(string staffCode, int pageCountSearch)
        {
            StaffDao     staffDao = new StaffDao();
            List <Staff> list     = staffDao.GetListStaff(staffCode, pageCountSearch);

            return(Json(list));
        }
Пример #6
0
        public JsonResult GetIndex(string pageCount)
        {
            StaffDao     staffDao = new StaffDao();
            List <Staff> list     = staffDao.GetListStaff(int.Parse(pageCount));

            return(Json(list));
        }
Пример #7
0
        // GET: Staff
        //[HttpGet]
        public ActionResult Index()
        {
            StaffDao     staffDao = new StaffDao();
            List <Staff> list     = staffDao.GetListStaff(0);

            ViewData["Staffs"] = list;
            return(View());
        }
Пример #8
0
 public static List <StaffDto> GetAllStaffs()
 {
     if (allStaffs == null || allStaffs.Count == 0)
     {
         allStaffs = StaffDao.GetAll().ToList();
     }
     return(allStaffs);
 }
Пример #9
0
        public ActionResult Index(int PageNum = 1, int PageSize = 5, string search = null)
        {
            ViewBag.PageSize = PageSize;
            StaffDao dao = new StaffDao();
            var      lst = dao.GetAllSearch(PageNum, PageSize, search);

            return(View(lst));
        }
Пример #10
0
        public ActionResult Details(string code)
        {
            StaffDao staffDao = new StaffDao();

            Staff list = staffDao.Getstaff(code);

            ViewData["Staffs"] = list;
            return(View());
        }
Пример #11
0
        public static int Insert(StaffDto staff)
        {
            int id = StaffDao.Insert(staff);

            staff.UserId = id;
            allStaffs.Add(staff);
            allStaffs.OrderBy(n => n.UserId);
            return(id);
        }
Пример #12
0
 public FrmStaff()
 {
     InitializeComponent();
     userDao    = new UserDao();
     staffDao   = new StaffDao();
     stationDao = new StationDao();
     loungeDao  = new LoungeDao();
     roleDao    = new RoleDao();
     areaDao    = new AreaDao();
 }
Пример #13
0
        // GET: Staff/Edit/5
        public ActionResult Edit(string code)
        {
            StaffDao staffDao = new StaffDao();
            Staff    staff    = staffDao.Getstaff(code);

            ViewData["Staff"] = staff;


            return(View(staff));
        }
Пример #14
0
        public JsonResult ExsitsEmail(string sta_email, int?sta_id)
        {
            StaffDao     dao     = new StaffDao();
            List <staff> lts_sta = dao.GetAll();

            if (sta_id != null)
            {
                lts_sta.Remove(dao.GetById(sta_id));
            }
            return(Json(!lts_sta.Any(x => x.sta_email.Trim().ToLower() == sta_email.Trim().ToLower()), JsonRequestBehavior.AllowGet));
        }
Пример #15
0
        public static int Login(string username, string encryptedPassword)
        {
            StaffDto dto = StaffDao.Where(n => n.Username.Equals(username) && n.Password.Equals(encryptedPassword)).FirstOrDefault();

            if (dto == null)
            {
                return(0);
            }
            Config.Manager.CURRENT_USER = dto;
            DatabaseCommon.DatabaseUtils.CurrentUserId = dto.UserId;
            return(dto.Active ? 1 : -1);
        }
Пример #16
0
 public static bool delete(int UserId)
 {
     foreach (StaffDto staff in allStaffs)
     {
         if (staff.UserId == UserId)
         {
             allStaffs.Remove(staff);
             break;
         }
     }
     return(StaffDao.delete(UserId));
 }
Пример #17
0
        public JsonResult CreateStaff(string kanjiName, string kanaName, string password, string generationno)
        {
            StaffDao staffDao = new StaffDao();
            Staff    staff    = new Staff
            {
                kanjiName    = kanjiName,
                kanaName     = kanaName,
                generationno = generationno,
                password     = password
            };

            return(Json(staffDao.Create(staff)));
        }
Пример #18
0
        public ActionResult Edit(staff sta, HttpPostedFileBase photo)
        {
            GroupRoleDao grDao  = new GroupRoleDao();
            StaffDao     staDao = new StaffDao();

            if (ModelState.IsValid)
            {
                try
                {
                    if (photo != null && photo.ContentLength > 0)
                    {
                        staff  exists_sta = staDao.GetById(sta.sta_id);
                        string image      = String.Concat(sta.sta_username, photo.FileName);
                        if (!image.Equals(exists_sta.sta_image))
                        {
                            var image_old = Path.Combine(Server.MapPath("~/Areas/Admins/Content/Photo/Staff/"),
                                                         System.IO.Path.GetFileName(exists_sta.sta_image));
                            if (System.IO.File.Exists(image_old))
                            {
                                System.IO.File.Delete(image_old);
                            }
                            var image_new = Path.Combine(Server.MapPath("~/Areas/Admins/Content/Photo/Staff/"),
                                                         System.IO.Path.GetFileName(image));


                            photo.SaveAs(image_new);
                        }
                        sta.sta_image     = image;
                        sta.sta_update_at = DateTime.Now;
                        staDao.Update(sta);
                    }
                    else
                    {
                        staff exists_sta = staDao.GetById(sta.sta_id);
                        sta.sta_image = exists_sta.sta_image;
                        staDao.Update(sta);
                    }
                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    return(View("Error"));
                }
            }
            else
            {
                ViewBag.lst_gr = grDao.GetAll();
                return(View(sta));
            }
        }
        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);
            }
        }
Пример #20
0
        private void BtnLogin_Click(object sender, EventArgs e)
        {
            try
            {
                int            account  = int.Parse(TxtAccount.Text);
                string         password = TxtPassword.Text;
                string         pwd      = Encrypt.GetMD5(password);
                List <EtStaff> staffs   = StaffDao.QueryByStaffID(account);
                if (staffs.Count == 0)
                {
                    MsgBoxUtil.ErrMsgBox("用户名或密码错误");
                }
                else if (!pwd.Equals(staffs[0].Pwd))
                {
                    MsgBoxUtil.ErrMsgBox("用户名或密码错误");
                }
                else
                {
                    Form f = null;
                    switch (staffs[0].Role)
                    {
                    case Enums.ERole.未定义:
                        break;

                    case Enums.ERole.管理员:
                        f = new FrmMainAdmin();
                        break;

                    case Enums.ERole.采购员:
                        f = new FrmMainPurchase();
                        break;

                    case Enums.ERole.销售员:
                        f = new FrmMainSale();
                        break;
                    }
                    Hide();
                    if (f != null)
                    {
                        f.ShowDialog();
                    }
                    Close();
                }
            }
            catch
            {
                MsgBoxUtil.ErrMsgBox("用户名或密码错误");
            }
        }
Пример #21
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);
            }
        }
Пример #22
0
 public FrmStaff()
 {
     InitializeComponent();
     CmbStaffRole.SelectedIndex = 0;
     Staff      = null;
     staffs     = StaffDao.QueryAll();
     hasUpdated = false;
     //foreach (EtStaff staff in staffs)
     //    DgvStaffData.Rows.Add(new object[] {
     //        staff.StaffID,
     //        staff.StaffName,
     //        staff.StaffPhone,
     //        staff.Role
     //    });
 }
Пример #23
0
        public JsonResult Update(string staffCode, string kanjiName, string kanaName, string password, string generationno, string wardcode)
        {
            StaffDao staffDao = new StaffDao();
            Staff    staff    = new Staff
            {
                staffCode     = staffCode,
                kanjiName     = kanjiName,
                kanaName      = kanaName,
                password      = password,
                generationno  = generationno,
                staffWardCode = wardcode
            };

            return(Json(staffDao.Update(staffCode, staff)));
        }
Пример #24
0
 private void BtnStaffCancel_Click(object sender, EventArgs e)
 {
     DgvStaffData.Rows.Clear();
     staffs = StaffDao.QueryAll();
     foreach (EtStaff staff in staffs)
     {
         DgvStaffData.Rows.Add(new object[] {
             staff.StaffID,
             staff.StaffName,
             staff.StaffPhone,
             staff.Role
         });
     }
     hasUpdated = false;
 }
Пример #25
0
        public ActionResult Delete(int id)
        {
            StaffDao dao        = new StaffDao();
            staff    exists_sta = dao.GetById(id);

            var image_old = Path.Combine(Server.MapPath("~/Areas/Admins/Content/Photo/Staff/"),
                                         System.IO.Path.GetFileName(exists_sta.sta_image));

            if (System.IO.File.Exists(image_old))
            {
                System.IO.File.Delete(image_old);
            }
            dao.Delete(id);
            return(RedirectToAction("Index"));
        }
Пример #26
0
        public static bool update(StaffDto staff)
        {
            bool result = StaffDao.Update(staff);

            if (result)
            {
                StaffDto oldDto = allStaffs.FirstOrDefault(n => n.UserId == staff.UserId);
                if (oldDto != null)
                {
                    allStaffs.Remove(oldDto);
                }
                allStaffs.Add(staff);
                allStaffs.OrderBy(n => n.UserId);
            }
            return(result);
        }
        private bool Save()
        {
            EtPurchase purchase;

            if (-1 == CmbOperator.SelectedIndex)
            {
                MsgBoxUtil.ErrMsgBox("经办人不能为空!");
                return(false);
            }
            int staffId = StaffDao.QueryByStaffName(CmbOperator.SelectedItem.ToString())[0].StaffID;
            int res     = 0;

            foreach (ClsGood good in Goods)
            {
                purchase = new EtPurchase {
                    PurchaseID   = int.Parse(LblPurchaseID.Text),
                    Category     = good.Good.Category,
                    PurchaseDate = DtpPurchaseDate.Value.ToString("yyyyMMdd"),
                    Quantity     = good.Count,
                    Cost         = good.Good.Cost,
                    StaffID      = staffId
                };
                res += PurchaseDao.InsertPurchase(purchase);
                EtGood g = new EtGood {
                    Category       = good.Good.Category,
                    ProductionDate = good.Good.ProductionDate,
                    PurchaseDate   = purchase.PurchaseDate,
                    Cost           = good.Good.Cost,
                    Price          = good.Good.Price,
                    State          = good.Good.State
                };
                for (int i = 0; i < good.Count; i++)
                {
                    GoodDao.InsertGood(g);
                }
            }
            if (res == Goods.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #28
0
        private void DgvSalAdd(List <EtSale> sales)
        {
            DgvSaleResult.Rows.Clear();
            int saleID = 0;

            for (int i = 0; i < sales.Count; i++)
            {
                if (saleID != sales[i].SaleID)
                {
                    DgvSaleResult.Rows.Add(new object[] {
                        sales[i].SaleID,
                        sales[i].SaleDate,
                        StaffDao.QueryByStaffID(sales[i].StaffID)[0].StaffName
                    });
                    saleID = sales[i].SaleID;
                }
            }
        }
Пример #29
0
 private void BtnStaffSubmit_Click(object sender, EventArgs e)
 {
     if (hasUpdated)
     {
         if (DialogResult.OK == MsgBoxUtil.QuestionMsgBox("确认提交?"))
         {
             foreach (EtStaff staff in staffs)
             {
                 StaffDao.InsertStaff(staff);
             }
             hasUpdated = false;
         }
     }
     else
     {
         MsgBoxUtil.ErrMsgBox("没有待添加的员工!");
     }
 }
Пример #30
0
        public ActionResult Create(staff sta, HttpPostedFileBase photo)
        {
            GroupRoleDao grDao = new GroupRoleDao();
            StaffDao     dao   = new StaffDao();

            if (ModelState.IsValid)
            {
                try
                {
                    if (photo != null && photo.ContentLength > 0)
                    {
                        string image = String.Concat(sta.sta_username, photo.FileName);
                        var    path  = Path.Combine(Server.MapPath("~/Areas/Admins/Content/Photo/Staff/"),
                                                    System.IO.Path.GetFileName(image));
                        photo.SaveAs(path);

                        sta.sta_image = image;
                        //Mail
                        string content = System.IO.File.ReadAllText("D:/Kì 2 Năm 3/CNWEB/web_ieltsv2/coderush/Common/Template/sendmail.html");
                        content = content.Replace("{{Username}}", sta.sta_username);
                        content = content.Replace("{{Password}}", sta.sta_password);

                        new MailHelper().SendMail(sta.sta_email, "Thông tin tài khoản", content);
                    }
                    else
                    {
                        sta.sta_image = "tienmta7.png";
                    }
                    sta.sta_created_at = DateTime.Now;
                    dao.Create(sta);
                    return(RedirectToAction("Index"));
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.Message);
                    return(View("Error"));
                }
            }
            else
            {
                ViewBag.lst_gr = grDao.GetAll();
                return(View(sta));
            }
        }