Beispiel #1
0
        public List<GoodsBaseInfoVM> GetGoodsBaseInfoList(int pageSize, int pageNumber,int allCount)
        {
            GoodsBaseInfo info = new GoodsBaseInfo();
            OQL q = new OQL(info);
            q.Select()
                .OrderBy (info.SerialNumber ,"asc");
            q.Limit(pageSize, pageNumber);
            q.PageWithAllRecordCount = allCount;

            return GetGoodsBaseInfoList(q);
        }
Beispiel #2
0
        public int GetAllGoodsBaseInfoCount()
        {
            GoodsBaseInfo info = new GoodsBaseInfo();
            OQL q = new OQL(info);
            q.Select()
                .Count(info.SerialNumber,"Count");

            GoodsBaseInfo infoCount = EntityQuery<GoodsBaseInfo>.QueryObject(q);
            return Convert.ToInt32(infoCount.PropertyList("Count"));
        }
Beispiel #3
0
 public List<GoodsBaseInfoVM> GetAllGoodsBaseInfo()
 {
     GoodsBaseInfo info = new GoodsBaseInfo();
     OQL q = OQL.From(info).Select().END;
     return GetGoodsBaseInfoList(q);
 }
Beispiel #4
0
 /// <summary>
 /// 修改商品信息
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public bool UpdateGoodsBaseInfo(GoodsBaseInfo info)
 {
     return EntityQuery<GoodsBaseInfo>.Instance.Update (info) > 0;
     
 }
Beispiel #5
0
 /// <summary>
 /// 保存商品信息
 /// </summary>
 /// <param name="info">商品信息</param>
 /// <returns></returns>
 /// <remarks>该方法会自动探测实体对象是新增的还是修改的,如果要求较快速度,请调用Insert或者Update方法</remarks>
 public bool SaveGoodsBaseInfo(GoodsBaseInfo info)
 {
     EntityQuery<GoodsBaseInfo> query = new EntityQuery<GoodsBaseInfo>(info);
     return query.SaveAllChanges()>0;
 }
Beispiel #6
0
        /// <summary>
        /// 获取商品销售价格信息
        /// </summary>
        /// <returns></returns>
        public IEnumerable<GoodsSaleInfoVM> GetGoodsSaleInfo()
        {
            GoodsBaseInfo bInfo = new GoodsBaseInfo();
            GoodsStock stock = new GoodsStock();
            OQL joinQ = OQL.From(bInfo)
                .Join(stock).On(bInfo.SerialNumber, stock.SerialNumber)
                .Select(bInfo.GoodsName, bInfo.Manufacturer, bInfo.SerialNumber, stock.GoodsPrice, stock.MakeOnDate, bInfo.CanUserMonth, stock.Stocks, stock.GoodsID)
                .OrderBy(bInfo.GoodsName, "asc")
                .END;

            PWMIS.DataProvider.Data.AdoHelper db = PWMIS.DataProvider.Adapter.MyDB.GetDBHelper();
            EntityContainer ec = new EntityContainer(joinQ, db);
            ec.Execute();
            var result = ec.Map<GoodsSaleInfoVM>(e =>
                {
                    e.GoodsName = ec.GetItemValue<string>(0); 
                    e.Manufacturer = ec.GetItemValue<string>(1);
                    e.SerialNumber  = ec.GetItemValue<string>(2);
                    e.GoodsPrice  = ec.GetItemValue<decimal>(3);
                    e.MakeOnDate = ec.GetItemValue<DateTime>(4);
                    e.CanUserMonth = ec.GetItemValue<int>(5);
                    e.Stocks = ec.GetItemValue<int>(6);
                    e.GoodsID = ec.GetItemValue<int>(7);
                    return e;
                }
            );
            return result;
        }
Beispiel #7
0
        private int GetOverDays(string serialNumber, int goodsID, out decimal goodsPrice, out int stockCount)
        {
            //计算距离过期时间
            GoodsBaseInfo bInfo = new GoodsBaseInfo();
            bInfo.SerialNumber = serialNumber;
            OQL q = OQL.From(bInfo)
                .Select(bInfo.CanUserMonth)
                .Where(bInfo.SerialNumber)
                .END;

            bInfo = EntityQuery<GoodsBaseInfo>.QueryObject(q);
            int canUseMonth = bInfo.CanUserMonth;

            GoodsStock stock = new GoodsStock();
            stock.GoodsID = goodsID;
            EntityQuery<GoodsStock>.Fill(stock);
            goodsPrice = stock.GoodsPrice;
            stockCount = stock.Stocks;
            //距离过期时间
            int overDays = canUseMonth *30 - DateTime.Now.Subtract(stock.MakeOnDate).Days;
            return overDays;
        }
Beispiel #8
0
 /// <summary>
 /// 增加商品信息
 /// </summary>
 /// <param name="info"></param>
 /// <returns></returns>
 public bool AddGoodsBaseInfo(GoodsBaseInfo info)
 {
    return  EntityQuery<GoodsBaseInfo>.Instance.Insert(info)>0;
 }
Beispiel #9
0
 /// <summary>
 /// 获取商品名称分组
 /// </summary>
 /// <returns></returns>
 public List<string>  GetAllGoodsNames()
 {
     GoodsBaseInfo info = new GoodsBaseInfo();
     OQL q = new OQL(info);
     q.Select(info.GoodsName)
         .GroupBy(info.GoodsName)
         .OrderBy(info.GoodsName, "asc");
     List<GoodsBaseInfo> list = EntityQuery<GoodsBaseInfo>.QueryList(q);
     var result = list.ConvertAll<string>(p => p.GoodsName);
     return result;
 }
Beispiel #10
0
 /// <summary>
 /// 获取指定商品名称下面的商品信息
 /// </summary>
 /// <param name="goodsName">商品名称</param>
 /// <returns></returns>
 public List<GoodsBaseInfoVM> GetGoodsBaseInfoWhithGoodsName(string goodsName)
 {
     GoodsBaseInfo info = new GoodsBaseInfo();
     info.GoodsName = goodsName;
     OQL q = new OQL(info);
     q.Select(info.SerialNumber, info.GoodsName, info.Manufacturer, info.CanUserMonth)
         .Where(info.GoodsName)
         .OrderBy(info.GoodsName, "asc");
     return GetGoodsBaseInfoList(q);
 }
Beispiel #11
0
 /// <summary>
 /// 根据商品名称为顺序获取所有商品基本信息
 /// </summary>
 /// <returns></returns>
 public List<GoodsBaseInfoVM> GetAllGoodsBaseInfoOrderByNames()
 {
     GoodsBaseInfo info = new GoodsBaseInfo();
     OQL q = new OQL(info);
     q.Select(info.SerialNumber,info.GoodsName,info.Manufacturer,info.CanUserMonth )
         .OrderBy(info.GoodsName, "asc");
     return GetGoodsBaseInfoList(q);
 }
Beispiel #12
0
 /// <summary>
 /// 获取一条商品信息
 /// </summary>
 /// <param name="sn">条码号</param>
 /// <returns></returns>
 public GoodsBaseInfo GetGoodsBaseInfo(string sn)
 {
     GoodsBaseInfo info = new GoodsBaseInfo() { SerialNumber = sn };
     EntityQuery<GoodsBaseInfo>.Fill(info);
     return info;
 }