Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //我这在后台模拟数据库数据 你看下
            List<Produce> listp = new List<Produce>();

            for (int i = 0; i < 6; i++)
            {
                Produce p = new Produce();

                p.Id = i + 1;
                p.Pname = "厂家" + i + 1;
                p.Paddress = "厂家地址" + i;
                p.PPersong = "张三" + i;
                listp.Add(p);
            }

            List<Goods> listgoods = new List<Goods>();
            for (int i = 0; i < 6; i++)
            {
                Goods g = new Goods();
                g.goodsdecription = "ddd" + i;
                g.goodsnum = "goods" + i;
                g.goodsname = "goods" + i + "2";
                g.Id = i + 1;
                //g.goodsPId = listp.Single(p => p.Id == 3).Paddress;
                listgoods.Add(g);
            }
            GridView1.DataSource = listgoods;
            GridView1.DataBind();

            int u = 1;
        }
        public void WhenBuyGoodsWithSufficientAmount_AndDepositGreaterThanGoodsPrice_ThenVendingMachineGiveBuyerRefunds(
            Wallet givenMachineWallet,
            Wallet givenBuyerWallet,
            IList<Goods> availableGoods,
            IReadOnlyCollection<Coin> depositedAmount,
            Goods buyedGoods,
            Wallet expectedMachineWallet,
            Wallet expectedBuyerWallet,
            IReadOnlyCollection<Coin> refund)
        {
            var vendingMachine = CreateMachine(givenMachineWallet, givenBuyerWallet, availableGoods);

            var @event = vendingMachine.BuyGoods(depositedAmount, buyedGoods.Identity);
            var updatedMachineWallet = @event.UpdatedMachineWallet
                .ShowCoins()
                .OrderBy(x => x.ParValue);
            var updatedBuyerWallet = @event.UpdatedBuyerWallet
                .ShowCoins()
                .OrderBy(x => x.ParValue);
            var buyerRefund = @event.Refunds;

            Assert.Equal(refund.OrderBy(x => x.ParValue), buyerRefund.OrderBy(x => x.ParValue));
            Assert.Equal(expectedMachineWallet.ShowCoins().OrderBy(x => x.ParValue), updatedMachineWallet);
            Assert.Equal(expectedBuyerWallet.ShowCoins().OrderBy(x => x.ParValue), updatedBuyerWallet);
        }
Пример #3
0
 public GoodsSalePriceVM(Goods goods)
 {
     this.SerialNumber = goods.SerialNumber;
     this.GoodsNumber = goods.GoodsNumber;
     this.GoodsName = goods.GoodsName;
     this.GoodsPrice = goods.GoodsPrice;
 }
Пример #4
0
        public void DeleteGoods(Goods goods)
        {
            if (goods == null)
                return;

            _context.Goodses.Remove(goods);
        }
Пример #5
0
 public void UpdateGoods(Goods goods)
 {
     Goods g = _context.Goodses.Find(goods.Id);
     try
     {
         if (g != null)
         {
             g.Name = goods.Name;
             g.Price = goods.Price;
             g.PriceIn = goods.PriceIn;
             g.Producer = goods.Producer;
             g.Provider = goods.Provider;
             g.Quantity = goods.Quantity;
             g.Discription = goods.Discription;
             g.Type = goods.Type;
             g.Orders = goods.Orders;
             _context.Entry(g).State = EntityState.Modified;
             _context.SaveChanges();
         }
     }
     catch (DbEntityValidationException dbEx)
     {
         foreach (var validationErrors in dbEx.EntityValidationErrors)
         {
             foreach (var validationError in validationErrors.ValidationErrors)
             {
                 Trace.TraceInformation("Property: {0} Error: {1}",
                     validationError.PropertyName,
                     validationError.ErrorMessage);
             }
         }
     }
 }
Пример #6
0
        public void AddGoods(Goods _tovar)
        {
            _cacheFile.EnterWriteLock();
            try
            {
                _tovarCount++;

                if (_tovarCount > _tovarMax)
                {
                    _fStreamSave.Close();
                    _currentFile++;
                    if (_currentFile > _filesMax - 1)
                        throw new OverflowException("Переполнение склада !!!!!");
                    _tovarCount = 1;
                    _listOfFilesCount++;
                    OpenFileStreamSave(_listOfFiles[_currentFile]);
                }

                _binFormat.Serialize(_fStreamSave, _tovar);
            }
            catch (Exception ex)
            {
                throw new Exception("Ошибка записи данных. " + ex.Message);
            }
            finally
            {
                _cacheFile.ExitWriteLock();
            }
        }
Пример #7
0
        private static void Main(string[] args)
        {
            RebateRuleFactory.Instance.Register("QuantityRebate", new QuantityRebateRule()
            {
                RebateAmt = 5.86m,
                Describion = "按照数量返利,每采购1个商品,供应商会给我们$5.86的返利"
            });
            RebateRuleFactory.Instance.Register("QuantityRegionRebate", new QuantityRegionRebateRule()
            {
                RebateAmt = 8.5m,
                MinQuantity = 100,
                Describion = "按照数量返利,当采购商品的数量大于等于100的时候才能够获取返利,并且每个返利$8.5"
            });
            RebateRuleFactory.Instance.Register("AmtRebate", new AmtRebateRule()
            {
                Percent = 0.105m,
                Describion = "按照金额返利,按照采购金额的10.5%返利"
            });
            RebateRuleFactory.Instance.Register("QuantityRebate", new AmtRegionRebateRule()
            {
                MinAmt = 200,
                Percent = 0.208m,
                Describion = "按照金额返利,当采购金额超过$200的时候才能够有返利,返利按照采购金额的20.8%收取"
            });

            var goods = new Goods()
            {
                Amt = 100,
                Quantity = 100
            };

            var key = "QuantityRebate";
            var result = RebateRuleFactory.Instance.Calculate(key, goods);
        }
Пример #8
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                //쇼핑 상품 직접 생성

                Goods book1 = new Goods("Head First C#", "한빛미디어", 32000);
                Goods book2 = new Goods("Effective C#", "한빛미디어", 22000);
                Goods book3 = new Goods("데이터베이스 관리와실습 C#", "한빛미디어", 25000);
                Goods book4 = new Goods("닷넬 프레임워크", "가메출판사", 20000);

                //세션에저장
                Session["Book1"] = book1;
                Session["Book2"] = book2;
                Session["Book3"] = book3;
                Session["Book4"] = book4;

                //장바구니 항목추가
                IstGoods.Items.Add(book1.Name);
                IstGoods.Items.Add(book2.Name);
                IstGoods.Items.Add(book3.Name);
                IstGoods.Items.Add(book4.Name);
            }
            IbISessonInfo.Text = "세션 ID : " + Session.SessionID;
            IbISessonInfo.Text += "<br /> 세션 내 객체 개수 : " + Session.Count.ToString();
            IbISessonInfo.Text += "<br />세션모드 :" + Session.Mode.ToString();
            IbISessonInfo.Text += "<br />쿠키사용 안함 : " + Session.IsCookieless.ToString();
            IbISessonInfo.Text += "<br />새 세션 :" + Session.IsCookieless.ToString();
            IbISessonInfo.Text += "<br/>세션 만료 기간 : " + Session.Timeout.ToString() + "분";
        }
        public GoodsShortageException(Goods goods, int expectedCount)
        {
            Contract.Requires(goods != null);
            Contract.Requires(expectedCount > goods.Count);

            Goods = goods;
            ExpectedCount = expectedCount;
        }
Пример #10
0
        public void InsertGoods(Goods goods)
        {
            if (goods == null)
                return;

            _context.Goodses.Add(goods);
            _context.SaveChanges();
        }
Пример #11
0
        public void RemoveGoods(Goods type, int count)
        {
            _goods[type] -= count;

            if (_goods[type] < 0)
            {
                throw new InvalidOperationException("Too many goods for remove");
            }
        }
Пример #12
0
        public int? SellGood(Goods good, IEnumerable<BuildingBase<TraderParameters>> buildings)
        {
            var price = SimulateSellGoods(good, buildings);
            if (price.HasValue)
            {
                _goodsToTrade.Add(good);
            }

            return price;
        }
Пример #13
0
        public static IEnumerable<Plantation> GeneratePlantations(int count, Goods type)
        {
            var result = new List<Plantation>();
            for (int i = 0; i < count; i++)
            {
                result.Add(new Plantation(type));
            }

            return result;
        }
Пример #14
0
 void Start()
 {
     Goods item1 = new Goods("Gold", 10, 100);
     Goods item2 = new Goods("Coal", 5, 70);
     Goods item3 = new Goods("Iron", 8, 45);
     Goods item4 = new Goods("Silver", 20, 80);
     items.Add(item1);
     items.Add(item2);
     items.Add(item3);
     items.Add(item4);
 }
Пример #15
0
        public void AddGoods_MoreThanTheMaximumAmount_QuantityDoesNotIncrease()     // При добавлении товара количество не должно привышать максимума
        {
            // Организация
            int myMaxGoods = 2;
            Storage myStorage = new Storage(myMaxGoods, "SkladTest");
            Goods myTovar;

            // Действие
            for (int i = 1; i < myMaxGoods + 2; i++)
                myStorage.AddGoods(myTovar = new Goods());

            // Утверждение
        }
Пример #16
0
        public bool CanSellGood(Goods good, bool permissionToSellTheSame)
        {
            if (FreeSpaces > 0)
            {
                if (!permissionToSellTheSame && _goodsToTrade.Any(x => x == good))
                {
                    return false;
                }

                return true;
            }

            return false;
        }
Пример #17
0
        public bool AddGoods(Goods g)
        {
            try
            {
                this.ObjectContext.EntitySet.AddObject(g);
                ObjectContext.SaveChanges();
                return true;
            }
            catch (System.Exception ex)
            {

            }
            return false;
        }
Пример #18
0
        public void GetGoods_GetTheGoods_TheResultingProductIsIndoors() // Получение товара товара
        {
            // Организация
            int myMaxGoods = 10;
            Storage myStorage = new Storage(myMaxGoods, "SkladTest");
            Goods expected = new Goods();

            // Действие
            myStorage.AddGoods(expected);

            // Утверждение
            Goods actual = myStorage.GetGoods();
            Assert.AreEqual(expected, actual, "Товар не получен!");
        }
