示例#1
0
        //添加員工頁面 更具條件搜索員工功能
        public ActionResult StaffAdd()
        {
            string          ID         = Request.Form["ID"];
            string          BU         = Request.Form["BU"];
            string          RData      = Request.Form["RData"];
            cpf_fileService cpfService = new cpf_fileService();
            List <cpf_file> cpf        = cpfService.Getcpf_fileByIdBuDate(ID, BU, RData);
            //過濾已經存在的員工
            Commoo          comm   = new Commoo();
            List <cpf_file> newcpf = new List <cpf_file>();

            if (cpf != null)
            {
                newcpf = comm.filtercpf(cpf);
            }

            ViewData["cpf"] = newcpf;
            return(View());
        }
示例#2
0
        //添加員工頁面 添加員工功能
        public ActionResult AddToStaff(string[] UserId, string ps, string cls, string ln)
        {
            //string BU = "PE17";
            List <string>     list       = new List <string>();
            List <cpf_file>   cpf        = new List <cpf_file>();
            List <Staff>      staff      = new List <Staff>();
            List <PhoneUsers> phoneUsers = new List <PhoneUsers>();

            if (UserId == null)
            {
                return(Content("請選擇要添加的數據"));
            }
            foreach (var item in UserId)
            {
                list.Add(item.ToString());
            }
            StaffService    staffService = new StaffService();
            cpf_fileService cpfService   = new cpf_fileService();

            cpf = cpfService.Getcpf_fileBylistId(list);
            Commo.Commoo comm = new Commo.Commoo();

            staff = comm.GetStaffList(cpf, BU, cls, ln, ps);
            //線長添加手機點名賬號
            if (ps == "線長")
            {
                phoneUsers = comm.GetPhoneUsersList(cpf);
                PhoneUsersService phoneUsersService = new PhoneUsersService();
                phoneUsersService.addPhoneUsersList(phoneUsers);
            }
            int number = staffService.addStaffList(staff);

            if (number > 0)
            {
                return(Content("OK 成功添加 " + number + "條數據"));
            }
            else
            {
                return(Content("添加失敗 人員已存在"));
            }
        }