예제 #1
0
        public JsonHttpActionResult GetTerminal(string departure)
        {
            var j = new JsonHttpActionResult();

            if (string.IsNullOrEmpty(departure))
            {
                return(j.SetData(new List <JDItineraryVModel>()).SucceedMessage());
            }

            var all = _jDItinerayService.GetTerminalByDeparture(departure);

            var convertList = _mapper.Map <IEnumerable <JDItineraryModel>, IEnumerable <JDItineraryVModel> >(all);

            return(j.SetData(convertList).SucceedMessage());
        }
예제 #2
0
        public JsonHttpActionResult GetJDItineraryCosts(string jDItineraryCode)
        {
            var j = new JsonHttpActionResult();

            if (string.IsNullOrEmpty(jDItineraryCode))
            {
                return(j.SetData(new List <JDItineraryCostVModel>()).SucceedMessage());
            }

            var all = _jDItinerayService.GetAllJDItineraryCosts(jDItineraryCode);

            var convertList = _mapper.Map <IEnumerable <JDItineraryCostModel>, IEnumerable <JDItineraryCostVModel> >(all);

            return(j.SetData(convertList).SucceedMessage());
        }
예제 #3
0
        public JsonHttpActionResult SaveJDItineraryCostInfo(JDItineraryCostModel model)
        {
            var j       = new JsonHttpActionResult();
            var success = true;

            if (string.IsNullOrWhiteSpace(model.RelationCode))
            {
                var checkJDItineraryCostName = _jDItinerayService.ExistxJDItineraryCost(model.JDItineraryCode, model.CarTypeCode);
                if (checkJDItineraryCostName)
                {
                    return(j.ErrorMessage("车型已存在"));
                }
                model.CreateDate        = DateTime.Now;
                model.CreateUserName    = UserInfo.UserName;
                model.CreateDisplayName = UserInfo.DisplayName;
                model.IsDeleted         = false;
            }
            else
            {
                var checkJDItineraryCostName = _jDItinerayService.ExistxJDItineraryCost(model.JDItineraryCode, model.CarTypeCode, model.RelationCode);
                if (checkJDItineraryCostName)
                {
                    return(j.ErrorMessage("车型已存在"));
                }
                model.ModifyDate        = DateTime.Now;
                model.ModifyUserName    = UserInfo.UserName;
                model.ModifyDisplayName = UserInfo.DisplayName;
            }

            success = _jDItinerayService.SaveJDItineraryCost(model);

            j.SetData(success);

            return(success ? j.SucceedMessage() : j.ErrorMessage());
        }
예제 #4
0
        //public IActionResult Login()
        //{
        //    return View();
        //}

        public JsonHttpActionResult VerifyLogin(string username, string password)
        {
            var j = new JsonHttpActionResult();

            var user = _userService.GetUserByUserNameAndPwd(username, password);

            var success = user != null;

            if (success)
            {
                var userClaims = new List <Claim>()
                {
                    new Claim(ClaimTypes.Name, user.UserName),
                    new Claim(ClaimTypes.Role, user.RoleCode),
                    new Claim("DisplayName", user.DisplayName)
                };

                var grandmaIdentity = new ClaimsIdentity(userClaims, "User Identity");

                var userPrincipal = new ClaimsPrincipal(new[] { grandmaIdentity });

                HttpContext.SignInAsync(userPrincipal);
            }

            j.SetData(success);

            return(success ? j.SucceedMessage() : j.ErrorMessage());
        }
예제 #5
0
        public JsonHttpActionResult GetRoleList()
        {
            var list = _roleService.GetAllRoles(string.Empty);

            var convertList = _mapper.Map <IEnumerable <RoleModel>, IEnumerable <RoleVModel> >(list);

            var j = new JsonHttpActionResult();

            return(j.SetData(convertList).SucceedMessage());
        }
예제 #6
0
        public JsonHttpActionResult GetDicListByTypeCode(string dicTypeCode)
        {
            var dicList = _dicService.GetDicListByTypeCode(dicTypeCode);

            var list = _mapper.Map <IEnumerable <DicModel>, IEnumerable <DicVModel> >(dicList);

            var j = new JsonHttpActionResult();

            return(j.SetData(list).SucceedMessage());
        }
예제 #7
0
        public JsonHttpActionResult SaveRoleMenu(IEnumerable <MenuTreeVModel> list, string roleCode)
        {
            var j = new JsonHttpActionResult();

            var convertList = _mapper.Map <IEnumerable <MenuModel> >(list);

            var user = UserInfo;

            var success = _roleService.SaveRoleMenu(convertList, roleCode, user.UserName, user.DisplayName);

            j.SetData(success);

            return(success ? j.SucceedMessage() : j.ErrorMessage());
        }
예제 #8
0
        public JsonHttpActionResult RemoveJDItineraryCostByCode(IEnumerable <JDItineraryCostModel> list)
        {
            var j = new JsonHttpActionResult();

            if (list.Count() == 0)
            {
                return(j.ErrorMessage("请选择要删除的车型"));
            }

            var user = UserInfo;

            var success = _jDItinerayService.RemoveJDItineraryCostByCode(list, user.UserName, user.DisplayName);

            j.SetData(success);

            return(success ? j.SucceedMessage() : j.ErrorMessage());
        }