Пример #19
0
        public void AddGoods_AddGoods_IncreasingTheNumberGoods() // При добавлении количество увеличивается на 1
        {
            // Организация
            int myMaxGoods = 10;
            Storage myStorage = new Storage(myMaxGoods, "SkladTest");
            Goods myTovar;
            int expected = myStorage.GetCount() + 1;

            // Действие
            myStorage.AddGoods(myTovar = new Goods());

            // Утверждение
            int actual = myStorage.GetCount();
            Assert.AreEqual(expected, actual, 0, "Количество товара не увеличивается!");
        }
        public void WhenBuyGoodsWithInsufficientAmount_AndGoodsAvailableInMachine_ThenVendingMachineShouldThrowInsufficientAmountException(
            Wallet givenMachineWallet,
            Wallet givenBuyerWallet,
            IList<Goods> availableGoods,
            IReadOnlyCollection<Coin> depositedAmount,
            Goods buyedGoods)
        {
            var vendingMachine = CreateMachine(givenMachineWallet, givenBuyerWallet, availableGoods);

            var ex = Assert.Throws<InsufficientAmountForBuyingGoodsException>(() => vendingMachine.BuyGoods(depositedAmount, buyedGoods.Identity));
            var depositedWallet = new Wallet(depositedAmount);

            Assert.True(ex.Goods.Equals(buyedGoods.Identity));
            Assert.True(ex.ActualFunds == depositedWallet.TotalFunds());
            Assert.True(ex.ExpectedFunds == buyedGoods.Price);
        }
Пример #21
0
        public int? SimulateSellGoods(Goods good, IEnumerable<BuildingBase<TraderParameters>> buildings)
        {
            var traderParameters = new TraderParameters();

            foreach (var building in buildings)
            {
                building.DoAction(ref traderParameters);
            }

            if (CanSellGood(good, traderParameters.PermissionToSellTheSame))
            {
                return GetDefaultGoodPrice(good) + traderParameters.AdditionalPrice;
            }

            return null;
        }
Пример #22
0
        public GoodsBuyedEvent(
            Wallet vendingMachineWallet, 
            Wallet buyerWallet, 
            Goods buyedGoods,
            IReadOnlyCollection<Coin> refunds)
        {
            Contract.Requires(vendingMachineWallet != null && vendingMachineWallet.ShowCoins().Any());
            Contract.Requires(buyerWallet != null);
            Contract.Requires(refunds != null);
            Contract.Requires(refunds.Count == 0 || refunds.Any() && buyerWallet.ShowCoins().Any());

            UpdatedMachineWallet = vendingMachineWallet;
            UpdatedBuyerWallet = buyerWallet;
            BuyedGoods = buyedGoods;
            Refunds = refunds;
        }
Пример #23
0
        public bool AddGoods(Goods type, int count)
        {
            if (count > FreeSpace)
            {
                return false;
            }

            if (_goodsType.HasValue && _goodsType.Value != type)
            {
                return false;
            }

            _goodsType = type;
            _usedSpace = count;

            return true;
        }
Пример #24
0
        public bool AddChangedToGoods(Goods g, Changed c)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    g.ChangedSet.Add(c);
                    g.Quantity = g.Quantity + c.Value;
                    this.ObjectContext.SaveChanges(SaveOptions.None);

                    scope.Complete();
                    this.ObjectContext.AcceptAllChanges();
                    return true;
                }
            }
            catch
            {

            }
            return false;
        }
Пример #25
0
        public void AddGoods(Goods tovar)
        {
            //_cacheFile.EnterWriteLock();
            //try
            //{
                if (myQueue.Count >= myMaxGoods)
                {
                    if (!_writeDisk)
                    {
                        _writeDisk = true;
                        WriteDiskStart();
                    }
                    AddDiskGoods(tovar);

                    //throw new OverflowException("Переполнение склада " + myNameStorage);
                }
                else
                    myQueue.Enqueue(tovar);
            //}
            //finally
            //{
            //    _cacheFile.ExitWriteLock();
            //}
        }
Пример #26
0
 public int Insert(Goods goods)
 {
     return(GoodsRepository.Insert(goods));
 }
Пример #27
0
        private void toolStripBtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                if (this.aisinoDataGrid1.get_SelectedRows().Count == 0)
                {
                    MessageManager.ShowMsgBox("INP-272502");
                }
                else if (this.aisinoDataGrid3.get_Rows().Count == 0)
                {
                    MessageManager.ShowMsgBox("INP-272506");
                }
                else if (MessageManager.ShowMsgBox("INP-272503") != DialogResult.Cancel)
                {
                    int    num2;
                    string str = "";
                    double num = 0.0;
                    for (num2 = 0; num2 < this.bill.ListGoods.Count; num2++)
                    {
                        int    num7;
                        Goods  goods = this.bill.ListGoods[num2];
                        double round = 0.0;
                        double num4  = 0.0;
                        if (goods.DJHXZ == 4)
                        {
                            continue;
                        }
                        if (this.bill.HYSY && (goods.SLV == 0.05))
                        {
                            round = SaleBillCtrl.GetRound((double)(((goods.JE / 0.95) * 0.05) - goods.SE), 2);
                            if (Math.Abs(round) > 0.06)
                            {
                                num7 = num2 + 1;
                                str  = "第" + num7.ToString() + "行,含税金额乘以税率减税额的绝对值大于0.06,不能进行折扣汇总";
                            }
                            else
                            {
                                if ((goods.DJ == 0.0) || (goods.SL == 0.0))
                                {
                                    goto Label_0544;
                                }
                                num4 = Math.Abs(SaleBillCtrl.GetRound((double)(((goods.DJ * goods.SL) - goods.JE) - goods.SE), 2));
                                if (goods.HSJBZ)
                                {
                                    if (num4 > 0.01)
                                    {
                                        num7 = num2 + 1;
                                        str  = "第" + num7.ToString() + "行,单价乘以数量不等于含税金额,不能进行折扣汇总";
                                        break;
                                    }
                                    goto Label_0544;
                                }
                                num7 = num2 + 1;
                                str  = "第" + num7.ToString() + "行,单价乘以数量不等于含税金额,不能进行折扣汇总";
                            }
                            break;
                        }
                        if (this.bill.JZ_50_15 && (goods.SLV == 0.015))
                        {
                            round = SaleBillCtrl.GetRound((double)(((goods.JE / 1.035) * 0.015) - goods.SE), 2);
                            if (Math.Abs(round) > 0.06)
                            {
                                num7 = num2 + 1;
                                str  = "第" + num7.ToString() + "行,金额与税率税额计算后误差的绝对值大于0.06,不能进行折扣汇总";
                                break;
                            }
                            if ((goods.DJ != 0.0) && (goods.SL != 0.0))
                            {
                                if (goods.HSJBZ)
                                {
                                    if (Math.Abs(SaleBillCtrl.GetRound((double)(((goods.DJ * goods.SL) - goods.JE) - goods.SE), 2)) > 0.01)
                                    {
                                        num7 = num2 + 1;
                                        str  = "第" + num7.ToString() + "行,单价乘以数量不等于含税金额,不能进行折扣汇总";
                                        break;
                                    }
                                }
                                else if (Math.Abs(SaleBillCtrl.GetRound((double)((goods.DJ * goods.SL) - goods.JE), 2)) > 0.01)
                                {
                                    num7 = num2 + 1;
                                    str  = "第" + num7.ToString() + "行,单价乘以数量不等于金额,不能进行折扣汇总";
                                    break;
                                }
                            }
                        }
                        else
                        {
                            round = SaleBillCtrl.GetRound((double)((goods.JE * goods.SLV) - goods.SE), 2);
                            if (Math.Abs(round) > 0.06)
                            {
                                num7 = num2 + 1;
                                str  = "第" + num7.ToString() + "行,金额乘以税率减税额的绝对值大于0.06,不能进行折扣汇总";
                                break;
                            }
                            if ((goods.DJ != 0.0) && (goods.SL != 0.0))
                            {
                                if (goods.HSJBZ)
                                {
                                    if (Math.Abs(SaleBillCtrl.GetRound((double)(((goods.DJ * goods.SL) - goods.JE) - goods.SE), 2)) > 0.01)
                                    {
                                        num7 = num2 + 1;
                                        str  = "第" + num7.ToString() + "行,单价乘以数量不等于含税金额,不能进行折扣汇总";
                                        break;
                                    }
                                }
                                else if (Math.Abs(SaleBillCtrl.GetRound((double)((goods.DJ * goods.SL) - goods.JE), 2)) > 0.01)
                                {
                                    str = "第" + ((num2 + 1)).ToString() + "行,单价乘以数量不等于金额,不能进行折扣汇总";
                                    break;
                                }
                            }
                        }
Label_0544:
                        num += round;
                    }
                    if (str.Length > 0)
                    {
                        MessageManager.ShowMsgBox(str);
                    }
                    else
                    {
                        if (Math.Abs(SaleBillCtrl.GetRound(num, 2)) > 1.27)
                        {
                            str = "单据税额误差累计值大于1.27,不能进行折扣汇总";
                        }
                        if (str.Length > 0)
                        {
                            MessageManager.ShowMsgBox(str);
                        }
                        else
                        {
                            string str2 = new SaleBillDAL().SaveCollectDiscountToRealTable(this.bill);
                            if (str2 == "0")
                            {
                                string dJMonth = this.comboBoxYF.SelectedItem.ToString();
                                string dJType  = this.comboBoxDJZL.SelectedValue.ToString();
                                string keyWord = this.GetKeyWord();
                                int    key     = this.GetKey();
                                this.aisinoDataGrid1.set_DataSource(this.hzBLL.QueryXSDJ(dJMonth, dJType, keyWord, this.hzBLL.Pagesize, this.hzBLL.CurrentPage, key));
                                this.SelectedBH = "NoExist";
                                this.aisinoDataGrid2.set_DataSource(this.hzBLL.QueryXSDJMX("NoExist", this.hzBLL.Pagesize, 1));
                                this.aisinoDataGrid3.set_DataSource(this.hzBLL.QueryXSDJMX("NoExist", this.hzBLL.Pagesize, 1));
                                int count = this.aisinoDataGrid2.get_Rows().Count;
                                for (num2 = 0; num2 < count; num2++)
                                {
                                    string str6 = this.aisinoDataGrid2.get_Rows()[num2].Cells["SLV"].Value.ToString();
                                    string str7 = this.aisinoDataGrid2.get_Rows()[num2].Cells["XH"].Value.ToString();
                                    if (((str6 != null) && (str6 != "")) && (str6 != "中外合作油气田"))
                                    {
                                        string str8 = this.billBL.ShowSLV(this.bill, str7, str6);
                                        if (str8 != "")
                                        {
                                            this.aisinoDataGrid2.get_Rows()[num2].Cells["SLV"].Value = str8;
                                        }
                                    }
                                }
                                MessageManager.ShowMsgBox("INP-272504");
                            }
                            else if (str2 == "NoBH")
                            {
                                MessageManager.ShowMsgBox("INP-272505");
                            }
                            else
                            {
                                MessageBoxHelper.Show(str2);
                            }
                        }
                    }
                }
            }
            catch (Exception exception)
            {
                HandleException.HandleError(exception);
            }
        }
