コード例 #1
0
        public new PartialViewResult View(string id)
        {
            StockTransferModels model = GetDetail(id);
            var issueStore            = lstStoreReceiving.Where(z => z.Id.Equals(model.IssueStoreId)).FirstOrDefault();

            if (issueStore != null)
            {
                model.IssueStoreName = issueStore.Name;
            }
            var receiveStore = lstStoreReceiving.Where(z => z.Id.Equals(model.ReceiveStoreId)).FirstOrDefault();

            if (receiveStore != null)
            {
                model.ReceiveStoreName = receiveStore.Name;
            }
            //==========
            List <EmployeeModels> listEmp = _EmployeeFactory.GetListEmployee(model.IssueStoreId, null, CurrentUser.ListOrganizationId);
            var Emp = listEmp.Where(x => x.ID.Equals(model.IssueBy)).FirstOrDefault();

            model.IssueBy = Emp == null ? "" : Emp.Name;

            listEmp = _EmployeeFactory.GetListEmployee(model.ReceiveStoreId, null, CurrentUser.ListOrganizationId);
            var EmpRequestBy = listEmp.Where(x => x.ID.Equals(model.RequestBy)).FirstOrDefault();

            model.RequestBy = EmpRequestBy == null ? "" : EmpRequestBy.Name;

            var EmpReceiveBy = listEmp.Where(x => x.ID.Equals(model.ReceiveBy)).FirstOrDefault();

            model.ReceiveBy = EmpReceiveBy == null ? "" : EmpReceiveBy.Name;

            return(PartialView("_View", model));
        }
コード例 #2
0
        public ActionResult SearchUser(EmployeeViewModels model)
        {
            try
            {
                var data = _Empfactory.GetListEmployee(model.StoreID, null, CurrentUser.ListOrganizationId);
                List <EmployeeModels> lstNews = new List <EmployeeModels>();
                foreach (var item in data)
                {
                    item.ImageURL = string.IsNullOrEmpty(item.ImageURL) ? Commons.Image100_100 : item.ImageURL;
                    //if (item.ListEmpStore != null && item.ListEmpStore.Any())
                    for (int i = 0; i < item.ListEmpStore.Count; i++)
                    {
                        if (i == 0)
                        {
                            item.StoreName = item.ListEmpStore[i].StoreName;
                            item.StoreID   = item.ListEmpStore[i].StoreID;
                            //============
                            //var lstRoleId = _UserRoleFactory.GetDataEmployee(item.ID).Select(x => x.RoleID).ToList();
                            item.RoleName = _ROfactory.ListRoleNameByEmp(item.ID, item.StoreID);
                        }
                        else
                        {
                            var newItem = new EmployeeModels();
                            newItem.ID        = item.ID;
                            newItem.Name      = item.Name;
                            newItem.Email     = item.Email;
                            newItem.RoleID    = item.RoleName;
                            newItem.ImageData = item.ImageData;
                            newItem.ImageURL  = item.ImageURL;
                            newItem.StoreName = item.ListEmpStore[i].StoreName;
                            newItem.StoreID   = item.ListEmpStore[i].StoreID;
                            //var lstRoleId = _UserRoleFactory.GetDataEmployee(item.ID).Select(x => x.RoleID).ToList();
                            newItem.RoleName = _ROfactory.ListRoleNameByEmp(newItem.ID, newItem.StoreID);

                            lstNews.Add(newItem);
                        }
                    }
                }
                data.AddRange(lstNews);
                var currentUser = (UserSession)System.Web.HttpContext.Current.Session["User"];
                if (currentUser != null)
                {
                    data = data.Where(ww => currentUser.ListStoreID.Contains(ww.StoreID)).ToList();
                }
                model.ListItem = data;
            }
            catch (Exception e)
            {
                _logger.Error("Account_Search: " + e);
                return(new HttpStatusCodeResult(400, e.Message));
            }
            return(PartialView("_ListDataUser", model));
        }
コード例 #3
0
ファイル: CRMSupportController.cs プロジェクト: ttcp112/CSC
 public ActionResult Search(SupportViewModels model)
 {
     try
     {
         model.User = CurrentUser;
         var dataMsg = _factory.GetListMessage();
         model.ListMessage = dataMsg;
         var dataEmp = _factoryEmp.GetListEmployee(CurrentUser.UserId, CurrentUser.RoleLevel, "");
         dataEmp = dataEmp.Where(x => !x.ID.Equals(model.User.UserId)).ToList();
         Random rnd = new Random();
         dataEmp.ForEach(x =>
         {
             x.Status           = rnd.Next(0, 2);
             x.ReceivedMessages = rnd.Next(0, 10);
         });
         dataEmp            = dataEmp.OrderByDescending(x => x.ReceivedMessages).ToList();
         model.ListEmployee = dataEmp;
     }
     catch (Exception e)
     {
         NSLog.Logger.Error("SupportSearch: ", e);
         return(new HttpStatusCodeResult(400, e.Message));
     }
     return(PartialView("_ListData", model));
 }
