Example #1
0
        public async Task <List <Store_BusinessTypeDTO> > SingleListBusinessType([FromBody] Store_BusinessTypeFilterDTO Store_BusinessTypeFilterDTO)
        {
            if (!ModelState.IsValid)
            {
                throw new BindException(ModelState);
            }

            BusinessTypeFilter BusinessTypeFilter = new BusinessTypeFilter();

            BusinessTypeFilter.Skip      = 0;
            BusinessTypeFilter.Take      = int.MaxValue;
            BusinessTypeFilter.OrderBy   = BusinessTypeOrder.Id;
            BusinessTypeFilter.OrderType = OrderType.ASC;
            BusinessTypeFilter.Selects   = BusinessTypeSelect.ALL;
            BusinessTypeFilter.Id        = Store_BusinessTypeFilterDTO.Id;
            BusinessTypeFilter.Code      = Store_BusinessTypeFilterDTO.Code;
            BusinessTypeFilter.Name      = Store_BusinessTypeFilterDTO.Name;

            List <BusinessType> BusinessTypes = await BusinessTypeService.List(BusinessTypeFilter);

            List <Store_BusinessTypeDTO> Store_BusinessTypeDTOs = BusinessTypes
                                                                  .Select(x => new Store_BusinessTypeDTO(x)).ToList();

            return(Store_BusinessTypeDTOs);
        }
Example #2
0
        /// <summary>
        /// 校验价格是否正确和返回原价、优惠价
        /// </summary>
        /// <param name="orderTypeId"></param>
        /// <param name="price"></param>
        /// <param name="prePrice"></param>
        /// <returns></returns>
        private bool ValidPrice(int orderTypeId, decimal price, bool isRepeat, ref decimal oriPrice, ref decimal?prePrice)
        {
            var comparePrice = 0m;
            var isPromotion  = false;

            var rBusinessType = BusinessTypeService.GetById(orderTypeId);

            var originalPrice     = rBusinessType.RbusinessPrice.OriginalCost;
            var preferentialPrice = rBusinessType.RbusinessPrice.PreferentialCost; //即使数据库为NULL,返回的也是0,所以后台管理要做区分
            var secondPrice       = rBusinessType.RbusinessPrice.SecondCost;       //即使数据库为NULL,返回的也是0,所以后台管理要做区分


            if (DateTime.Now >= rBusinessType.RsalesPromotion.StartTime &&
                DateTime.Now <= rBusinessType.RsalesPromotion.EndTime)
            {
                isPromotion = true;
            }

            if (isRepeat)
            {
                comparePrice = secondPrice != 0 ? secondPrice : oriPrice;

                if (secondPrice != 0)
                {
                    prePrice = secondPrice;
                }
                else
                {
                    prePrice = null;
                }
            }

            else
            {
                if (isPromotion)
                {
                    comparePrice = preferentialPrice != 0 ? preferentialPrice : originalPrice;
                }
                else
                {
                    comparePrice = originalPrice;
                }

                if (preferentialPrice != 0)
                {
                    prePrice = preferentialPrice;
                }
                else
                {
                    prePrice = null;
                }
            }

            oriPrice = originalPrice;

            return(price == comparePrice);
        }
Example #3
0
 public ActionResult GetBaseInfo(string inoutType)
 {
     if (Session["Power"] == null || Session["UserCode"] == null)
     {
         return(null);
     }
     else
     {
         string UserCode = Session["UserCode"].ToString();                                     //员工编号
         string Power    = Session["Power"].ToString();                                        //权限字符串
         var    list     = WarehouseService.LoadEntities(a => Power.Contains(a.DepartmentId)); //仓库 货位
         var    list1    = GoodItemService.LoadEntities(a => Power.Contains(a.DepartmentId));  //物料档案
         var    temp     = UserFrameworkService.LoadEntities(u => Power.Contains(u.DeptCode));
         var    list2    = (from a in temp
                            select new
         {
             a.UserCode,
             a.UserName
         }).Distinct();                                                                      //人员信息
         var list3 = LoadGoodsTypeService.LoadEntities(a => Power.Contains(a.DepartmentId)); //装卸类型
         var list4 = BusinessTypeService.LoadEntities(a => Power.Contains(a.DepartmentId));  //业务类型
         //出入库类别
         IQueryable <DBModel.InOutType> list5;
         if (inoutType == "in")
         {
             list5 = InOutTypeService.LoadEntities(a => Power.Contains(a.DepartmentId) && a.InoutType == "入库");
         }
         else if (inoutType == "out")
         {
             list5 = InOutTypeService.LoadEntities(a => Power.Contains(a.DepartmentId) && a.InoutType == "出库");
         }
         else
         {
             list5 = InOutTypeService.LoadEntities(a => Power.Contains(a.DepartmentId));
         }
         var list6 = UserFrameworkService.LoadEntities(u => u.UserCode == UserCode);//公司部门信息
         var res   = new
         {
             Warehouse     = list.Select(a => new { a.Id, a.Name, a.Department, a.Location }),
             GoodItem      = list1.Select(a => new { a.ItemCode, a.ItemLine, a.ItemName, a.ItemSpecifications, a.ItemUnit, a.UnitWeight, a.IsBatch }),
             UserFramework = list2.Select(a => new { a.UserCode, a.UserName }),
             LoadGoodsType = list3.Select(a => a.Name),
             BusinessType  = list4.Select(a => a.Name),
             InOutType     = list5.Select(a => new { a.Id, a.Name, a.InoutType }),
             Departent     = list6.Select(a => new { a.DeptCode, a.DeptName, a.CmopanyCode, a.CompanyAbbr })
         };
         return(Json(res));
     }
 }
        public Return ProductDetail(BusinessType businessModel)
        {
            var resultReturn = new Return();

            try
            {
                var data = BusinessTypeService.GetByName(businessModel.BType);
                resultReturn.Content = data;
            }
            catch (Exception ex)
            {
                LogService.InsertLog(ex);
                resultReturn.SetWrong();
            }

            return(resultReturn);
        }