Пример #28
0
 public Goods GetOneGood(int id)
 {
     return(Goods.FirstOrDefault(x => x.id == id));
 }
Пример #29
0
        public async Task <Goods> AddGoods(Goods goods)
        {
            var rep = _iocContainer.Get <BaseRepository <Goods> >();

            return(await rep.Add(goods));
        }
Пример #30
0
 public void AddGoods(IEnumerable <IGood> goods)
 {
     Goods.AddRange(goods);
 }
Пример #31
0
 public int Update(Goods goods)
 {
     return(Connector.Update <Goods>(goods));
 }
Пример #32
0
    private bool canBuy()
    {
        switch (costType)
        {
        case PrizeType.PRIZE_RMB:
            if (UserManager.Instance.self.getRMB() >= StringKit.toInt(totalMoney.text))
            {
                return(true);
            }
            break;

        case PrizeType.PRIZE_MONEY:
            if (UserManager.Instance.self.getMoney() >= StringKit.toInt(totalMoney.text))
            {
                return(true);
            }
            break;

        case PrizeType.PRIZE_CONTRIBUTION:
            if (GuildManagerment.Instance.getGuild().contributioning >= StringKit.toInt(totalMoney.text))
            {
                return(true);
            }
            break;

        case PrizeType.PRIZE_STARSOUL_DEBRIS:
            if (StarSoulManager.Instance.getDebrisNumber() >= StringKit.toInt(totalMoney.text))
            {
                return(true);
            }
            break;

        case  PrizeType.PRIZE_MERIT:
            return(UserManager.Instance.self.merit >= StringKit.toInt(totalMoney.text));

        case PrizeType.PRIZE_LEDDER_SCORE:
            return(LadderHegeMoneyManager.Instance.myPort >= StringKit.toInt(totalMoney.text));

            break;

        case PrizeType.PRIZE_PROP:
            Goods       goods = item as Goods;
            GoodsSample gs    = GoodsSampleManager.Instance.getGoodsSampleBySid(goods.sid);
            Prop        p     = StorageManagerment.Instance.getProp(gs.costToolSid);
            if (p == null)
            {
                return(false);
            }
            int propNum = p.getNum();
            return(propNum >= StringKit.toInt(totalMoney.text));

            break;

        default:
            return(false);

        case  PrizeType.PRIZE_STAR_SCORE:
            return(GoddessAstrolabeManagerment.Instance.getStarScore() >= StringKit.toInt(totalMoney.text));
        }
        return(false);
    }
Пример #33
0
        public bool UpdateingGoodsWithChanged(Goods g, Changed c)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {

                    c.Value = c.GoodsItemSet.Sum(x => x.Quantity);
                    c.SumCost = c.GoodsItemSet.Sum(p => (decimal)p.Quantity * c.PieceCost);
                    this.ObjectContext.SaveChanges();

                    g.Quantity = g.Quantity + c.Value;
                    this.ObjectContext.SaveChanges();

                    scope.Complete();
                    this.ObjectContext.AcceptAllChanges();
                    return true;
                }
            }
            catch
            {

            }
            return false;
        }
Пример #34
0
        public static void GenerateXmlFile(string idListString, string data)
        {
            List <string> idList = idListString.Split('-').ToList();
            var           output = "<?xml version=\"1.0\"?> \r\n" +
                                   "\t<SmartRoutes.Data SchemaVersion=\"3\"> \r\n" +
                                   "\t\t<Variants> \r\n" +
                                   "\t\t\t<Variant> \r\n" +
                                   "\t\t\t\t<OrderCategoryExchangeCode>1891378909</OrderCategoryExchangeCode> \r\n" +
                                   "\t\t\t\t<Date>" + Convert.ToDateTime(data).ToString("yyyy-MM-dd") +
                                   "T00:00:00+03:00</Date> \r\n" +
                                   "\t\t\t\t<N>1</N> \r\n" +
                                   "\t\t\t\t<DataReading>Historical</DataReading> \r\n" +

                                   "\t\t\t\t<Characteristics> \r\n" +
                                   "\t\t\t\t\t<Characteristic> \r\n" +
                                   "\t\t\t\t\t\t<ExchangeCode>12345678</ExchangeCode> \r\n" +
                                   "\t\t\t\t\t\t<Title>Оцен./Согл. + за доставку</Title> \r\n" +
                                   "\t\t\t\t\t\t<Type>Number</Type> \r\n" +
                                   "\t\t\t\t\t\t<Notes>стоимость груза + за доставку</Notes> \r\n" +
                                   "\t\t\t\t\t</Characteristic> \r\n" +
                                   "\t\t\t\t</Characteristics> \r\n" +

                                   "\t\t\t\t<Orders> \r\n";

            if (!String.IsNullOrEmpty(idListString))
            {
                foreach (var id in idList)
                {
                    var ticket = new Tickets {
                        ID = Convert.ToInt32(id)
                    };
                    ticket.GetById();
                    var address = String.Empty;
                    if (!String.IsNullOrEmpty(ticket.RecipientKorpus))
                    {
                        address = String.Format("Беларусь, {0} область, {2}, {3} {4}, {5}/{6}",
                                                CityHelper.CityIDToRegionName(ticket.CityID.ToString()),
                                                CityHelper.CityIDToDistrictName(ticket.CityID.ToString()),
                                                CityHelper.CityNameFilter(CityHelper.CityIDToCityNameWithotCustom(ticket.CityID.ToString())),
                                                ticket.RecipientStreetPrefix,
                                                ticket.RecipientStreet,
                                                ticket.RecipientStreetNumber,
                                                ticket.RecipientKorpus);
                    }
                    else
                    {
                        address = String.Format("Беларусь, {0} область, {2}, {3} {4}, {5}",
                                                CityHelper.CityIDToRegionName(ticket.CityID.ToString()),
                                                CityHelper.CityIDToDistrictName(ticket.CityID.ToString()),
                                                CityHelper.CityNameFilter(CityHelper.CityIDToCityNameWithotCustom(ticket.CityID.ToString())),
                                                ticket.RecipientStreetPrefix,
                                                ticket.RecipientStreet,
                                                ticket.RecipientStreetNumber);
                    }

                    var goodsObj = new Goods {
                        TicketFullSecureID = ticket.FullSecureID
                    };
                    var goodsDataSet = goodsObj.GetAllItems("ID", "ASC", "TicketFullSecureID");
                    var goodsString  =
                        goodsDataSet.Tables[0].Rows.Cast <DataRow>()
                        .Aggregate(String.Empty,
                                   (current, goods) => current + String.Format("{0} {1}; ", goods[2], goods[3]))
                        .Replace("&", "");

                    output += "\t\t\t\t\t<Order> \r\n" +
                              "\t\t\t\t\t\t<ExchangeCode>" + ticket.SecureID + "</ExchangeCode> \r\n" +
                              "\t\t\t\t\t\t<Title>" + goodsString + "</Title> \r\n" +
                              "\t\t\t\t\t\t<Phone>" + ticket.RecipientPhone + "</Phone> \r\n" +
                              "\t\t\t\t\t\t<Code>" + ticket.SecureID + "</Code> \r\n" +
                              "\t\t\t\t\t\t<LoadingAddress> \r\n" +
                              "\t\t\t\t\t\t\t<Location>Беларусь, Минск, Кальварийская улица, 4</Location> \r\n" +
                              "\t\t\t\t\t\t\t<Latitude>0.9408116799</Latitude> \r\n" +
                              "\t\t\t\t\t\t\t<Longitude>0.4806493073</Longitude> \r\n" +
                              "\t\t\t\t\t\t</LoadingAddress> \r\n" +
                              "\t\t\t\t\t\t<UnloadingAddress> \r\n" +
                              "\t\t\t\t\t\t\t<Location>" + address + "</Location> \r\n" +
                              "\t\t\t\t\t\t</UnloadingAddress> \r\n" +
                              //время у клиента в xml-формате "PT30M" означает "30 минут"
                              "\t\t\t\t\t\t<UnloadingDuration>" + "PT10M" + "</UnloadingDuration>" +
                              "\t\t\t\t\t\t<CargoProperties>\r\n" +
                              "\t\t\t\t\t\t\t<Property>\r\n" +
                              "\t\t\t\t\t\t\t\t<CharacteristicExchangeCode>12345678</CharacteristicExchangeCode>\r\n" +
                              "\t\t\t\t\t\t\t\t<Value>" +
                              MoneyMethods.MoneySeparator(MoneyMethods.AgreedAssessedDeliveryCosts(ticket.ID.ToString())) +
                              "</Value>\r\n" +
                              "\t\t\t\t\t\t\t</Property>\r\n" +
                              "\t\t\t\t\t\t</CargoProperties>\r\n" +

                              "\t\t\t\t\t</Order> \r\n";
                }
                output += "   \t\t\t\t</Orders> \r\n" +
                          "\t\t\t</Variant> \r\n" +
                          "\t\t</Variants> \r\n" +
                          "\t</SmartRoutes.Data>";
                File.WriteAllText(HttpContext.Current.Server.MapPath("~/SendData.xml"), output);
            }
        }
