Beispiel #1
0
        public JsonResult GetMissionList(MissionSearchViewModel SearchViewModel)
        {
            if (SessionMissionSearchViewModel != null)
            {
                if (SearchViewModel != SessionMissionSearchViewModel)
                {
                    SessionMissionSearchViewModel = SearchViewModel;
                }
                else
                {
                    SearchViewModel = SessionMissionSearchViewModel;
                }
            }

            TabulatorJsonViewModel result = new TabulatorJsonViewModel();

            try
            {
                //限制只能為自己的公司
                var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name);
                SearchViewModel.SearchCompanyId = user.CompanyId;

                int pageCount = 0;
                result.data      = _bookingService.GetMissionPageList(SearchViewModel, ref pageCount);
                result.last_page = pageCount;
            }
            catch (Exception ex)
            {
                result.IsOk           = false;
                result.Exception      = ex;
                result.HttpStatusCode = HttpStatusCode.InternalServerError;
            }

            return(Json(result, JsonRequestBehavior.AllowGet));
        }
Beispiel #2
0
        /// <summary>
        /// 依照角色判斷公司下拉選單
        /// </summary>
        /// <returns></returns>
        public List <SelectListItem> GetCompanySelectListItemByRole(string FirstSelectItem)
        {
            var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name);
            var role = _aspNetRolesService.GetById(user.RoleId);

            List <SelectListItem> companySelectListItem = new List <SelectListItem>();

            if (role != null)
            {
                switch (role.Name)
                {
                case "FleetManager":
                    companySelectListItem.AddRange(_companyService.GetCompanyList(user.CompanyId));
                    break;

                default:
                    companySelectListItem.Add(new SelectListItem {
                        Text = FirstSelectItem, Value = "NULL"
                    });
                    companySelectListItem.AddRange(_companyService.GetCompanyList(user.CompanyId));
                    break;
                }
            }

            return(companySelectListItem);
        }
Beispiel #3
0
        public JsonResult GetOrderList(DispatchSearchViewModel SearchViewModel)
        {
            if (SessionDispatchSearchModel != null)
            {
                if (SearchViewModel != SessionDispatchSearchModel)
                {
                    SessionDispatchSearchModel = SearchViewModel;
                }
                else
                {
                    SearchViewModel = SessionDispatchSearchModel;
                }
            }

            ResponseViewModel result = new ResponseViewModel();

            try
            {
                //限制只能為公司報價的
                var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name);
                SearchViewModel.QuotedCompanyId = user.CompanyId;

                result.Data           = _bookingService.GetDispatchBookingList(SearchViewModel);
                result.IsOk           = true;
                result.HttpStatusCode = HttpStatusCode.OK;
            }
            catch (Exception ex)
            {
                result.IsOk           = false;
                result.Exception      = ex;
                result.HttpStatusCode = HttpStatusCode.InternalServerError;
            }

            return(Json(result, JsonRequestBehavior.DenyGet));
        }
Beispiel #4
0
        public JsonResult GetVehicleList(VehicleSearchViewModel SearchViewModel)
        {
            if (SessionVehicleSearchViewModel != null)
            {
                if (SearchViewModel != SessionVehicleSearchViewModel)
                {
                    SessionVehicleSearchViewModel = SearchViewModel;
                }
                else
                {
                    SearchViewModel = SessionVehicleSearchViewModel;
                }
            }

            ResponseViewModel result = new ResponseViewModel();

            try
            {
                //限制只能為自己的公司
                var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name);
                SearchViewModel.SearchCompanyId = user.CompanyId;
                result.Data           = _vehicleService.GetVehicles(SearchViewModel);
                result.IsOk           = true;
                result.HttpStatusCode = HttpStatusCode.OK;
            }
            catch (Exception ex)
            {
                result.IsOk           = false;
                result.Exception      = ex;
                result.HttpStatusCode = HttpStatusCode.InternalServerError;
                result.Data           = new List <VehicleListViewModel>();
            }
            result.ResponseTime = string.Format("{0:yyyy/MM/dd HH:mm:ss}", DateTime.Now);
            return(Json(result, JsonRequestBehavior.DenyGet));
        }
