示例#1
0
        //
        // GET: /MstDelegation/

        public ActionResult Index()
        {
            var data  = _DelegationBLL.GetDelegation();
            var model = new DelegationModel();

            model.Details = Mapper.Map <List <DelegationItem> >(data);
            this.CheckDelegationPeriod(model.Details);
            model.MainMenu          = _mainMenu;
            model.CurrentLogin      = CurrentUser;
            model.CurrentPageAccess = CurrentPageAccess;
            return(View(model));
        }
示例#2
0
        public ActionResult Index(LoginFormModel model)
        {
            var item = new LdapDto();

            item = DoLogin(model.Login.UserId);

            IRoleBLL _roleBll = MvcApplication.GetInstance <RoleBLL>();

            if (item.Login != null)
            {
                var roles = _roleBll.GetRoles();
                CurrentUser                = new Login();
                CurrentUser.UserRole       = _roleBll.GetUserRole(item.RoleName);
                CurrentUser.AuthorizePages = roles.Where(x => x.RoleName == item.RoleName).ToList();
                CurrentUser.EMPLOYEE_ID    = item.EmployeeId;
                CurrentUser.USERNAME       = item.DisplayName;
                CurrentUser.USER_ID        = item.Login;

                CurrentUser.LoginFor = new List <LoginFor>();

                var delegationsList = _delegationBLL.GetDelegation().Where(x => x.LoginTo == item.Login &&
                                                                           x.DateFrom <= DateTime.Now &&
                                                                           x.DateTo >= DateTime.Now).ToList();
                foreach (var delegationDto in delegationsList)
                {
                    var loginForDto = DoLogin(delegationDto.LoginFrom);
                    if (loginForDto.Login != null)
                    {
                        CurrentUser.LoginFor.Add(new LoginFor()
                        {
                            UserRole       = _roleBll.GetUserRole(loginForDto.RoleName),
                            AuthorizePages = roles.Where(x => x.RoleName == loginForDto.RoleName).ToList(),
                            EMPLOYEE_ID    = loginForDto.EmployeeId,
                            EMPLOYEE_NAME  = loginForDto.DisplayName,
                            USER_ID        = loginForDto.Login
                        });
                    }
                }


                return(RedirectToAction("Index", "Home"));
            }

            return(RedirectToAction("Unauthorized", "Error"));
        }
        public CarComplaintFormItem listdata(CarComplaintFormItem model, string IdEmployee)
        {
            var listemployeefromdelegation = _delegationBLL.GetDelegation().Select(x => new { dataemployeefrom = x.EmployeeFrom + x.NameEmployeeFrom, x.EmployeeFrom, x.NameEmployeeFrom, x.EmployeeTo, x.NameEmployeeTo, x.DateTo }).ToList().Where(x => x.EmployeeTo == CurrentUser.EMPLOYEE_ID && x.DateTo >= DateTime.Today).OrderBy(x => x.EmployeeFrom);

            model.EmployeeFromDelegationList = new SelectList(listemployeefromdelegation, "EmployeeFrom", "dataemployeefrom");

            var listcomplaintcategory = _complaintcategoryBLL.GetComplaints().Select(x => new { x.MstComplaintCategoryId, x.CategoryName }).ToList().OrderBy(x => x.MstComplaintCategoryId);

            model.ComplaintCategoryList = new SelectList(listcomplaintcategory, "MstComplaintCategoryId", "CategoryName");

            var listsettingvtype = _settingBLL.GetSetting().Select(x => new { x.SettingGroup, x.SettingName, x.SettingValue }).ToList().Where(x => x.SettingGroup == "VEHICLE_TYPE").OrderBy(x => x.SettingValue);

            model.SettingListVType = new SelectList(listsettingvtype, "SettingValue", "SettingName");

            var listsettingvusage = _settingBLL.GetSetting().Select(x => new { x.SettingGroup, x.SettingName, x.SettingValue }).ToList().Where(x => x.SettingGroup == "VEHICLE_USAGE").OrderBy(x => x.SettingValue);

            model.SettingListVUsage = new SelectList(listsettingvusage, "SettingValue", "SettingName");

            var listsettingfleet = _fleetBLL.GetFleet().Select(x => new { x.MstFleetId, x.VehicleType, x.VehicleUsage, x.PoliceNumber, x.EmployeeID, x.EmployeeName, x.Manufacturer, x.Models, x.Series, x.VendorName, x.StartContract, x.EndContract }).ToList().Where(x => x.EmployeeID == IdEmployee).OrderBy(x => x.EmployeeName);

            model.SettingListFleet = new SelectList(listsettingfleet, "PoliceNumber", "PoliceNumber");

            return(model);
        }