Пример #35
0
    void updateCoinIcon()
    {
        //-1无消耗
        if (costType < 0)          //|| costType == PrizeType.PRIZE_PVE) {
        {
            costIcon.gameObject.SetActive(false);
            totalMoney.gameObject.SetActive(false);
            costStr = "";
            return;
        }
        costIcon.gameObject.SetActive(true);
        switch (costType)
        {
        case PrizeType.PRIZE_RMB:
            costStr             = LanguageConfigManager.Instance.getLanguage("s0048");
            costIcon.spriteName = constResourcesPath.RMBIMAGE;
            break;

        case PrizeType.PRIZE_MONEY:
            costStr             = LanguageConfigManager.Instance.getLanguage("s0049");
            costIcon.spriteName = constResourcesPath.MONEYIMAGE;
            break;

        case PrizeType.PRIZE_CONTRIBUTION:
            costStr = LanguageConfigManager.Instance.getLanguage("Guild_57");
            costIcon.gameObject.SetActive(false);
            break;

        case PrizeType.PRIZE_MERIT:
            costStr             = LanguageConfigManager.Instance.getLanguage("Arena06");
            costIcon.spriteName = constResourcesPath.MERITIMAGE;
            break;

        case PrizeType.PRIZE_PROP:
            costIcon.gameObject.SetActive(false);
            totalMoney.gameObject.SetActive(false);
            if (item.GetType() == typeof(Prop))  //使用行动剂走这里
            {
                Prop prop = item as Prop;
                if (prop.getType() == PropType.PROP_TYPE_PVE)
                {
                    costStr = "";
                    break;
                }
            }
            Goods       goods = item as Goods;
            GoodsSample gs    = GoodsSampleManager.Instance.getGoodsSampleBySid(goods.sid);
            Prop        p     = PropManagerment.Instance.createProp(gs.costToolSid);
            if (p.getType() == PropType.PROP_GODSWAR_MONEY)
            {
                costIcon.gameObject.SetActive(true);
                totalMoney.gameObject.SetActive(true);
                costStr             = LanguageConfigManager.Instance.getLanguage("godsWar_129");
                costIcon.spriteName = constResourcesPath.GODSWARMONEY_IMAGE;
            }
            else if (p.getType() == PropType.PROP_HUIJI)
            {
                costIcon.gameObject.SetActive(true);
                totalMoney.gameObject.SetActive(true);
                costStr             = LanguageConfigManager.Instance.getLanguage("OneOnOneBoss_HuiJi");
                costIcon.spriteName = constResourcesPath.HUIJI_ICON;
            }
            else if (p.getType() == PropType.PROP_JUNGONG)
            {
                costIcon.gameObject.SetActive(true);
                totalMoney.gameObject.SetActive(true);
                costStr             = LanguageConfigManager.Instance.getLanguage("junGong");
                costIcon.spriteName = constResourcesPath.JUNGONG_ICON;
            }
            costStr = "" + p.getName();
            break;

        case PrizeType.PRIZE_STARSOUL_DEBRIS:
            costStr             = LanguageConfigManager.Instance.getLanguage("s0466");
            costIcon.spriteName = constResourcesPath.STARSOUL_DEBRIS;
            break;

        case PrizeType.PRIZE_LEDDER_SCORE:
            costStr             = LanguageConfigManager.Instance.getLanguage("laddermoney");
            costIcon.spriteName = constResourcesPath.LADDER_MONEY;
            break;

        case PrizeType.PRIZE_STAR_SCORE:
            costStr             = LanguageConfigManager.Instance.getLanguage("star_star");
            costIcon.spriteName = constResourcesPath.STAR_STAR;
            break;
        }
    }
Пример #36
0
 public static void printing(Goods cap)
 {
     Console.WriteLine(cap.ToString());
 }
Пример #37
0
        public string DeleteSeller(Goods goodInfo, Companies companyInfo, bool useLike)
        {
            //[1] 이너뷰 작성
            string goodsWhere   = string.Empty;
            string companyWhere = string.Empty;

            if (goodInfo != null)
            {
                IDictionary <string, string> goodDic = new Dictionary <string, string>();
                foreach (var prop in typeof(Goods).GetProperties())
                {
                    if (prop.Name.ToLower() == "item" || prop.Name == "RowCount" || prop.Name == "Page")
                    {
                        continue;
                    }
                    if (goodInfo[prop.Name] == null)
                    {
                        continue;
                    }
                    goodDic.Add(prop.Name, goodInfo[prop.Name].ToString());
                }
                goodsWhere = string.Format("select GoodPK as GoodIDX from Goods{0}", MakeWhereBlock(typeof(Goods), goodDic, useLike));
            }

            if (companyInfo != null)
            {
                IDictionary <string, string> comDic = new Dictionary <string, string>();
                foreach (var prop in typeof(Companies).GetProperties())
                {
                    if (prop.Name.ToLower() == "item" || prop.Name == "RowCount" || prop.Name == "Page")
                    {
                        continue;
                    }
                    if (companyInfo[prop.Name] == null || companyInfo[prop.Name].Replace(" ", "") == string.Empty)
                    {
                        continue;
                    }
                    comDic.Add(prop.Name, companyInfo[prop.Name].ToString());
                }
                companyWhere = string.Format("select CompanyPK as SellerIDX from Companies{0}", MakeWhereBlock(typeof(Companies), comDic, useLike));
            }

            //[2] 이너뷰 이용한 where정 작성
            StringBuilder sbWhere = new StringBuilder();

            if (goodsWhere != string.Empty)
            {
                sbWhere.Append(" where ");
                sbWhere.AppendFormat("GoodIDX in ({0})", goodsWhere);
                if (companyWhere != string.Empty)
                {
                    sbWhere.Append(" and ");
                }
            }
            if (companyWhere != string.Empty)
            {
                if (goodsWhere == string.Empty)
                {
                    sbWhere.Append(" where ");
                }
                sbWhere.AppendFormat("SellerIDX in ({0})", companyWhere);
            }

            //[3] 쿼리작성
            StringBuilder sbQuery = new StringBuilder();

            sbQuery.Append("Delete from GoodSeller");
            sbQuery.Append(sbWhere.ToString());
            return(sbQuery.ToString());
        }
Пример #38
0
 public void AddOneDetail(OrderDetails orderDetails)
 {
     Goods.Add(orderDetails);
 }
Пример #39
0
        public ActionResult Good(int id)
        {
            var good = Goods.GetGoodById(id).FirstOrDefault();

            return(View(good));
        }
Пример #40
0
 public int Update(Goods goods)
 {
     return(GoodsRepository.Update(goods));
 }
Пример #41
0
        public bool UpdateGoods(Goods g)
        {
            try
            {
                using (TransactionScope scope = new TransactionScope())
                {
                    this.ObjectContext.SaveChanges();
                    decimal sum = g.ChangedSet.Sum(x => x.Value);
                    g.Quantity = sum;
                    this.ObjectContext.SaveChanges();
                    scope.Complete();
                    this.ObjectContext.AcceptAllChanges();
                    return true;
                }
            }
            catch
            {

            }
            return false;
        }
Пример #42
0
 public void DoCraftsmanActionReceiveAdditionalGoods(Goods additionalGoods)
 {
     _playerStatus.Warehouse.AddGoods(additionalGoods, 1);
     _mainBoardController.Status.Warehouse.RemoveGoods(additionalGoods, 1);
 }
            internal static void Init()
            {
                SummomPriceRuleList = new Dictionary <string, SummomPriceRule>();
                成长值list             = new SortedList <double, double>();
                var info    = File.ReadAllLines(@"setting\默认价值.txt", Encoding.Default);
                var nowLine = 0;

                for (int i = 0; i < info.Length; i++)
                {
                    if (info[i].StartsWith("//"))
                    {
                        continue;
                    }
                    var ruleInfo = info[i];
                    if (info[i].IndexOf("//") > 0)
                    {
                        ruleInfo = ruleInfo.Substring(0, info[i].IndexOf("//"));
                    }

                    if (ruleInfo.Length > 0)
                    {
                        nowLine++;
                        switch (nowLine)
                        {
                        case 1:
                        {
                            Goods.SetTalentRule(ruleInfo);
                            Program.setting.LogInfo("SetTalentRule:" + ruleInfo, "设置选项");
                            break;
                        }

                        case 2:
                        {
                            Goods.SetAchievementRule(ruleInfo);
                            Program.setting.LogInfo("SetAchievementRule:" + ruleInfo, "设置选项");
                            break;
                        }

                        case 3:
                        {
                            Goods.SetRankRule(ruleInfo);
                            Program.setting.LogInfo("SetRankRule:" + ruleInfo, "设置选项");
                            break;
                        }

                        default:
                        {
                            ruleInfo = info[i].Replace(',', ',').Split(new string[] { "//" }, StringSplitOptions.None)[0];
                            Program.setting.LogInfo("SummonRule:" + ruleInfo, "设置选项");
                            var rules = ruleInfo.Split('\\');
                            var names = rules[0].Split(',');
                            foreach (var name in names)
                            {
                                new SummomPriceRule(name, rules);
                            }
                            break;
                        }
                        }
                    }
                }
                return;                //TODO 用于激活static
            }
Пример #44
0
 public bool UpdateGoodsInfo(Goods goods)
 {
     return(dal.UpdateGoodsInfo(goods));
 }
Пример #45
0
 public bool AddGoods(Goods model)
 {
     throw new NotImplementedException();
 }
Пример #46
0
 public GoodsSet(Goods goods, long count, Coupon coupon) : this(goods, count)
 {
     EnteredCoupon = coupon;
 }
