Example #1
0
 public bool Alter(GoodInfo gd)
 {
     return(gddal.Update(gd) > 0);
 }
Example #2
0
 public static void OnGoodUsed( GoodInfo info )
 {
     if(goodUsedEvent!=null) goodUsedEvent(info);
 }
Example #3
0
 public List <GoodInfo> GetlistJQ(GoodInfo gd)
 {
     return(gddal.GetlistJQ(gd));
 }
Example #4
0
 public bool Add(GoodInfo gd)
 {
     return(gddal.Insert(gd) > 0);
 }
Example #5
0
 /// <summary>
 ///  新增
 /// </summary>
 public int Add(GoodInfo model, IDbTransaction transaction = null)
 {
     return(_GoodInfoRepository.Insert(model, transaction));
 }
Example #6
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(GoodInfo model, IDbTransaction transaction = null)
 {
     return(_GoodInfoRepository.Update(model, transaction));
 }
Example #7
0
    void PickUp(GameObject goods, List <GameObject> list)
    {
        //GoodInfo tempGoodInfo=goods.GetComponent<GoodInfo>();

        for (int k = 0; k < list.Count; k++)
        {
            if (TempGood.id == list[k].GetComponent <GoodInfo>().good.id)
            {
                list[k].GetComponent <GoodInfo>().AddNum(1);
                return;
            }
        }

        for (int i = 0; i < cells.Count; i++)
        {
            if (cells[i].transform.childCount > 0)
            {
                bool       cancreate = true;
                GoodInfo[] good      = new GoodInfo[cells[i].transform.childCount];
                //Debug.Log("count"+cells[i].transform.childCount);
                for (int k = 0; k < good.Length; k++)
                {
                    good[k] = cells[i].transform.GetChild(k).GetComponent <GoodInfo>();
                    //Debug.Log(good[k].good.id);
                }
                //cells[i].transform.GetComponentsInChildren<GoodInfo>();
                //if (good==null)
                //{
                //    continue;
                //}
                foreach (var go in good)
                {
                    if (go.good.type == TempGood.type)
                    {
                        cancreate = false;

                        if (go.good.id == TempGood.id)
                        {
                            go.AddNum(1);
                            return;
                        }
                    }
                }
                if (cancreate)
                {
                    GameObject tempGo = CreateGood(i);
                    list.Add(tempGo);

                    return;
                }
            }
            else
            {
                if (cells[i].transform.childCount == 0)
                {
                    //Debug.Log(i + "childCount=0");
                    GameObject tempGo = CreateGood(i);
                    list.Add(tempGo);
                    break;
                }
            }
        }
        //for (int i = 0; i < cells.Count; i++)
        //{
        //    if (cells[i].transform.childCount == 0)
        //    {

        //        Debug.Log(i+"childCount=0");
        //        GameObject tempGo = CreateGood(i);
        //        list.Add(tempGo);
        //        break;
        //    }
        //}
    }
Example #8
0
 public static void OnGoodDeactivated( GoodInfo info )
 {
     if(goodDeactivatedEvent!=null) goodDeactivatedEvent(info);
 }
Example #9
0
 public void Update(GoodInfo goodInfo)
 {
     goodInfoContext.Update(goodInfo);
 }
Example #10
0
        public List <GoodInfo> GetlistJQ(GoodInfo gd)
        {
            List <GoodInfo> list = new List <GoodInfo>();

            if (ID == null)
            {
                return(list);
            }
            List <SqlParameter> listp = new List <SqlParameter>();
            string sql    = "select * from GoodInfo" + ID + "";
            string dpname = FilterClass.DianPu1.UserName.Trim();

            if (!string.IsNullOrEmpty(gd.Gno))
            {
                //if (dpname == "admin")
                //{
                sql += " where Gno=@no";
                listp.Add(new SqlParameter("@no", gd.Gno.Trim()));
                //}
                //else
                //{
                //    sql += " where Gno=@no and DPName=@DPName";
                //    listp.Add(new SqlParameter("@no", gd.Gno.Trim()));
                //    listp.Add(new SqlParameter("@DPName", dpname));
                //}
            }
            if (!string.IsNullOrEmpty(gd.Gname))
            {
                //if (dpname == "admin")
                //{
                sql += " where Gname=@name";
                listp.Add(new SqlParameter("@name", gd.Gname.Trim()));
                //}
                //else
                //{
                //    sql += " where Gname=@name and DPName=@DPName";
                //    listp.Add(new SqlParameter("@name", gd.Gname.Trim()));
                //    listp.Add(new SqlParameter("@DPName", dpname));
                //}
            }
            DataSet   ds = SqlHelper.GetDataSet(sql, listp.ToArray());
            DataTable dt = ds.Tables[0];

            foreach (DataRow row in dt.Rows)
            {
                list.Add(
                    new GoodInfo()
                {
                    Gid     = Convert.ToInt32(row["Gid"]),
                    Gname   = row["Gname"].ToString(),
                    Gno     = row["Gno"].ToString(),
                    Gprice  = Convert.ToDecimal(row["Gprice"]),
                    Gremark = row["Gremark"].ToString(),
                    Gstock  = Convert.ToInt32(row["Gstock"]),
                    Gsum    = Convert.ToInt32(row["Gsum"]),
                    Gtype   = row["Gtype"].ToString(),
                    Gbid    = Convert.ToDecimal(row["Gbid"])
                }
                    );
            }
            return(list);
        }
