Exemplo n.º 1
0
        public async Task <string> GetStaffInfoByID(string info)
        {
            if (string.IsNullOrWhiteSpace(info))
            {
                return(JsonConvert.SerializeObject(new
                {
                    status = "fail",
                    message = "员工ID不能为空",
                    date = DateTime.Now
                }));
            }
            int      ID     = Convert.ToInt32(info);
            StaffDal dal    = new StaffDal();
            var      result = await dal.GetStaffInfoByID(ID);

            if (result.ResultCode != 0)
            {
                return(JsonConvert.SerializeObject(new
                {
                    status = "fail",
                    message = result.ResultMsg,
                    date = DateTime.Now
                }));
            }

            return(JsonConvert.SerializeObject(new
            {
                status = "success",
                data = result.Data,
                date = DateTime.Now
            }));
        }
Exemplo n.º 2
0
 internal List <StaffEntity> GetStaffByUserIDEntities(Guid UserID, string LanguageCode = null)
 {
     try
     {
         StaffDal objDAL   = new StaffDal();
         DataSet  dsFields = objDAL.GetByUserID(UserID, LanguageCode);
         return(MappingManager.MapStaffAsListOfEntities(dsFields));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 3
0
 internal List <Staff> GetAllStaffObjects()
 {
     try
     {
         StaffDal objDAL   = new StaffDal();
         DataSet  dsFields = objDAL.GetAll();
         return(MappingManager.MapStaffAsListOfBLObjects(dsFields));
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 4
0
 internal Staff GetStaffByIDObject(Guid ID, string LanguageCode = null)
 {
     try
     {
         StaffDal objDAL   = new StaffDal();
         DataSet  dsFields = objDAL.GetByID(ID, LanguageCode);
         if (dsFields == null || dsFields.Tables[0].Rows.Count == 0)
         {
             return(null);
         }
         return(MappingManager.MapStaffAsListOfBLObjects(dsFields)[0]);
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
Exemplo n.º 5
0
        public async Task <string> AddStaffInfo(string info)
        {
            StaffInfo staffInfo = JsonConvert.DeserializeObject <StaffInfo>(info);
            StaffDal  dal       = new StaffDal();
            var       result    = await dal.AddStaffInfo(staffInfo);

            if (result.ResultCode != 0)
            {
                return(JsonConvert.SerializeObject(new
                {
                    status = "fail",
                    message = result.ResultMsg,
                    date = DateTime.Now
                }));
            }

            return(JsonConvert.SerializeObject(new
            {
                status = "success",
                data = result.Data,
                date = DateTime.Now
            }));
        }
Exemplo n.º 6
0
        public async Task <string> GetPageStaffInfo(string info)
        {
            PageStaffQueryInfo pageStaffQueryInfo = JsonConvert.DeserializeObject <PageStaffQueryInfo>(info);
            StaffDal           dal = new StaffDal();
            var result             = await dal.GetPageStaffInfo(pageStaffQueryInfo.CurrentPage, pageStaffQueryInfo.PageSize,
                                                                pageStaffQueryInfo.StaffQueryInfo);

            if (result.ResultCode != 0)
            {
                return(JsonConvert.SerializeObject(new
                {
                    status = "fail",
                    message = result.ResultMsg,
                    date = DateTime.Now
                }));
            }

            return(JsonConvert.SerializeObject(new
            {
                status = "success",
                data = result.Data,
                date = DateTime.Now
            }));
        }
Exemplo n.º 7
0
        public static List <StaffClass> Login(string username, string password)
        {
            List <StaffClass> results = StaffDal.LoginStaff(username, password);

            return(results);
        }
Exemplo n.º 8
0
 public static string StaffLookup(int staffID)
 {
     return(StaffDal.StaffLookup(staffID));
 }
Exemplo n.º 9
0
        public static bool RegisterStaff(string username, string password, string fullname, int permission)
        {
            int status = StaffDal.CreateStaff(username, password, fullname, permission);

            return(status == 1);
        }
Exemplo n.º 10
0
        public ActionResult Login(string UserID1, string Password1)
        {
            IStaffDal staffDal = new StaffDal();
            //ViewBag.Message = "Your application description page.";
            Sys_Users  user      = new Sys_Users();
            PhoneUsers phoneuser = new PhoneUsers();
            bool       flag      = true; //驗證標記

            if (UserID1 != null && Password1 != null)
            {
                //驗證PhoneUser 上有沒有數數據
                var temp = Sys_user.DbSession.PhoneUsersDal.GetEntity(u => u.ID == UserID1 && u.PASSWORD1 == Password1);

                if (temp.Count() == 1)
                {
                    flag = false;
                    PhoneUsers pu = new PhoneUsers();
                    foreach (PhoneUsers t in temp)
                    {
                        var temp1 = Sys_user.DbSession.StaffDal.GetEntity(u => u.ID == UserID1);
                        foreach (Staff a in temp1)
                        {
                            //Session["Users"] = temp1 as Staff;
                            Session["UserID"]       = a.ID;
                            Session["UserBU"]       = a.BU;
                            Session["UserCLASS"]    = a.CLASS;
                            Session["UserLINENAME"] = a.LINENAME;
                        }
                        pu = t;
                    }
                    //線長
                    if (pu.power1 == "1")
                    {
                        return(RedirectToAction("../Phone/CallNameSelectClass"));
                    }
                    //看明細的管理人員
                    if (pu.power1 == "3")
                    {
                        return(RedirectToAction("../details/QCdetail"));
                    }
                }

                //驗證文員賬號
                user = Sys_user.GetSys_Users(UserID1, Password1);
                if (user.Emp_no != null)
                {
                    flag          = false;
                    Session["BU"] = user.Item3;
                    // BU = user.Item3;
                    return(RedirectToAction("../Staff/StaffSearch"));
                    // return  View("../Staff/StaffSearch");
                }
                if (flag)
                {
                    string msg    = "验证失败";
                    var    script = string.Format("alert('{0}');", msg);
                    //return JavaScript(script);
                    return(Content("<script>alert('验证失败');history.go(-1);</script>"));
                }
            }
            return(View());
            //return Content("密碼錯誤");
        }
Exemplo n.º 11
0
 public StaffManager()
 {
     _staffDal = new StaffDal();
 }
Exemplo n.º 12
0
        internal int DeleteStaffByID(Guid ID)
        {
            StaffDal ObjDal = new StaffDal();

            return(ObjDal.DeleteByID(ID));
        }