Пример #47
0
        public static List <int> GetGoodsOriginPrice(Goods goods)
        {
            ShopGoodsMetaData shopGoodsMetaDataByKey = ShopGoodsMetaDataReader.GetShopGoodsMetaDataByKey((int)goods.get_goods_id());
            List <int>        list = new List <int>();

            if (shopGoodsMetaDataByKey.HCoinCost > 0)
            {
                list.Add(shopGoodsMetaDataByKey.HCoinCost);
            }
            if (shopGoodsMetaDataByKey.SCoinCost > 0)
            {
                list.Add(shopGoodsMetaDataByKey.SCoinCost);
            }
            if (shopGoodsMetaDataByKey.CostItemId > 0)
            {
                list.Add(shopGoodsMetaDataByKey.CostItemNum);
            }
            if (shopGoodsMetaDataByKey.CostItemId2 > 0)
            {
                list.Add(shopGoodsMetaDataByKey.CostItemNum2);
            }
            if (shopGoodsMetaDataByKey.CostItemId3 > 0)
            {
                list.Add(shopGoodsMetaDataByKey.CostItemNum3);
            }
            if (shopGoodsMetaDataByKey.CostItemId4 > 0)
            {
                list.Add(shopGoodsMetaDataByKey.CostItemNum4);
            }
            if (shopGoodsMetaDataByKey.CostItemId5 > 0)
            {
                list.Add(shopGoodsMetaDataByKey.CostItemNum5);
            }
            float num      = 1f;
            int   buyTimes = ((int)goods.get_buy_times()) + 1;
            ShopGoodsPriceRateMetaData shopGoodsPriceRateMetaDataByKey = ShopGoodsPriceRateMetaDataReader.GetShopGoodsPriceRateMetaDataByKey(buyTimes);

            if (shopGoodsMetaDataByKey.PriceRateID == 1)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType1;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 2)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType2;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 3)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType3;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 4)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType4;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 5)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType5;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 6)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType6;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 7)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType7;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 8)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType8;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 9)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType9;
            }
            else if (shopGoodsMetaDataByKey.PriceRateID == 10)
            {
                num *= shopGoodsPriceRateMetaDataByKey.PriceType10;
            }
            num /= 100f;
            for (int i = 0; i < list.Count; i++)
            {
                list[i] = Mathf.FloorToInt(((float)list[i]) * num);
            }
            return(list);
        }
Пример #48
0
        private void button1_Click(object sender, EventArgs e)
        {
            Goods goods1, goods2, goods3;
            int   orderid = 0;

            Order order = new Order();

            if (!textBox4.Text.Equals(""))
            {
                m++;
                Customer customer = new Customer();
                customer.CustomerName = textBox4.Text;
                customer.CustomerId   = m;
                order.OrderID         = Convert.ToString(m);
                order.Customer        = customer;
            }
            else
            {
                MessageBox.Show("请输入客户名!");
                return;
            }
            if (checkBox1.Checked && textBox1.Text != "")
            {
                goods1 = new Goods(1, "苹果", 6.99);
                OrderDetail orderDetail = new OrderDetail(goods1, Convert.ToUInt32(textBox1.Text));
                orderid++;
                orderDetail.OrderDetailID = Convert.ToString(orderid);
                order.orderDetailsDict.Add(orderDetail);
            }
            if (checkBox2.Checked && textBox2.Text != "")
            {
                goods2 = new Goods(2, "鸡蛋", 3.00);
                OrderDetail orderDetail = new OrderDetail(goods2, Convert.ToUInt32(textBox2.Text));
                orderid++;
                orderDetail.OrderDetailID = Convert.ToString(orderid);
                order.orderDetailsDict.Add(orderDetail);
            }
            if (checkBox3.Checked && textBox3.Text != "")
            {
                goods3 = new Goods(3, "牛奶", 6.2);
                OrderDetail orderDetail = new OrderDetail(goods3, Convert.ToUInt32(textBox3.Text));
                orderid++;
                orderDetail.OrderDetailID = Convert.ToString(orderid);
                order.orderDetailsDict.Add(orderDetail);
            }

            if (!IsPhoneNumber(textBox5.Text))
            {
                MessageBox.Show("抱歉!请正确输入电话号码!");
                return;
            }
            else
            {
                order.Phone = textBox5.Text;
            }
            if (orderid == 0)
            {
                MessageBox.Show("不存在任何订单!");
                return;
            }
            else
            {
                MessageBox.Show("订单添加成功!");
            }

            order.OrderID = DateTime.Now.Year + "" + DateTime.Now.Month + "" + DateTime.Now.Day + m.ToString().PadLeft(3, '0');
            Form1.os.AddOrder(order);
            this.Close();
        }
Пример #49
0
        /// <summary>
        /// 获取分页列表
        /// </summary>
        /// <param name="pageIndex">页码</param>
        /// <param name="pageSize">分页大小</param>
        /// <param name="name">菜品名 - 搜索项</param>
        /// <param name="categoryId">分类id - 搜索项</param>
        /// <param name="createdTimeStart">发布日期起 - 搜索项</param>
        /// <param name="createdTimeEnd">发布日期止 - 搜索项</param>
        /// <returns></returns>
        public PageList <Domain.Mall.Recommend.RecommendModel> Get_RecommendPageList(int pageIndex, int pageSize, string name, int recommendCode)
        {
            using (DbRepository entities = new DbRepository())
            {
                var query = entities.Recommend.AsQueryable().Where(x => x.PersonId.Equals(Client.LoginUser.UNID));

                //活动名
                //实例化对象
                Goods    goodsItem    = null;
                Category categoryItem = null;
                Dictionary <string, Goods>    goodsDic    = new Dictionary <string, Goods>();
                Dictionary <string, Category> categoryDic = new Dictionary <string, Category>();

                //必须先选择活动类型
                if (recommendCode != 0)
                {
                    query = query.Where(x => x.RecommendCode == recommendCode);
                    //判断活动类型
                    if (recommendCode == (int)RecommendCode.HomeGoods)
                    {
                        //遍历活动名
                        var targetEntities = entities.Goods;
                        if (name.IsNotNullOrEmpty())
                        {
                            goodsDic = targetEntities.Where(x => x.Name.Contains(name)).ToDictionary(x => x.UNID);
                            var targetIdList = targetEntities.Where(x => x.Name.Contains(name)).Select(x => x.UNID).ToList();
                            query = query.Where(x => targetIdList.Contains(x.TargetID));
                        }
                        else
                        {
                            goodsDic = targetEntities.ToDictionary(x => x.UNID);
                        }
                    }
                    else if (recommendCode == (int)RecommendCode.HomeCategory)
                    {
                        //遍历活动名
                        var targetEntities = entities.Category;
                        if (name.IsNotNullOrEmpty())
                        {
                            categoryDic = targetEntities.Where(x => x.Name.Contains(name)).ToDictionary(x => x.UNID);
                            var targetIdList = targetEntities.Where(x => x.Name.Contains(name)).Select(x => x.UNID).ToList();
                            query = query.Where(x => targetIdList.Contains(x.TargetID));
                        }
                        else
                        {
                            categoryDic = targetEntities.ToDictionary(x => x.UNID);
                        }
                    }
                }
                else
                {
                    return(CreatePageList(new List <RecommendModel>(), 0, 0, 0));
                };


                var list  = new List <RecommendModel>();
                var count = query.Count();
                query.OrderBy(x => x.Sort).Skip((pageIndex - 1) * pageSize).Take(pageSize).ToList().ForEach(x =>
                {
                    if (x != null)
                    {
                        RecommendModel model = new RecommendModel();


                        model.UNID          = x.UNID;
                        model.TargetCode    = EnumHelper.GetEnumDescription((TargetCode)x.TargetCode);
                        model.RecommendCode = x.RecommendCode;
                        model.CreatedTime   = x.CreatedTime;
                        model.Sort          = x.Sort;
                        model.Title         = x.Title;

                        if (recommendCode == (int)RecommendCode.HomeGoods)
                        {
                            goodsDic.TryGetValue(x.TargetID, out goodsItem);
                            model.TargetName = goodsItem.Name;
                            model.TargetID   = goodsItem.UNID;
                        }
                        else if (recommendCode == (int)RecommendCode.HomeCategory)
                        {
                            categoryDic.TryGetValue(x.TargetID, out categoryItem);
                            model.TargetName = categoryItem.Name;
                            model.TargetID   = categoryItem.UNID;
                        }

                        list.Add(model);
                    }
                });

                return(CreatePageList(list, pageIndex, pageSize, count));
            }
        }