Example #5
0
        /// <summary>
        /// Ctor
        /// </summary>
        protected BaseController()
        {
            //CustomerService = Singleton<CustomerService>.Instance;
            //SmsService = Singleton<SmsService>.Instance;
            //AndroidService = Singleton<AndroidService>.Instance;
            //OrderService = Singleton<OrderService>.Instance;
            //OrderSearchService = Singleton<OrderSearchService>.Instance;
            //BusinessTypeService = Singleton<BusinessTypeService>.Instance;

            CustomerService     = new CustomerService();
            SmsService          = new SmsService();
            AndroidService      = new AndroidService();
            OrderService        = new OrderService();
            OrderSearchService  = new OrderSearchService();
            BusinessTypeService = new BusinessTypeService();
            BabyNameService     = new BabyNameService();
            MasterNameService   = new MasterNameService();
        }
Example #6
0
 public ActionResult GetBaseInfo()
 {
     //测试用Session
     Session["UserName"] = "******";
     Session["UserCode"] = "HR1406";
     Session["Power"]    = "LH6220,BM0067";
     if (Session["Power"] == null || Session["UserCode"] == null)
     {
         return(null);
     }
     else
     {
         string UserCode = Session["UserCode"].ToString();                                     //员工编号
         string Power    = Session["Power"].ToString();                                        //权限字符串
         var    list     = WarehouseService.LoadEntities(a => Power.Contains(a.DepartmentId)); //仓库 货位
         var    list1    = GoodItemService.LoadEntities(a => Power.Contains(a.DepartmentId));  //物料档案
         var    temp     = UserFrameworkService.LoadEntities(u => Power.Contains(u.DeptCode));
         var    list2    = (from a in temp
                            select new
         {
             a.UserCode,
             a.UserName
         }).Distinct();                                                                      //人员信息
         var list3 = LoadGoodsTypeService.LoadEntities(a => Power.Contains(a.DepartmentId)); //装卸类型
         var list4 = BusinessTypeService.LoadEntities(a => Power.Contains(a.DepartmentId));  //业务类型
         var list5 = InOutTypeService.LoadEntities(a => Power.Contains(a.DepartmentId));     //出入库类别
         var list6 = UserFrameworkService.LoadEntities(u => u.UserCode == UserCode);         //公司部门信息
         var res   = new
         {
             Warehouse     = list.Select(a => new { a.Id, a.Name, a.Department, a.Location }),
             GoodItem      = list1.Select(a => new { a.ItemCode, a.ItemLine, a.ItemName, a.ItemSpecifications, a.ItemUnit, a.UnitWeight }),
             UserFramework = list2.Select(a => new { a.UserCode, a.UserName }),
             LoadGoodsType = list3.Select(a => a.Name),
             BusinessType  = list4.Select(a => a.Name),
             InOutType     = list5.Select(a => a.Name),
             Departent     = list6.Select(a => new { a.DeptCode, a.DeptName, a.CmopanyCode, a.CompanyAbbr })
         };
         return(Json(res));
     }
 }
 protected BusinessTypeServiceTestsBase()
 {
     MockHttpProvider = new Mock <IHttpProvider>();
     HttpService      = new HttpService(MockHttpProvider.Object);
     Service          = new BusinessTypeService(HttpService);
 }