Beispiel #5
0
        /// <summary>
        /// 客戶管理 首頁
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Login", "Account"));
            }

            var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name);

            TempData["CompanyId"] = user.CompanyId;
            return(View(SessionCustomerSearchViewModel));
        }
        /// <summary>
        /// 月報表
        /// </summary>
        /// <returns></returns>
        public ActionResult MonthReport()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Login", "Account"));
            }

            //限制只能為自己的公司
            var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name);

            CommonGoodsOwnerDriverVehicleDropdownList(user.CompanyId);

            return(View(SessionBookingReportMonthSearchModel));
        }
        /// <summary>
        /// 軌跡查詢首頁
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            if (!User.Identity.IsAuthenticated)
            {
                return(RedirectToAction("Login", "Account"));
            }

            List <SelectListItem> vehicleSelectListItems = new List <SelectListItem>();

            //限制只能為自己的公司
            var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name);

            vehicleSelectListItems = _commonService.GetCompanyVehicles(user.CompanyId);
            vehicleSelectListItems.Insert(0, new SelectListItem {
                Text = "不限", Value = "null"
            });
            ViewBag.VehicleList = vehicleSelectListItems;

            List <SelectListItem> driverSelectListItems = new List <SelectListItem>();

            driverSelectListItems = _commonService.GetCompanyDrivers(user.CompanyId);
            driverSelectListItems.Insert(0, new SelectListItem {
                Text = "不限", Value = "null"
            });
            ViewBag.DriverList = driverSelectListItems;

            return(View());
        }
        public JsonResult GetAccountManageList(AccountSearchViewModel SearchViewModel)
        {
            if (SessionAccountSearchViewModel != null)
            {
                if (SearchViewModel != SessionAccountSearchViewModel)
                {
                    SessionAccountSearchViewModel = SearchViewModel;
                }
                else
                {
                    SearchViewModel = SessionAccountSearchViewModel;
                }
            }

            ResponseViewModel result = new ResponseViewModel();

            if (User.Identity.IsAuthenticated)
            {
                try
                {
                    var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name);
                    result.Data           = _aspNetUsersService.GetAccountManageList(SearchViewModel, user);
                    result.IsOk           = true;
                    result.Message        = string.Format("Success");
                    result.HttpStatusCode = HttpStatusCode.OK;
                    _logger.Information($"GetAccountManageList_Success : { result.Message}");
                }
                catch (Exception ex)
                {
                    result.IsOk           = false;
                    result.Exception      = ex;
                    result.Message        = string.Format("False");
                    result.HttpStatusCode = HttpStatusCode.InternalServerError;
                    result.Data           = new List <AccountManageViewModel>();

                    _logger.Information($"GetAccountManageList_Exception : { JsonConvert.SerializeObject(result)}");
                }
            }
            else
            {
                result.IsOk           = false;
                result.Message        = MessageResource.Unauthorized;
                result.HttpStatusCode = HttpStatusCode.Unauthorized;
            }
            result.ResponseTime = string.Format("{0:yyyy/MM/dd HH:mm:ss}", DateTime.Now);
            return(Json(result, JsonRequestBehavior.DenyGet));
        }
        /// <summary>
        /// 角色與權限管理首頁 : 角色(資訊)列表
        /// </summary>
        /// <returns></returns>
        //[OutputCache(Duration = 600, VaryByParam ="*")]
        public async Task <JsonResult> RoleCounters()
        {
            ResponseViewModel res = new ResponseViewModel();

            if (!User.Identity.IsAuthenticated)
            {
                res.IsOk           = false;
                res.Message        = MessageResource.Unauthorized;
                res.HttpStatusCode = HttpStatusCode.Unauthorized;
            }
            else
            {
                try
                {
                    var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name);
                    IList <RolesCounterModel> cnts = await _roleService.RolesCounter(user.CompanyId);

                    res.IsOk           = true;
                    res.Message        = "";
                    res.Data           = cnts;
                    res.HttpStatusCode = HttpStatusCode.OK;

                    if (!(cnts.Count() > 0))
                    {
                        res.Data           = new List <RolesCounterModel>();
                        res.Message        = MessageResource.NoDataCurrent;
                        res.HttpStatusCode = (HttpStatusCode)CustomHttpStatusCode.NoDataCurrent;
                    }
                }
                catch (Exception ex)
                {
                    res.IsOk           = false;
                    res.Message        = MessageResource.UnexpectedErrorOccurred;
                    res.Data           = new List <RolesCounterModel>();
                    res.HttpStatusCode = HttpStatusCode.InternalServerError;
                    res.Exception      = ex;
                }
            }

            res.ResponseTime = string.Format("{0:yyyy/MM/dd HH:mm:ss}", DateTime.Now);
            _logger.Information("Role_RoleCounters_Reutn: {0}", JsonConvert.SerializeObject(res));
            return(Json(res, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetOrderList(BaseBookingSearchModel SearchViewModel)
        {
            if (SessionOrderBookingSearchModel != null)
            {
                if (SearchViewModel != SessionOrderBookingSearchModel)
                {
                    SessionOrderBookingSearchModel = SearchViewModel;
                }
                else
                {
                    SearchViewModel = SessionOrderBookingSearchModel;
                }
            }

            ResponseViewModel result = new ResponseViewModel();

            try
            {
                //限制只能為自己下訂的
                var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name);
                SearchViewModel.SearchCompanyId = user.CompanyId;
                SearchViewModel.IsAssignDriver  = true;
                SearchViewModel.ProcessStatusList.Add((byte)BookingProcessStatusEnum.Quote);
                SearchViewModel.ProcessStatusList.Add((byte)BookingProcessStatusEnum.ConfirmTransaction);

                _logger.Debug("GetOrderList model:" + JsonConvert.SerializeObject(SearchViewModel));

                result.Data           = _bookingService.GetOrderBookingList(SearchViewModel);
                result.IsOk           = true;
                result.HttpStatusCode = HttpStatusCode.OK;
            }
            catch (Exception ex)
            {
                result.IsOk           = false;
                result.Exception      = ex;
                result.HttpStatusCode = HttpStatusCode.InternalServerError;
                _logger.Debug("GetOrderList ex:" + JsonConvert.SerializeObject(ex.Message));
            }

            return(Json(result, JsonRequestBehavior.DenyGet));
        }
        /// <summary>
        /// 即時監控 首頁
        /// </summary>
        /// <returns></returns>
        public ActionResult Index()
        {
            ResponseViewModel result = new ResponseViewModel();

            if (!User.Identity.IsAuthenticated)
            {
                result.IsOk           = false;
                result.HttpStatusCode = HttpStatusCode.Unauthorized;
                result.Message        = "逾時登入,請重新登入";
                _logger.Information("Index", JsonConvert.SerializeObject(result));
                return(RedirectToAction("Login", "Account"));
            }

            var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name);

            StatusListCollention collention = new StatusListCollention();

            collention.CStatuSstatisticsList  = _lastLocationService.GetCStatuSstatisticsList(user.CompanyId);
            collention.GroupVehicleStatusList = _lastLocationService.GetGroupVehicleStatusList(user.CompanyId);
            return(View(collention));
        }
Beispiel #12
0
        public JsonResult GetDashBoardData()
        {
            int companyId = 0;

            if (User.Identity.IsAuthenticated)
            {
                var user = _aspNetUsersService.GetUserModelByName(User.Identity.Name);
                companyId = user.CompanyId;
            }

            var data = _bookingService.GetDashboardInfo(companyId);

            return(Json(new { jsonData = data }));
        }