Пример #50
0
    /// <summary>
    /// 创建物品并将物品保存到存档中
    /// </summary>
    /// <param name="playerState"></param>
    /// <param name="goodsMetaInfoMations"></param>
    /// <param name="baseGoodsType"></param>
    /// <param name="minQuality"></param>
    /// <param name="maxQuality"></param>
    /// <param name="count"></param>
    /// <returns></returns>
    public static PlayGoods CreatePlayGoodsAddToPlayData(PlayerState playerState, GoodsMetaInfoMations goodsMetaInfoMations, EnumGoodsType baseGoodsType, EnumQualityType minQuality, EnumQualityType maxQuality, int count)
    {
        PlayGoods playGoods = new PlayGoods();
        Goods     addGoods  = goodsMetaInfoMations[baseGoodsType].Clone(true);//获取需要添加物品的原始属性

        //如果是道具或炼金物品则可以叠加,但是没有品质
        if (baseGoodsType > EnumGoodsType.Item && baseGoodsType < EnumGoodsType.SpecialItem)
        {
            int addGoodsID = playerState.PlayerAllGoods.Where(temp => temp.GoodsInfo.EnumGoodsType == baseGoodsType).Select(temp => temp.ID).FirstOrDefault();
            if (addGoodsID == 0)
            {
                addGoodsID            = NowTimeToID.GetNowID(DataCenter.Instance.GetEntity <GameRunnedState>());
                playGoods             = new PlayGoods(addGoodsID, addGoods, GoodsLocation.Package);
                playGoods.Count       = count;
                playGoods.QualityType = EnumQualityType.White;
                playerState.PlayerAllGoods.Add(playGoods);
            }
            else
            {
                playGoods.Count += count;
            }
        }
        else
        {
            int             addGoodsID  = NowTimeToID.GetNowID(DataCenter.Instance.GetEntity <GameRunnedState>());
            EnumQualityType qualityType = (EnumQualityType)UnityEngine.Random.Range((int)minQuality, (int)maxQuality + 1);
            float           minRate     = ((int)qualityType) * 0.2f + 0.8f;
            float           maxRate     = minRate + 0.2f;
            // 根据品质设置属性
            if (qualityType != EnumQualityType.Red)//如果是唯一的则不用改变属性
            {
                //将所有属性随机(根据品质)
                addGoods.goodsAbilities.ForEach(temp =>
                {
                    float min  = temp.Value * minRate;
                    float max  = temp.Value * maxRate;
                    temp.Value = (int)UnityEngine.Random.Range(min, max);
                });
                //取出用于分割固定属性以及随机属性的条目
                GoodsAbility goodsAbility_nothing = addGoods.goodsAbilities.FirstOrDefault(temp => temp.AbilibityKind == EnumGoodsAbility.Nothing);
                int          index = -1;
                if (goodsAbility_nothing != null)
                {
                    index = addGoods.goodsAbilities.IndexOf(goodsAbility_nothing);
                }
                //存在分割属性
                if (index > -1 && index + 1 < addGoods.goodsAbilities.Count)
                {
                    //取出分割项后的可变项
                    List <EnumGoodsAbility> randomAbilitys = Enumerable.Range(index + 1, addGoods.goodsAbilities.Count - index - 1).
                                                             Select(temp => addGoods.goodsAbilities[temp]).Select(temp => temp.AbilibityKind).ToList();
                    int saveAbilityCount = (int)qualityType;//可保留的属性
                    while (randomAbilitys.Count > saveAbilityCount)
                    {
                        int removeIndex = UnityEngine.Random.Range(0, randomAbilitys.Count);
                        EnumGoodsAbility removeGoodsAbility = randomAbilitys[removeIndex];
                        addGoods.goodsAbilities.RemoveAll(temp => temp.AbilibityKind == removeGoodsAbility);
                        randomAbilitys.RemoveAt(removeIndex);
                    }
                }
                addGoods.goodsAbilities.RemoveAll(temp => temp.AbilibityKind == EnumGoodsAbility.Nothing);
                playGoods             = new PlayGoods(addGoodsID, addGoods, GoodsLocation.Package);
                playGoods.QualityType = qualityType;
                playGoods.Count       = 1;
                playerState.PlayerAllGoods.Add(playGoods);
            }
        }
        return(playGoods);
    }
Пример #51
0
 public Admin_Index_xiugai(int good_id)
 {
     good = gm.FindByid(good_id);
     gc   = gcm.FindALLGoodCate();
 }
Пример #52
0
        private void button1_Click(object sender, EventArgs e)
        {
            Goods goods1 = null, goods2 = null, goods3 = null;

            m++;
            Order order = new Order();
            int   B     = 0;

            if (Form1.IsNumber(textBox2.Text) && textBox2.Text != null && checkBox1.Checked)
            {
                goods1 = new Goods("辣条");
                OrderDetails orderDetails = new OrderDetails(goods1, Convert.ToInt32(textBox2.Text));
                B++;
                orderDetails.DetailsNumber = B;
                order.MyOrder.Add(orderDetails);
            }
            if (Form1.IsNumber(textBox3.Text) && textBox2.Text != null && checkBox2.Checked)
            {
                goods2 = new Goods("快乐水");
                OrderDetails orderDetails = new OrderDetails(goods2, Convert.ToInt32(textBox3.Text));
                B++;
                orderDetails.DetailsNumber = B;
                order.MyOrder.Add(orderDetails);
            }
            if (Form1.IsNumber(textBox4.Text) && textBox2.Text != null && checkBox3.Checked)
            {
                goods3 = new Goods("七个小矮人");
                OrderDetails orderDetails = new OrderDetails(goods3, Convert.ToInt32(textBox4.Text));
                B++;
                orderDetails.DetailsNumber = B;
                order.MyOrder.Add(orderDetails);
            }
            if (!textBox1.Text.Equals(""))
            {
                order.Client = textBox1.Text;
            }
            else
            {
                MessageBox.Show("请输入客户名!");
                return;
            }
            //判断电话
            if (!IsPhoneNumber(phoneBox.Text))
            {
                MessageBox.Show("抱歉!请正确输入电话号码!");
                return;
            }

            if (B == 0)
            {
                MessageBox.Show("抱歉!您添加的订单数量为空!请检查您输入的数字!");
                return;
            }
            else
            {
                MessageBox.Show("添加成功!");
            }

            order.OrderId = DateTime.Now.Year + "" + DateTime.Now.Month + DateTime.Now.Day + m.ToString().PadLeft(3, '0');
            order.Sum();
            Form1.os.AddOrder(order);
            this.Close();
        }
Пример #53
0
        public bool DoTradeAction(Goods value, bool isHasPrivilage)
        {
            var param = new TraderParameters();

            var traderBuildings =
                _playerStatus.Board.Buildings.OfType<BuildingBase<TraderParameters>>()
                    .Where(x => x.IsActive)
                    .ToList();
            traderBuildings.ForEach(x => x.DoAction(ref param));

            if (_mainBoardController.Status.Market.CanSellGood(value, param.PermissionToSellTheSame))
            {
                var money = _mainBoardController.Status.Market.SellGood(value, traderBuildings);
                if (money.HasValue)
                {
                    _playerStatus.Warehouse.RemoveGoods(new[] {value});
                    _mainBoardController.Status.Doubloons -= money.Value;
                    _playerStatus.ReceiveDoubloons(money.Value);

                    return true;
                }
            }

            return false;
        }
Пример #54
0
 /// <summary>
 /// Добавление небоевого предмета войску
 /// </summary>
 /// <param name="builder"></param>
 /// <param name="building"></param>
 public BuildAction(Unit builder, Goods building)
 {
     this.builder      = builder;
     this.construction = building;
 }
Пример #55
0
        public bool CreateOrderInAndroid(string deskName, int peopleNum, Guid employeeId, string employeeNo, IList <OrderDetail> orderDetailList)
        {
            bool isSuccess = false;

            if (orderDetailList != null && orderDetailList.Count > 0)
            {
                _daoManager.BeginTransaction();
                try
                {
                    //日结号
                    string dailyStatementNo = _dailyStatementDao.GetCurrentDailyStatementNo();
                    if (!string.IsNullOrEmpty(dailyStatementNo))
                    {
                        decimal totalPrice = 0, actualPayMoney = 0, totalDiscount = 0;
                        foreach (var orderDetail in orderDetailList)
                        {
                            totalPrice     += orderDetail.SellPrice * orderDetail.GoodsQty;
                            actualPayMoney += orderDetail.SellPrice * orderDetail.GoodsQty - orderDetail.TotalDiscount;
                            totalDiscount  += orderDetail.TotalDiscount;
                        }
                        const string deviceNo = "AD";
                        //批量获取品项
                        List <Guid>   goodsIdList = orderDetailList.Select(orderDetail => orderDetail.GoodsId).ToList();
                        IList <Goods> goodsList   = _goodsDao.GetGoodsList(goodsIdList);
                        if (goodsList != null && goodsList.Count > 0)
                        {
                            //订单头部
                            Order order = new Order
                            {
                                OrderID          = Guid.NewGuid(),
                                TotalSellPrice   = totalPrice,
                                ActualSellPrice  = actualPayMoney,
                                DiscountPrice    = totalDiscount,
                                CutOffPrice      = 0,
                                ServiceFee       = 0,
                                DeviceNo         = deviceNo,
                                DeskName         = deskName,
                                EatType          = (int)EatWayType.DineIn,
                                Status           = 0,
                                PeopleNum        = peopleNum,
                                EmployeeID       = employeeId,
                                EmployeeNo       = employeeNo,
                                DailyStatementNo = dailyStatementNo
                            };
                            //分单号
                            Int32 curSubOrderNo = _orderDao.GetCurrentSubOrderNo(deskName);
                            if (curSubOrderNo > 0)
                            {
                                curSubOrderNo++;
                            }
                            else
                            {
                                curSubOrderNo = 1;
                            }
                            order.SubOrderNo = curSubOrderNo;
                            //流水号
                            order.TranSequence = _sysDictionary.GetCurrentTranSequence();
                            string orderNo = _orderDao.CreateOrder(order);
                            order.OrderNo = orderNo;
                            //菜单品项序号
                            IList <OrderDetails> orderDetailsList = new List <OrderDetails>();
                            int seqNumber = _orderDetailsDao.GetSequenceNum(order.OrderID);
                            foreach (OrderDetail item in orderDetailList)
                            {
                                Goods goods = goodsList.FirstOrDefault(g => g.GoodsID.Equals(item.GoodsId));
                                if (goods != null)
                                {
                                    OrderDetails orderDetails = new OrderDetails
                                    {
                                        OrderDetailsID    = Guid.NewGuid(),
                                        OrderID           = order.OrderID,
                                        DeviceNo          = deviceNo,
                                        TotalSellPrice    = item.SellPrice * item.GoodsQty,
                                        TotalDiscount     = item.TotalDiscount,
                                        ItemQty           = item.GoodsQty,
                                        EmployeeID        = employeeId,
                                        ItemType          = (int)OrderItemType.Goods,
                                        GoodsID           = item.GoodsId,
                                        GoodsNo           = goods.GoodsNo,
                                        GoodsName         = item.GoodsName,
                                        Unit              = goods.Unit,
                                        CanDiscount       = goods.CanDiscount,
                                        SellPrice         = item.SellPrice,
                                        PrintSolutionName = goods.PrintSolutionName,
                                        DepartID          = goods.DepartID,
                                        DailyStatementNo  = dailyStatementNo,
                                        OrderBy           = seqNumber
                                    };
                                    orderDetailsList.Add(orderDetails);
                                    _orderDetailsDao.CreateOrderDetails(orderDetails);
                                    seqNumber++;
                                    if (!string.IsNullOrEmpty(item.Remark))
                                    {
                                        //自定义口味
                                        orderDetails = new OrderDetails
                                        {
                                            OrderDetailsID    = Guid.NewGuid(),
                                            OrderID           = order.OrderID,
                                            DeviceNo          = deviceNo,
                                            TotalSellPrice    = 0,
                                            TotalDiscount     = 0,
                                            ItemLevel         = 1,
                                            ItemQty           = item.GoodsQty,
                                            EmployeeID        = employeeId,
                                            ItemType          = (int)OrderItemType.Details,
                                            GoodsID           = new Guid("77777777-7777-7777-7777-777777777777"),
                                            GoodsNo           = "7777",
                                            GoodsName         = item.Remark,
                                            Unit              = "",
                                            CanDiscount       = false,
                                            SellPrice         = 0,
                                            PrintSolutionName = goods.PrintSolutionName,
                                            DepartID          = goods.DepartID,
                                            DailyStatementNo  = dailyStatementNo,
                                            OrderBy           = seqNumber
                                        };
                                        orderDetailsList.Add(orderDetails);
                                        _orderDetailsDao.CreateOrderDetails(orderDetails);
                                        seqNumber++;
                                    }
                                }
                            }
                            //折扣信息
                            //if (salesOrder.orderDiscountList != null && salesOrder.orderDiscountList.Count > 0)
                            //{
                            //    foreach (OrderDiscount item in salesOrder.orderDiscountList)
                            //    {
                            //        item.DailyStatementNo = dailyStatementNo;
                            //        _orderDiscountDao.CreateOrderDiscount(item);
                            //    }
                            //}
                            SalesOrder salesOrder = new SalesOrder
                            {
                                order            = order,
                                orderDetailsList = orderDetailsList
                            };
                            //salesOrder.orderDiscountList = newOrderDiscountList;
                            //添加打印任务
                            SystemConfig systemConfig = _sysConfigDao.GetSystemConfigInfo();
                            if (systemConfig.IncludeKitchenPrint)
                            {
                                IList <PrintTask> printTaskList = PrintTaskService.GetInstance().GetPrintTaskList(salesOrder, systemConfig.PrintStyle, systemConfig.FollowStyle, systemConfig.PrintType, 1, string.Empty);
                                foreach (PrintTask printTask in printTaskList)
                                {
                                    _printTaskDao.InsertPrintTask(printTask);
                                }
                            }
                        }
                    }
                    _daoManager.CommitTransaction();
                    isSuccess = true;
                }
                catch (Exception exception)
                {
                    LogHelper.GetInstance().Error(string.Format("[CreateOrderInAndroid]参数:deskName_{0},peopleNum_{1},employeeId_{2},employeeNo_{3},orderDetailList_{4}", deskName, peopleNum, employeeId, employeeNo, JsonConvert.SerializeObject(orderDetailList)), exception);
                    isSuccess = false;
                    _daoManager.RollBackTransaction();
                }
            }
            return(isSuccess);
        }