コード例 #4
0
 public ActionResult Search(EmployeeViewModels model)
 {
     try
     {
         var data = _factory.GetListEmployee();
         model.ListEmployee = data;
     }
     catch (Exception e)
     {
         NSLog.Logger.Error("GetListEmployee: ", e);
         return(new HttpStatusCodeResult(400, e.Message));
     }
     return(PartialView("_ListData", model));
 }
コード例 #5
0
ファイル: SBEmployeeController.cs プロジェクト: ttcp112/CSC
        public ActionResult Search(EmployeeViewModels model)
        {
            try
            {
                var data = _factory.GetListEmployee(CurrentUser.UserId, CurrentUser.RoleLevel, model.SearchString);
                ViewBag.CurrentUserId = CurrentUser.UserId;
                model.ListItem        = data;
            }
            catch (Exception e)
            {
                NSLog.Logger.Error("Employee_Search Error: ", e);
                return(new HttpStatusCodeResult(400, e.Message));
            }

            return(PartialView("_ListData", model));
        }
コード例 #6
0
ファイル: ProfileController.cs プロジェクト: ttcp112/FJ
        public EmployeeModels GetDetail(string id)
        {
            try
            {
                EmployeeModels model = _factory.GetListEmployee(null, id)[0];
                model.HiredDate = model.HiredDate.ToLocalTime();
                model.BirthDate = model.BirthDate.ToLocalTime();
                //==========
                RoleWorkingTime rWorkingTime = null;
                int             OffSet       = 0;
                if (model.ListEmpStore != null)
                {
                    foreach (var emp in model.ListEmpStore)
                    {
                        rWorkingTime = new RoleWorkingTime();
                        rWorkingTime.ListWorkingTime.Clear();
                        //if (model.ListEmpStore != null)
                        //{
                        var empOnStore = model.ListEmpStore.Where(x => x.StoreID.Equals(emp.StoreID)).FirstOrDefault();
                        if (empOnStore != null)
                        {
                            model.StoreID   = empOnStore.StoreID;
                            model.StoreName = empOnStore.StoreName;

                            model.RoleID   = empOnStore.RoleID;
                            model.RoleName = empOnStore.RoleName;

                            //===========
                            rWorkingTime.OffSet = OffSet;
                            rWorkingTime.Status = (int)Commons.EStatus.Actived;

                            rWorkingTime.RoleID   = empOnStore.RoleID;
                            rWorkingTime.RoleName = empOnStore.RoleName;

                            rWorkingTime.StoreID   = empOnStore.StoreID;
                            rWorkingTime.StoreName = empOnStore.StoreName;

                            rWorkingTime.GetListRole(rWorkingTime.StoreID, CurrentUser.ListOrganizationId);
                            //===========
                        }
                        //============
                        var lstStore = (List <SelectListItem>)ViewBag.ListStore;
                        model.ListStore = lstStore == null ? new List <SelectListItem>() : lstStore;
                        foreach (var item in model.ListStore)
                        {
                            item.Disabled = model.ListEmpStore.Where(x => x.StoreID.Equals(item.Value)).FirstOrDefault() == null ? false : true;
                            item.Selected = model.ListEmpStore.Where(x => x.StoreID.Equals(item.Value)).FirstOrDefault() == null ? false : true;  //item.Value.Equals(StoreId);
                        }
                        //}
                        if (model.ListWorkingTime != null)
                        {
                            foreach (var itemStore in model.ListWorkingTime)
                            {
                                if (string.IsNullOrEmpty(itemStore.StoreID))
                                {
                                    itemStore.StoreID = emp.StoreID;
                                }
                            }
                            //=========
                            //model.ListWorkingTime = model.ListWorkingTime.Where(x => x.StoreID.Equals(emp.StoreID)).OrderBy(x => x.Day).ToList();
                            var lstWorkingTime = model.ListWorkingTime.Where(x => x.StoreID.Equals(emp.StoreID)).OrderBy(x => x.Day).ToList();
                            for (int i = 0; i < lstWorkingTime.Count; i++)
                            {
                                var item = lstWorkingTime[i];
                                if (item.IsOffline)
                                {
                                    item.From = "OFF";
                                    item.To   = "OFF";
                                }
                                else
                                {
                                    item.From = item.FromTime.ToLocalTime().ToString("HH:mm");
                                    item.To   = item.ToTime.ToLocalTime().ToString("HH:mm");
                                }
                                switch (item.Day)
                                {
                                case 2:
                                    item.StrDate = "Mon";
                                    break;

                                case 3:
                                    item.StrDate = "Tue";
                                    break;

                                case 4:
                                    item.StrDate = "Wed";
                                    break;

                                case 5:
                                    item.StrDate = "Thu";
                                    break;

                                case 6:
                                    item.StrDate = "Fri";
                                    break;

                                case 7:
                                    item.StrDate = "Sat";
                                    break;

                                case 8:
                                    item.StrDate = "Sun";
                                    break;
                                }
                                rWorkingTime.ListWorkingTime.Add(item);
                            }
                        }
                        model.ListRoleWorkingTime.Add(rWorkingTime);
                        OffSet++;
                    }
                }
                return(model);
            }
            catch (Exception ex)
            {
                _logger.Error("Employee_Detail: " + ex);
                return(null);
            }
        }