Example #11
0
        /// <summary>
        /// 获取指定用户类型的价格
        /// </summary>
        /// <param name="x"></param>
        /// <param name="typeId"></param>
        /// <returns></returns>
        public decimal GetPriceOfUserType(GoodInfo x, int typeId, out string name)
        {
            decimal price = 0;

            name = x.GoodsTittle;
            switch (typeId)
            {
            case 1:
                price = x.BasePrice;
                break;

            case 2:
                price = x.PriceForA;
                if (!string.IsNullOrWhiteSpace(x.TitleForA))
                {
                    name = x.TitleForA;
                }
                break;

            case 3:
                price = x.PriceForB;
                if (!string.IsNullOrWhiteSpace(x.TitleForB))
                {
                    name = x.TitleForB;
                }
                break;

            case 4:
                price = x.PriceForC;
                if (!string.IsNullOrWhiteSpace(x.TitleForC))
                {
                    name = x.TitleForC;
                }
                break;

            case 5:
                price = x.PriceForD;
                if (!string.IsNullOrWhiteSpace(x.TittleForD))
                {
                    name = x.TittleForD;
                }

                break;

            case 6:
                price = x.PriceForLianSuo;
                if (!string.IsNullOrWhiteSpace(x.TittleForLianSuo))
                {
                    name = x.TittleForLianSuo;
                }
                break;

            case 7:
                price = x.PriceForE;
                if (!string.IsNullOrWhiteSpace(x.TitleForE))
                {
                    name = x.TitleForE;
                }
                break;

            case 8:
                price = x.PriceForF;
                if (!string.IsNullOrWhiteSpace(x.TitleForF))
                {
                    name = x.TitleForF;
                }
                break;

            case 9:
                price = x.PriceForG;
                if (!string.IsNullOrWhiteSpace(x.TitleForG))
                {
                    name = x.TitleForG;
                }
                break;

            case 10:
                price = x.PriceForH;
                if (!string.IsNullOrWhiteSpace(x.TitleForH))
                {
                    name = x.TitleForH;
                }
                break;

            case 11:
                price = x.PriceForI;
                if (!string.IsNullOrWhiteSpace(x.TitleForI))
                {
                    name = x.TitleForI;
                }
                break;
            }
            if (price == 0)
            {
                price = x.BasePrice;
            }

            return(price);
        }