Пример #56
0
 public GoodsViewModel()
 {
     CurrentGoods = new Goods();
     StationManager.CurrentGoods = CurrentGoods;
 }
Пример #57
0
        private void BuildGoods(Goods goods, ImGui gui)
        {
            BuildCommon(goods, gui);
            using (gui.EnterGroup(contentPadding))
                gui.BuildText("Middle mouse button to open Never Enough Items Explorer for this " + goods.type, wrap: true);
            if (goods.production.Length > 0)
            {
                BuildSubHeader(gui, "Made with");
                using (gui.EnterGroup(contentPadding))
                    BuildIconRow(gui, goods.production, 2);
            }

            if (goods.miscSources.Length > 0)
            {
                BuildSubHeader(gui, "Sources");
                using (gui.EnterGroup(contentPadding))
                    BuildIconRow(gui, goods.miscSources, 2);
            }

            if (goods.usages.Length > 0)
            {
                BuildSubHeader(gui, "Needs for");
                using (gui.EnterGroup(contentPadding))
                    BuildIconRow(gui, goods.usages, 4);
            }

            if (goods.fuelValue > 0f)
            {
                BuildSubHeader(gui, "Fuel value: " + DataUtils.FormatAmount(goods.fuelValue, UnitOfMeasure.Megajoule));
            }

            if (goods is Item item)
            {
                if (goods.fuelValue > 0f && item.fuelResult != null)
                {
                    using (gui.EnterGroup(contentPadding))
                        BuildItem(gui, item.fuelResult);
                }
                if (item.placeResult != null)
                {
                    BuildSubHeader(gui, "Place result");
                    using (gui.EnterGroup(contentPadding))
                        BuildItem(gui, item.placeResult);
                }

                if (item.module != null)
                {
                    BuildSubHeader(gui, "Module parameters");
                    using (gui.EnterGroup(contentPadding))
                    {
                        if (item.module.productivity != 0f)
                        {
                            gui.BuildText("Productivity: " + DataUtils.FormatAmount(item.module.productivity, UnitOfMeasure.Percent));
                        }
                        if (item.module.speed != 0f)
                        {
                            gui.BuildText("Speed: " + DataUtils.FormatAmount(item.module.speed, UnitOfMeasure.Percent));
                        }
                        if (item.module.consumption != 0f)
                        {
                            gui.BuildText("Consumption: " + DataUtils.FormatAmount(item.module.consumption, UnitOfMeasure.Percent));
                        }
                        if (item.module.pollution != 0f)
                        {
                            gui.BuildText("Pollution: " + DataUtils.FormatAmount(item.module.consumption, UnitOfMeasure.Percent));
                        }
                    }
                    if (item.module.limitation != null)
                    {
                        BuildSubHeader(gui, "Module limitation");
                        using (gui.EnterGroup(contentPadding))
                            BuildIconRow(gui, item.module.limitation, 2);
                    }
                }
            }
        }
Пример #58
0
        protected void subbtn_Click(object sender, EventArgs e)
        {
            Goods goods = new Goods();
            //获取表单数据
            string gName        = goodsName.Text.Trim();
            double gPrice       = Convert.ToDouble(shopPrice.Text.Trim());
            int    gStock       = Convert.ToInt32(goodsStock.Text.Trim());
            string gDescription = description.Text.Trim();
            string SavePath     = "";

            //判断缩略图是否是文件
            if (thumbnail.HasFile)
            {                                                          //是文件,需要上传,并且保存路径到数据库中
                //通过随机字符串,指定文件的名称
                string FileName = System.Guid.NewGuid().ToString("N"); //由纯数字和字母组成的随机字符串
                //获取文件的类型
                string FileType = thumbnail.PostedFile.ContentType;
                System.Diagnostics.Debug.Write("文件类型:::::" + FileType);     //.jpg image/jpeg   .png image/png
                //获取字符串中最后一个/的索引
                int index = FileType.LastIndexOf("/");
                //截取字符串,获取文件的后缀名
                string suffix = FileType.Substring(index + 1);

                //指定上传路径
                //获取当前项目的绝对路径
                string path = System.AppDomain.CurrentDomain.BaseDirectory.ToString();
                System.Diagnostics.Debug.WriteLine("path::" + path);
                string ImgPath = path + "/images/" + FileName + "." + suffix;
                //string ImgPath = Server.MapPath("../../images/" + FileName + "." + suffix);

                //指定数据库中的存储路径
                SavePath = "images/" + FileName + "." + suffix;

                System.Diagnostics.Debug.Write("上传路径:::::" + ImgPath);
                //上传
                thumbnail.SaveAs(ImgPath);

                thuMsg.Visible = true;
                thuMsg.Text    = "文件上传成功,文件上传路径是:" + ImgPath;
            }
            else   //不是文件
            {
                thuMsg.Visible = true;
                thuMsg.Text    = "请上传文件或图片";
            }
            //将所有数据封装到Goods中
            goods.GoodsName   = gName;
            goods.ShopPrice   = gPrice;
            goods.GoodsStock  = gStock;
            goods.Description = gDescription;
            goods.Thumbnail   = SavePath;

            //调用添加商品的方法
            int rows = gb.AddGoods(goods);

            //判断受影响的行数
            if (rows > 0) //添加成功
            {
                //返回到首页
                Response.Redirect("/Admin/Wares/SpList.aspx");
            }
            else
            { //添加不成功
                //重定向到商品添加页面
                Response.Redirect("/Admin/Wares/AddGoods.aspx");
            }
        }