예제 #9
0
        public JsonHttpActionResult RemoveOrderZWYSByCode(IEnumerable <OrderZWYSModel> list)
        {
            var j = new JsonHttpActionResult();

            if (list.Count() == 0)
            {
                return(j.ErrorMessage("请选择要删除的订单"));
            }

            var user = UserInfo;

            var success = _orderZWYSService.RemoveOrderZWYSByOrderNo(list, user.UserName, user.DisplayName);

            j.SetData(success);

            return(success ? j.SucceedMessage() : j.ErrorMessage());
        }
예제 #10
0
        public JsonHttpActionResult SettleState(IEnumerable <OrderJDModel> list)
        {
            var j = new JsonHttpActionResult();

            if (list.Count() == 0)
            {
                return(j.ErrorMessage("请选择要结算的订单"));
            }

            var user = UserInfo;

            var success = _orderJDService.SettleState(list, user.UserName, user.DisplayName);

            j.SetData(success);

            return(success ? j.SucceedMessage() : j.ErrorMessage());
        }
예제 #11
0
        public JsonHttpActionResult SaveOrderJD(OrderJDModel order)
        {
            var j       = new JsonHttpActionResult();
            var success = true;

            if (order.OrderId == 0)
            {
                //检查订单号是否存在
                if (order.OrderNo != "无单号")
                {
                    var checkOrderNo = _orderJDService.ExistsOrderNo(order.OrderNo, order.OrderId);
                    if (checkOrderNo)
                    {
                        return(j.ErrorMessage("订单号已存在"));
                    }
                }
                order.CreateDate        = DateTime.Now;
                order.CreateUserName    = UserInfo.UserName;
                order.CreateDisplayName = UserInfo.DisplayName;
                order.IsDeleted         = false;
                order.SettleState       = false;
            }
            else
            {
                if (order.OrderNo != "无单号")
                {
                    //检查订单号是否存在
                    var checkOrderNo = _orderJDService.ExistsOrderNo(order.OrderNo, order.OrderId);
                    if (checkOrderNo)
                    {
                        return(j.ErrorMessage("订单号已存在"));
                    }
                }
                order.ModifyDate        = DateTime.Now;
                order.ModifyUserName    = UserInfo.UserName;
                order.ModifyDisplayName = UserInfo.DisplayName;
            }

            success = _orderJDService.SaveOrderJD(order);

            j.SetData(success);

            return(success ? j.SucceedMessage() : j.ErrorMessage());
        }
예제 #12
0
        public JsonHttpActionResult SaveRoleInfo(RoleModel model)
        {
            var j       = new JsonHttpActionResult();
            var success = true;

            if (string.IsNullOrWhiteSpace(model.RoleCode))
            {
                //检查用户账号是否存在
                var checkUserName = _roleService.ExistsRoleName(model.RoleName);
                if (checkUserName)
                {
                    return(j.ErrorMessage("角色名称已存在"));
                }
                model.CreateDate        = DateTime.Now;
                model.CreateUserName    = UserInfo.UserName;
                model.CreateDisplayName = UserInfo.DisplayName;
                model.IsDeleted         = false;
            }
            else
            {
                //检查用户账号是否存在
                var checkUserName = _roleService.ExistsRoleName(model.RoleName, model.RoleCode);
                if (checkUserName)
                {
                    return(j.ErrorMessage("角色名称已存在"));
                }
                model.ModifyDate        = DateTime.Now;
                model.ModifyUserName    = UserInfo.UserName;
                model.ModifyDisplayName = UserInfo.DisplayName;
            }

            success = _roleService.SaveRole(model);

            j.SetData(success);

            return(success ? j.SucceedMessage() : j.ErrorMessage());
        }
예제 #13
0
        public JsonHttpActionResult SaveJDItineraryInfo(JDItineraryModel model)
        {
            var j       = new JsonHttpActionResult();
            var success = true;

            if (string.IsNullOrWhiteSpace(model.JDItineraryCode))
            {
                //检查用户账号是否存在
                var checkJDItineraryName = _jDItinerayService.ExistxJDItinerary(model.Departure, model.Terminal);
                if (checkJDItineraryName)
                {
                    return(j.ErrorMessage("行程已存在"));
                }
                model.CreateDate        = DateTime.Now;
                model.CreateUserName    = UserInfo.UserName;
                model.CreateDisplayName = UserInfo.DisplayName;
                model.IsDeleted         = false;
            }
            else
            {
                //检查用户账号是否存在
                var checkJDItineraryName = _jDItinerayService.ExistxJDItinerary(model.Departure, model.Terminal, model.JDItineraryCode);
                if (checkJDItineraryName)
                {
                    return(j.ErrorMessage("行程已存在"));
                }
                model.ModifyDate        = DateTime.Now;
                model.ModifyUserName    = UserInfo.UserName;
                model.ModifyDisplayName = UserInfo.DisplayName;
            }

            success = _jDItinerayService.SaveJDItinerary(model);

            j.SetData(success);

            return(success ? j.SucceedMessage() : j.ErrorMessage());
        }
예제 #14
0
        public JsonHttpActionResult SavePwd(string old_password, string new_password, string again_password)
        {
            var j = new JsonHttpActionResult();

            if (new_password != again_password)
            {
                return(j.ErrorMessage("两次密码输入不一致"));
            }

            var user = _userService.GetUserByUserNameAndPwd(UserInfo.UserName, old_password);

            if (user == null)
            {
                return(j.ErrorMessage("旧密码错误"));
            }

            user.PassWord = new_password;

            var success = _userService.SaveUser(user, true);

            j.SetData(success);

            return(success ? j.SucceedMessage() : j.ErrorMessage());
        }