Example #12
0
        public bool UpdateGoodsInfo(GoodInfo newInfo)
        {
            var obj = _context.GoodInfoes.FirstOrDefault(x => x.Id == newInfo.Id);

            if (obj == null)
            {
                _context.GoodInfoes.Add(newInfo);
            }
            else
            {
                obj.LastUpdateTime   = DateTime.Now;
                obj.GoodsNum         = newInfo.GoodsNum;
                obj.BarCode          = newInfo.BarCode;
                obj.MiddleCode       = newInfo.MiddleCode;
                obj.BoxCode          = newInfo.BoxCode;
                obj.SupplierId       = newInfo.SupplierId;
                obj.SupplierNum      = newInfo.SupplierNum;
                obj.SupplierName     = newInfo.SupplierName;
                obj.FirstTypeId      = newInfo.FirstTypeId;
                obj.FirstTypeName    = newInfo.FirstTypeName;
                obj.SecondTypeId     = newInfo.SecondTypeId;
                obj.SecondTypeName   = newInfo.SecondTypeName;
                obj.ThirdTYypeId     = newInfo.ThirdTYypeId;
                obj.ThirdTypeName    = newInfo.ThirdTypeName;
                obj.GoodsTittle      = newInfo.GoodsTittle;
                obj.GoodsSubTittle   = newInfo.GoodsSubTittle;
                obj.BrandId          = newInfo.BrandId;
                obj.BrandName        = newInfo.BrandName;
                obj.RetailtPrice     = newInfo.RetailtPrice;
                obj.MarketPrice      = newInfo.MarketPrice;
                obj.CostPrice        = newInfo.CostPrice;
                obj.Stock            = newInfo.Stock;
                obj.IsLockStork      = newInfo.IsLockStork;
                obj.BoxSpec          = newInfo.BoxSpec;
                obj.Spec             = newInfo.Spec;
                obj.Unit             = newInfo.Unit;
                obj.Weight           = newInfo.Weight;
                obj.Size             = newInfo.Size;
                obj.ShelfLife        = newInfo.ShelfLife;
                obj.MinCount         = newInfo.MinCount;
                obj.LimitCount       = newInfo.LimitCount;
                obj.BasePrice        = newInfo.BasePrice;
                obj.PriceForA        = newInfo.PriceForA;
                obj.PriceForB        = newInfo.PriceForB;
                obj.PriceForC        = newInfo.PriceForC;
                obj.PriceForD        = newInfo.PriceForD;
                obj.PriceForE        = newInfo.PriceForE;
                obj.PriceForF        = newInfo.PriceForF;
                obj.PriceForG        = newInfo.PriceForG;
                obj.PriceForH        = newInfo.PriceForH;
                obj.PriceForI        = newInfo.PriceForI;
                obj.PriceForLianSuo  = newInfo.PriceForLianSuo;
                obj.TitleForA        = newInfo.TitleForA;
                obj.TitleForB        = newInfo.TitleForB;
                obj.TitleForC        = newInfo.TitleForC;
                obj.TittleForD       = newInfo.TittleForD;
                obj.TitleForE        = newInfo.TitleForE;
                obj.TitleForF        = newInfo.TitleForF;
                obj.TitleForG        = newInfo.TitleForG;
                obj.TitleForH        = newInfo.TitleForH;
                obj.TitleForI        = newInfo.TitleForI;
                obj.TittleForLianSuo = newInfo.TittleForLianSuo;

                obj.pic1      = newInfo.pic1;
                obj.pic2      = newInfo.pic2;
                obj.pic3      = newInfo.pic3;
                obj.pic4      = newInfo.pic4;
                obj.pic5      = newInfo.pic5;
                obj.KeyWord   = newInfo.KeyWord;
                obj.Detail    = newInfo.Detail;
                obj.ErpId     = newInfo.ErpId;
                obj.SortId    = newInfo.SortId;
                obj.IsBoxSale = newInfo.IsBoxSale;
            }

            return(_context.SaveChanges() > 0);
        }
Example #13
0
 public bool SaveGoodsInfo(GoodInfo good)
 {
     _context.GoodInfoes.Add(good);
     return(_context.SaveChanges() > 0);
 }
        public async Task <ResultViewModel> GetPrice([FromBody] List <GetGoodPriceParams> getGoodPriceParamsList)
        {
            List <GoodPriceViewModel> goodPriceList = new List <ViewModel.GoodPriceViewModel>();

            foreach (var paramsItem in getGoodPriceParamsList)
            {
                if (string.IsNullOrEmpty(paramsItem.ShopId) || string.IsNullOrEmpty(paramsItem.GoodInfoId))
                {
                    break;
                }
                GoodInfoExtensionsDTO goodInfoExtensions = await goodInfoExtensionsBusiness.GetById(paramsItem.ShopId, paramsItem.GoodInfoId);

                if (goodInfoExtensions == null)
                {
                    break;
                }

                //如果没有规格,直接返回默认值
                if (goodInfoExtensions.SpecificationList == null || goodInfoExtensions.SpecificationList.Count <= 0)
                {
                    GoodInfo basicInfo = goodInfoBusiness.GetById(paramsItem.ShopId, paramsItem.GoodInfoId);
                    if (basicInfo == null)
                    {
                        break;
                    }
                    GoodPriceViewModel price = AutoMapperUtil.Singleton.Map <GoodPriceViewModel>(paramsItem);
                    price.Price = basicInfo.Price;
                    break;
                }

                GoodInfoSKU sku = await goodInfoSKUBusiness.GetSKUBySpecification(paramsItem.ShopId, paramsItem.GoodInfoId,
                                                                                  paramsItem.SpecificationValue1,
                                                                                  paramsItem.SpecificationValue2,
                                                                                  paramsItem.SpecificationValue3);


                if (sku != null)
                {
                    GoodPriceViewModel price = AutoMapperUtil.Singleton.Map <GoodPriceViewModel>(paramsItem);
                    price.Price = sku.Price;
                }
                else //如果没有SKU,直接返回默认值
                {
                    GoodInfo basicInfo = goodInfoBusiness.GetById(paramsItem.ShopId, paramsItem.GoodInfoId);
                    if (basicInfo == null)
                    {
                        break;
                    }
                    GoodPriceViewModel price = AutoMapperUtil.Singleton.Map <GoodPriceViewModel>(paramsItem);
                    price.Price = basicInfo.Price;
                    break;
                }
            }

            return(new ResultViewModel
            {
                Code = ResultCode.Success,
                Message = ResultMessage.Success,
                Data = goodPriceList
            });
        }
Example #15
0
 public void Start()
 {
     _good = transform.parent.gameObject.GetComponent <GoodInfo>();
 }