Пример #59
0
        public ActionResult GoodList()
        {
            try
            {
                List<Goods> gs = new List<Goods>();
                long id = long.Parse(Request.QueryString["id"]);
                int CurrentPage = int.Parse(Request.QueryString["p"]);
                long 商品总数 = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                //if (商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过)) % 20 > 0)
                //{
                //    PageCount++;
                //}
                //IEnumerable<商品> goods = 商品管理.查询供应商商品(id, 20 * (CurrentPage - 1), 20, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过));
                long PageCount = 0;
                IEnumerable<商品> goods = null;
                var 主页展示模板 = 供应商服务记录管理.查询供应商服务记录(0, 0, Query<供应商服务记录>.Where(o => o.所属供应商.用户ID == id));
                if (主页展示模板.Count() > 0 && 主页展示模板.Any())
                {
                    var 主页展示模板开通 = 主页展示模板.First();
                    var 展示模板 = 主页展示模板开通.已开通的服务.Find(o => o.所申请项目名.Contains("企业主页商品展示") && o.结束时间 > DateTime.Now);
                    if (展示模板 != null)
                    {
                        if (展示模板.所申请项目名.Contains("A类"))
                        {
                            PageCount = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) / 20;
                            if (商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) % 20 > 0)
                            {
                                PageCount++;
                            }
                            ViewData["sum"] = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                            goods = 商品管理.查询供应商商品(id, 20 * (CurrentPage - 1), 20, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                        }
                        else if (展示模板.所申请项目名.Contains("B类"))
                        {
                            if (商品总数 > NUMBER_B)//如果该供应商的商品总数大于商品展示的窗口数
                            {
                                PageCount = NUMBER_B / 20;
                                ViewData["sum"] = NUMBER_B;
                            }
                            else
                            {
                                PageCount = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) / 20;
                                if (商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) % 20 > 0)
                                {
                                    PageCount++;
                                }
                                ViewData["sum"] = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                                ViewData["PageCount"] = PageCount;
                            }
                            goods = 商品管理.查询供应商商品(id, 20 * (CurrentPage - 1), 20, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                        }
                        else if (展示模板.所申请项目名.Contains("C类"))
                        {
                            if (商品总数 > NUMBER_C)
                            {
                                PageCount = NUMBER_C / 20;
                                ViewData["sum"] = NUMBER_C;
                            }
                            else
                            {
                                PageCount = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) / 20;
                                if (商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) % 20 > 0)
                                {
                                    PageCount++;
                                }
                                ViewData["sum"] = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                                ViewData["PageCount"] = PageCount;
                            }
                            goods = 商品管理.查询供应商商品(id, 20 * (CurrentPage - 1), 20, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                        }
                        else if (展示模板.所申请项目名.Contains("D类"))
                        {
                            if (商品总数 > NUMBER_D)
                            {
                                PageCount = NUMBER_D / 20;
                                ViewData["sum"] = NUMBER_D;
                            }
                            else
                            {
                                PageCount = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) / 20;
                                if (商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) % 20 > 0)
                                {
                                    PageCount++;
                                }
                                ViewData["sum"] = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                                ViewData["PageCount"] = PageCount;
                            }

                            goods = 商品管理.查询供应商商品(id, 20 * (CurrentPage - 1), 20, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                        }
                        else if (展示模板.所申请项目名.Contains("E类"))
                        {
                            if (商品总数 > NUMBER_E)
                            {
                                PageCount = NUMBER_E / 20;
                                ViewData["sum"] = NUMBER_E;
                            }
                            else
                            {
                                PageCount = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) / 20;
                                if (商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) % 20 > 0)
                                {
                                    PageCount++;
                                }
                                ViewData["sum"] = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                                ViewData["PageCount"] = PageCount;
                            }

                            goods = 商品管理.查询供应商商品(id, 20 * (CurrentPage - 1), 20, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                        }
                        else if (展示模板.所申请项目名.Contains("F类"))
                        {
                            if (商品总数 > NUMBER_F)
                            {
                                PageCount = NUMBER_F / 20;
                                ViewData["sum"] = NUMBER_F;
                            }
                            else
                            {
                                PageCount = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) / 20;
                                if (商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) % 20 > 0)
                                {
                                    PageCount++;
                                }
                                ViewData["sum"] = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                                ViewData["PageCount"] = PageCount;
                            }

                            goods = 商品管理.查询供应商商品(id, 20 * (CurrentPage - 1), 20, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                        }
                        else
                        {
                            if (商品总数 > NUMBER_G)
                            {
                                PageCount = NUMBER_G / 20;
                                ViewData["sum"] = NUMBER_G;
                            }
                            else
                            {
                                PageCount = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) / 20;
                                if (商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) % 20 > 0)
                                {
                                    PageCount++;
                                }
                                ViewData["sum"] = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                                ViewData["PageCount"] = PageCount;
                            }
                            goods = 商品管理.查询供应商商品(id, 20 * (CurrentPage - 1), 20, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                        }
                    }
                    else
                    {
                        if (商品总数 > NUMBER_G)
                        {
                            PageCount = NUMBER_G / 20;
                            ViewData["sum"] = NUMBER_G;
                        }
                        else
                        {
                            PageCount = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) / 20;
                            if (商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) % 20 > 0)
                            {
                                PageCount++;
                            }
                            ViewData["sum"] = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                            ViewData["PageCount"] = PageCount;
                        }
                        goods = 商品管理.查询供应商商品(id, 20 * (CurrentPage - 1), 20, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                    }
                }
                else
                {
                    if (商品总数 > NUMBER_G)
                    {
                        PageCount = NUMBER_G / 20;
                        ViewData["sum"] = NUMBER_G;
                    }
                    else
                    {
                        PageCount = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) / 20;
                        if (商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false) % 20 > 0)
                        {
                            PageCount++;
                        }
                        ViewData["sum"] = 商品管理.计数供应商商品(id, 0, 0, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                        ViewData["PageCount"] = PageCount;
                    }
                    goods = 商品管理.查询供应商商品(id, 20 * (CurrentPage - 1), 20, MongoDB.Driver.Builders.Query.EQ("审核数据.审核状态", 审核状态.审核通过), includeDisabled: false);
                }

                if (goods != null)
                {
                    foreach (var item in goods)
                    {
                        Goods g = new Goods();
                        g.Id = item.Id;
                        g.Price = string.Format("{0:0.00}", item.销售信息.价格);
                        g.Scan = item.销售信息.点击量;
                        g.name = item.商品信息.商品名;
                        if (item.商品信息.商品图片 != null && item.商品信息.商品图片.Count != 0)
                        {
                            g.Picture = item.商品信息.商品图片[0].Replace("original", "150X150");
                        }
                        else
                        {
                            g.Picture = "";
                        }
                        gs.Add(g);
                    }
                }
                JsonResult json = new JsonResult() { Data = new { Newgood = gs, Pcount = PageCount, Cpage = CurrentPage } };
                return Json(json, JsonRequestBehavior.AllowGet);
            }
            catch
            {
                JsonResult json = new JsonResult() { Data = new { Newgood = new List<Goods>(), Pcount = 1, Cpage = 1 } };
                return Json(json, JsonRequestBehavior.AllowGet);
            }
        }
Пример #60
0
    //最原始的初始化
    public void init(object obj, int numberMax, int numberMin, int numberNow, int numberSetp, int costType, CallBackMsg callback)
    {
        msg           = new MessageHandle();
        msg.msgInfo   = obj;
        item          = obj;
        this.callback = callback;
        setp          = numberSetp;
        max           = numberMax;
        min           = numberMin;
        now           = numberNow;
        coverDistanceToOne();
        this.costType = costType;
        updateCoinIcon();
        updateDisplayeNumber();
        calculateTotal();
        goodsTexture.gameObject.SetActive(false);
        goodsBg.gameObject.SetActive(false);
        GoodsView tmpGoodsView = CreateGoodsView();

        titleText.color      = Color.white;
        currentHaveNum.color = Color.white;
        if (obj.GetType() == typeof(Goods) || obj.GetType() == typeof(NoticeActiveGoods))
        {
            Goods good = item as Goods;
            tmpGoodsView.init(good.getGoodsType(), good.getGoodsSid(), good.getGoodsShowNum());
            titleText.text = (obj as Goods).getName();
            if (good.getGoodsType() == GoodsType.EQUIP)
            {
                currentHaveNum.text = LanguageConfigManager.Instance.getLanguage("pveUse09", StorageManagerment.Instance.getEquipsBySid(good.getGoodsSid()).Count.ToString());
            }
            else if (good.getGoodsType() == GoodsType.TOOL)
            {
                currentHaveNum.text = LanguageConfigManager.Instance.getLanguage("pveUse09", StorageManagerment.Instance.getProp(good.getGoodsSid()) == null ? "0" : StorageManagerment.Instance.getProp(good.getGoodsSid()).getNum().ToString());
            }
        }
        else if (obj.GetType() == typeof(Prop))
        {
            Prop prop = item as Prop;
            tmpGoodsView.init(prop);
            titleText.text = prop.getName();
        }
        else if (obj.GetType() == typeof(Exchange) || obj.GetType() == typeof(NewExchange))
        {
            ExchangeSample sample = (obj as Exchange).getExchangeSample();
            now = numberMax;
            tmpGoodsView.init(sample.type, sample.exchangeSid, sample.num);
            titleText.text = tmpGoodsView.showName;
        }
        else if (obj.GetType() == typeof(ArenaChallengePrice))
        {
            ArenaChallengePrice are = obj as ArenaChallengePrice;
            titleText.text = are.getName();
            ResourcesManager.Instance.LoadAssetBundleTexture(are.getIconPath(), goodsTexture);
            goodsTexture.gameObject.SetActive(true);
            goodsBg.gameObject.SetActive(true);
            tmpGoodsView.gameObject.SetActive(false);
        }
        else if (obj.GetType() == typeof(BuyStruct))
        {
            BuyStruct buyStruct = obj as BuyStruct;
            titleText.text = buyStruct.titleTextName;
            ResourcesManager.Instance.LoadAssetBundleTexture(buyStruct.iconId, goodsTexture);
            goodsTexture.gameObject.SetActive(true);
            if (buyStruct.goodsBgId != 0)
            {
                goodsBg.spriteName = QualityManagerment.qualityIDToIconSpriteName(buyStruct.goodsBgId);
            }
            goodsBg.gameObject.SetActive(true);
            tmpGoodsView.gameObject.SetActive(false);
        }
        else if (obj.GetType() == typeof(BossAttackTimeBuyStruct))
        {
            BossAttackTimeBuyStruct buyStruct = obj as BossAttackTimeBuyStruct;
            titleText.text       = buyStruct.descExtraGet;
            titleText.color      = Color.red;
            currentHaveNum.text  = buyStruct.descTime;
            currentHaveNum.color = Color.red;
            ResourcesManager.Instance.LoadAssetBundleTexture(buyStruct.iconId, goodsTexture);
            goodsTexture.gameObject.SetActive(true);
            if (buyStruct.goodsBgId != 0)
            {
                goodsBg.spriteName = QualityManagerment.qualityIDToIconSpriteName(buyStruct.goodsBgId);
            }
            goodsBg.gameObject.SetActive(true);
            tmpGoodsView.gameObject.SetActive(false);
        }
        else if (obj.GetType() == typeof(LaddersChallengePrice))
        {
            LaddersChallengePrice are = obj as LaddersChallengePrice;
            titleText.text = are.getName();
            ResourcesManager.Instance.LoadAssetBundleTexture(are.getIconPath(), goodsTexture);
            goodsTexture.gameObject.SetActive(true);
            goodsBg.gameObject.SetActive(true);
            tmpGoodsView.gameObject.SetActive(false);
        }
        else if (obj.GetType() == typeof(ActivityChapter))
        {
            ActivityChapter chapter = obj as ActivityChapter;
            ResourcesManager.Instance.LoadAssetBundleTexture(constResourcesPath.TIMES_ICONPATH, goodsTexture);
            goodsTexture.gameObject.SetActive(true);
            tmpGoodsView.gameObject.SetActive(false);
        }
    }