public override void Activate(CreatureStates Creature, Raycast Raycast, Good.Times.State State)
    {
        base.Activate (Creature, Raycast, State);
        if (State == State.BeginningOfTurn)
        {
            RecordHeight(Creature,Raycast);
        }

        if (State == State.Jump)
        {
            if (Raycast.SearchForCreature(Creature.Front,Creature.Storey) &&
                Raycast.SearchForHeight(Creature.Front,true) &&
                Creature.Jump >= Raycast.TargetMultipleCreature.Count)
            {
                float x = Raycast.TargetCreature.transform.position.x;
                float y = Raycast.TargetCreature.transform.position.y;
                float AddHeight = Raycast.TargetMultipleCreature.Select(h => h.Height).Sum();
                Move(Creature,x,y + AddHeight);
                Creature.Storey = Raycast.TargetMultipleCreature.OrderByDescending(s => s.Storey).ToList()[0].Storey + 1;
            }
        }

        if (State == State.EndOfTurn)
        {
            RecordHeight(Creature,Raycast);
            Fall(Creature, Raycast);
        }
    }
Пример #2
0
        public ScrapDetail CreateScrapDetail(Scrap scrap, double rob, double price, Currency currency, Good good, GoodUnit unit, Tank tank)
        {
            var scrapDetail = new ScrapDetail(rob, price, currency, good, unit, tank, scrap,
                scrapDomainService, tankDomainService, currencyDomainService,
                goodDomainService, goodUnitDomainService);

            return scrapDetail;
        }
        public ActionResult Create(Goods_TypeModel good_typeModel)
        {
            if (Session["login_status"] != null)
            {
                int[] z = (int[])Session["function_id"];
                if (z.Contains(2))
                {
                    Good good = new Good();
                    Goods_Tariff goods_tariff = new Goods_Tariff();
                    if (ModelState.IsValid)
                    {
                        var is_exist = (from g in db.Goods
                                        join gtf in db.Goods_Tariff on g.goods_id equals gtf.goods_id
                                        where g.goods_name == good_typeModel.goods_name
                                        select g).Count();
                        if (is_exist > 0)
                        {
                            TempData["errorMessage"] = "This Entry Already Exist";
                        }
                        else
                        {
                            good.goods_type_id = good_typeModel.goods_type_id;
                            good.goods_code = good_typeModel.goods_code;
                            good.goods_name = good_typeModel.goods_name;
                            good.status_id = 1;
                            good.created_date = Convert.ToDateTime(DateTime.Now.ToString()).ToString("yyyy-MM-dd");
                            good.updated_date = Convert.ToDateTime(DateTime.Now.ToString()).ToString("yyyy-MM-dd");
                            db.Goods.Add(good);
                            db.SaveChanges();
                            goods_tariff.goods_id = good.goods_id;
                            goods_tariff.goods_tariff = good_typeModel.goods_tariff;
                            goods_tariff.currency_id = good_typeModel.currency_id;
                            goods_tariff.ispercentage = good_typeModel.ispercentage;
                            goods_tariff.unit_of_measure_id = good_typeModel.unit_of_measure_id;
                            goods_tariff.created_date = DateTime.Now;
                            goods_tariff.end_date = Convert.ToDateTime("9999-12-31");
                            db.Goods_Tariff.Add(goods_tariff);
                            db.SaveChanges();
                            db.Update_Levi_Entry();
                            db.Update_Levi();
                            TempData["errorMessage"] = "Goods Added Successfully";
                        }
                        return RedirectToAction("Index");
                    }
                    return RedirectToAction("Index");

                }
                else
                {
                    return RedirectToAction("../Home/Dashboard");
                }
            }
            else
            {
                return RedirectToAction("../Home");
            }
        }
Пример #4
0
        public static void ServiceLoad(this CustomVendingMachine vm)
        {
            Good g1 = new Good("Кексики");
            Good g2 = new Good("Печенье");
            Good g3 = new Good("Вафли");

            vm.LoadGoods(g1, 50, 4);
            vm.LoadGoods(g2, 10, 3);
            vm.LoadGoods(g3, 30, 10);
        }
 public decimal computeTax(Good good)
 {
     decimal tot = 0M;
     foreach (var salestax in _salestaxes)
     {
         if (salestax.IsAppliableTo(good.GoodCategories))
         {
             tot += computeSingleTax(good.Price, salestax.Rate);
         }
     }
     return tot;
 }
Пример #6
0
        public InvoiceItem(decimal quantity, decimal fee, Good good, GoodUnit goodUnit, decimal divisionPrice, string description)
        {
            Quantity = quantity;
            Fee = fee;
            Good = good;
            GoodId = good.Id;

            MeasuringUnit = goodUnit;
            MeasuringUnitId = goodUnit.Id;
            Description = description;
            DivisionPrice = divisionPrice;

            IsNotEmpty();
            IsHaveValidQuantity();
        }
        public void TestSales()
        {
            var cat1=new GoodCategory("cat1");
            var cat2=new GoodCategory("cat2");
            var cat3=new GoodCategory("cat3");
            var cat4=new GoodCategory("cat4");

            var listcat1=new List<GoodCategory>() {
                            new GoodCategory("cat2")
                        };

            var listcat12=new List<GoodCategory>() {
                        new GoodCategory("cat1"),
                        new GoodCategory("cat2")
                    };

            taxes= new System.Collections.Generic.List<SalesTax>( ) {
                    new SalesTax( "tax5",5,listcat1),
                    new SalesTax( "tax10",10,listcat12)
            };
            Good good = new Good("good1", 10M, cat1);
            Good good2 = new Good("good2", 13.11M, cat1);
            Good good3 = new Good("good3", 17.01M, cat2);
            SalesTaxManager salestaxmgr = new SalesTaxManager(taxes);
            /***
             *  total= 10 + rounttoupper0.05(10 * 10 /100) = 10 + rounttoupper0.5(1) =10 +1 =11
             * */
            Assert.AreEqual(1M, salestaxmgr.computeTax(good));

            Assert.AreEqual( 11M, salestaxmgr.computeTotal(good));
            /***
             *  total= 13.11 + rounttoupper0.05(13.11 * 10 /100)
             *       = 13.11 + rounttoupper0.05(1.311)
             *       = 13.11 + 1.35 = 14.46
             * */
            Assert.AreEqual(1.35M, salestaxmgr.computeTax(good2));

            Assert.AreEqual(14.46M ,salestaxmgr.computeTotal(good2) );

            /***
             *  total= 17.01 + rounttoupper0.05(17.01 * 10 /100) +rounttoupper0.05(17.01  * 5 /100)
             *       = 17.01  + rounttoupper0.05(1.701) + rounttoupper0.05(0.08505)
             *       = 17.01  + 1.75 + 0.9 =
             *       = 17.01 + 2.65 =  19.66
             * */
            Assert.AreEqual(2.65M, salestaxmgr.computeTax(good3));
            Assert.AreEqual( 19.66M ,salestaxmgr.computeTotal(good3));
        }
 public ActionResult Create(Goods_TypeModel good_typeModel)
 {
     Good good = new Good();
     Goods_Tariff goods_tariff = new Goods_Tariff();
     if (ModelState.IsValid)
     {
         var is_exist = (from g in db.Goods where g.goods_name == good_typeModel.goods_name select g).Count();
         if (is_exist > 0)
         {
             TempData["errorMessage"] = "This Goods Already Exist";
         }
         else
         {
             good.goods_type_id = good_typeModel.goods_type_id;
             good.goods_name = good_typeModel.goods_name;
             good.status_id = 1;
             good.created_date = Convert.ToDateTime(DateTime.Now.ToString()).ToString("yyyy-MM-dd");
             good.updated_date = Convert.ToDateTime(DateTime.Now.ToString()).ToString("yyyy-MM-dd");
             db.Goods.Add(good);
             db.SaveChanges();
             goods_tariff.goods_id = good.goods_id;
             goods_tariff.goods_tariff = good_typeModel.goods_tariff;
             goods_tariff.ispercentage = good_typeModel.ispercentage;
             goods_tariff.unit_of_measure_id = good_typeModel.unit_of_measure_id;
             goods_tariff.created_date = DateTime.Now;
             goods_tariff.end_date = Convert.ToDateTime("9999-12-31");
             db.Goods_Tariff.Add(goods_tariff);
             db.SaveChanges();
             db.Update_Levi_Entry();
             db.Update_Levi();
             TempData["errorMessage"] = "Goods Added Successfully";
         }
         return RedirectToAction("Index");
     }
     return RedirectToAction("Index");
 }
Пример #9
0
 public VoucherSeting(
     long id, long goodId,
     long companyId,
     List<Account>creditaccounts
     , List<Account> debitaccounts
     , int voucherDetailTypeId
     ,int voucherTypeId,
     List<SegmentType> creditsegmentTypes,
     List<SegmentType> debitsegmentTypes,
     string voucherMainRefDescription,
     string voucherDebitDescription,
     string voucherDebitRefDescription,
     string voucherCreditDescription,
     string voucherMainDescription,
     string voucherCeditRefDescription,
     Good good)
 {
     Id=id;
     GoodId = goodId;
     CompanyId = companyId;
     VoucherDetailTypeId = voucherDetailTypeId;
     VoucherTypeId = voucherTypeId;
     CreditAccounts = creditaccounts;
     DebitAccounts = debitaccounts;
     CreditSegmentTypes = creditsegmentTypes;
     DebitSegmentTypes = debitsegmentTypes;
     VoucherMainRefDescription=voucherMainRefDescription;
     VoucherDebitDescription = voucherDebitDescription;
     VoucherDebitRefDescription = voucherDebitRefDescription;
     VoucherCreditDescription = voucherCreditDescription;
     VoucherMainDescription = voucherMainDescription;
     VoucherCeditRefDescription = voucherCeditRefDescription;
     //Good = good;
     Good = new Good();
     Company=new Company();
 }
Пример #10
0
        public async Task <ActionResult> ShopBasket()
        {
            AppUser currUser = await UserManager.FindByNameAsync(User.Identity.Name);

            bool f = currUser != null ? true : false;

            HttpCookie     cookieReq      = Request.Cookies["ShoppingBasket"];
            ShoppingBasket shoppingBasket = new ShoppingBasket();

            List <Good> goods = new List <Good>();

            if (cookieReq == null)
            {
                HttpCookie cookie = new HttpCookie("ShoppingBasket")
                {
                    Expires = DateTime.Now.AddMonths(6)
                };
                Response.Cookies.Add(cookie);
            }
            else if (cookieReq != null && f && string.IsNullOrEmpty(currUser.GoodsInBasket))
            {
                currUser.GoodsInBasket = cookieReq["ShoppingBasket"];
                shoppingBasket         = ShoppingBasket.ReadFromCookie(cookieReq["ShoppingBasket"]);
                foreach (Good g in shoppingBasket.Goods)
                {
                    Good el = pcComponentsUnit.GetGoodsDependsOnCategory(g.Category).FirstOrDefault(e => e.ID == g.ID);
                    if (el != null)
                    {
                        goods.Add(el);
                    }
                }
                await UserManager.UpdateAsync(currUser);
            }
            else if (cookieReq != null && f && !string.IsNullOrEmpty(currUser.GoodsInBasket))
            {
                shoppingBasket = ShoppingBasket.ReadFromCookie(currUser.GoodsInBasket);
                cookieReq["ShoppingBasket"] = currUser.GoodsInBasket;
                Response.Cookies.Add(cookieReq);
                foreach (Good g in shoppingBasket.Goods)
                {
                    Good el = pcComponentsUnit.GetGoodsDependsOnCategory(g.Category).FirstOrDefault(e => e.ID == g.ID);
                    if (el != null)
                    {
                        goods.Add(el);
                    }
                }
            }
            else
            {
                shoppingBasket = ShoppingBasket.ReadFromCookie(cookieReq["ShoppingBasket"]);
                foreach (Good g in shoppingBasket.Goods)
                {
                    Good el = pcComponentsUnit.GetGoodsDependsOnCategory(g.Category).FirstOrDefault(e => e.ID == g.ID);
                    if (el != null)
                    {
                        goods.Add(el);
                    }
                }
            }
            return(View(goods));
        }
        public AddItemsToCartWindow(Good addedItemsToCartGoods)
        {
            InitializeComponent();

            tempAddedItemsToCartGoods = addedItemsToCartGoods;
        }
Пример #12
0
        private void btnAddGood_Click(object sender, EventArgs e)
        {
            _SelectedPackingsIDList =
                _SelectedIDList     =
                    null;
            int  nGoodID   = 0;
            bool nFound    = false;
            Good oGoodTemp = new Good();

            if (StartForm(new frmSelectOnePacking(this, true)) != DialogResult.Yes)
            {
                _SelectedPackingsIDList = null;
                return;
            }
            else
            {
                if (_SelectedPackingsIDList == null || !_SelectedPackingsIDList.Contains(","))
                {
                    return;
                }
                oGoodTemp.PackingsIDList = "," + _SelectedPackingsIDList;
                oGoodTemp.FillData();
                if (oGoodTemp.ErrorNumber != 0 || oGoodTemp.MainTable == null || oGoodTemp.MainTable.Rows.Count == 0)
                {
                    return;
                }
            }
            RFMCursorWait.Set(true);
            foreach (DataRow rg in oGoodTemp.MainTable.Rows)
            {
                // нет ли уже такого товара?
                nGoodID = Convert.ToInt32(rg["GoodID"]);
                nFound  = false;

                foreach (DataRow drTemp in tGoodsCustoms.Rows)
                {
                    if (Convert.ToInt32(drTemp["GoodID"]) == nGoodID)
                    {
                        nFound = true;
                        if (oGoodTemp.MainTable.Rows.Count == 1)
                        {
                            RFMCursorWait.Set(false);
                            RFMMessage.MessageBoxError("Такой товар уже в списке...");
                            RFMCursorWait.Set(true);
                        }
                        break;
                    }
                }
                if (!nFound)
                {
                    // добавляем новую строку для выбранного товара
                    DataTable dtTemp = tGoodsCustoms.Clone();
                    dtTemp.Columns["GoodID"].AllowDBNull = true;
                    DataRow dr = dtTemp.Rows.Add();
                    dr["GoodID"]        = nGoodID;
                    dr["GoodName"]      = rg["GoodName"];
                    dr["GoodAlias"]     = rg["GoodAlias"];
                    dr["GoodBarCode"]   = rg["GoodBarCode"];
                    dr["Articul"]       = rg["Articul"];
                    dr["GoodGroupName"] = rg["GoodGroupName"];
                    dr["GoodBrandName"] = rg["GoodBrandName"];
                    dr["CountryName"]   = rg["CountryName"];
                    dr["Weighting"]     = rg["Weighting"];
                    dr["GoodActual"]    = rg["GoodActual"];
                    dr["Netto"]         = rg["Netto"];
                    dr["Brutto"]        = rg["Brutto"];
                    dr["Retention"]     = rg["Retention"];
                    dr["GoodERPCode"]   = rg["GoodERPCode"];

                    tGoodsCustoms.ImportRow(dr);
                }
            }
            // встать на последнюю добавленную строку
            if (nGoodID != 0)
            {
                dgvData.GridSource.Position = dgvData.GridSource.Find("GoodID", nGoodID);
                if (dgvData.GridSource.Position < 0)
                {
                    dgvData.GridSource.MoveFirst();
                }
            }
            RFMCursorWait.Set(false);
            btnDeleteGood.Enabled = (dgvData.Rows.Count > 0);
        }
Пример #13
0
 public void Add(Good entity)
 {
     entity.Date = DateTime.Now;
     db.Goods.Add(entity);
     db.SaveChanges();
 }
Пример #14
0
 public void Add(Good good)
 {
     Database.Add(good);
 }
Пример #15
0
    private void DrawDefaultPrice(Good good)
    {
        Rect position = new Rect(crdItemSpecialIcon);

        if (good.isSale)
        {
            TextureUtil.DrawTexture(position, iconSale, ScaleMode.StretchToFill);
            position.x += 20f;
        }
        if (good.isNew)
        {
            TextureUtil.DrawTexture(position, iconNew, ScaleMode.StretchToFill);
            position.x += 20f;
        }
        if (good.isHot)
        {
            TextureUtil.DrawTexture(position, iconHot, ScaleMode.StretchToFill);
            position.x += 20f;
        }
        Texture2D mark = TokenManager.Instance.currentToken.mark;

        if (selFilter == 0)
        {
            Rect position2 = new Rect(crdItemPriceIcon);
            if (good.IsPointable)
            {
                TextureUtil.DrawTexture(position2, iconPoint, ScaleMode.StretchToFill);
                position2.x += (float)(mark.width + 2);
            }
            if (good.IsBrickPointable && BuildOption.Instance.Props.useBrickPoint)
            {
                TextureUtil.DrawTexture(position2, iconBrick, ScaleMode.StretchToFill);
                position2.x += (float)(mark.width + 2);
            }
            if (good.IsCashable)
            {
                TextureUtil.DrawTexture(position2, mark, ScaleMode.StretchToFill);
            }
        }
        else
        {
            switch (selFilter)
            {
            case 1:
                if (good.IsCashable)
                {
                    TextureUtil.DrawTexture(crdItemPriceIcon, mark, ScaleMode.StretchToFill);
                    LabelUtil.TextOut(crdItemPrice, good.GetDefaultTokenPrice(), "MiniLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.MiddleLeft);
                }
                break;

            case 2:
                if (good.IsPointable)
                {
                    TextureUtil.DrawTexture(crdItemPriceIcon, iconPoint, ScaleMode.StretchToFill);
                    LabelUtil.TextOut(crdItemPrice, good.GetDefaultPrice(), "MiniLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.MiddleLeft);
                }
                break;

            case 3:
                if (good.IsBrickPointable)
                {
                    TextureUtil.DrawTexture(crdItemPriceIcon, iconBrick, ScaleMode.StretchToFill);
                    LabelUtil.TextOut(crdItemPrice, good.GetDefaultBrickPrice(), "MiniLabel", GlobalVars.Instance.txtMainColor, GlobalVars.txtEmptyColor, TextAnchor.MiddleLeft);
                }
                break;
            }
        }
    }
Пример #16
0
 public void DeleteGoodInCell(Good good, Cell cell)
 {
     throw new System.NotImplementedException();
 }
 public void should_calculate_tax_for_imported_perfume()
 {
     var good = new Good(47.50, GoodType.Other, true);
     Assert.Equal(54.65, good.GetPrice(), _comparer);
 }
 public void should_calculate_tax_for_a_CD()
 {
     var cd = new Good(14.99, GoodType.Other);
     Assert.Equal(16.49, cd.GetPrice(), _comparer);
 }
        private void btnVeterinaryLicenceSelect_Click(object sender, EventArgs e)
        {
            // ранее введеные значения
            Good oGoodTemp = new Good();

            if (chkInList.Checked && tGoodsVeterinaries.Rows.Count > 0)
            {
                // только по списку
                string sGoodsList = "";
                foreach (DataRow g in tGoodsVeterinaries.Rows)
                {
                    sGoodsList += g["GoodID"].ToString() + ",";
                }
                oGoodTemp.FillTableGoodsVeterinariesMapping(null, null, sGoodsList);
            }
            else
            {
                oGoodTemp.FillTableGoodsVeterinariesMapping(null, null, null);
            }
            if (oGoodTemp.ErrorNumber != 0 || oGoodTemp.TableGoodsVeterinariesMapping == null)
            {
                return;
            }
            if (oGoodTemp.TableGoodsVeterinariesMapping.Rows.Count == 0)
            {
                RFMMessage.MessageBoxError("Нет данных о свидетельствах...");
                return;
            }

            // уникальные значения
            DataView  vGoodsVeterinariesMapping = new DataView(oGoodTemp.TableGoodsVeterinariesMapping);
            DataTable tTable1 = vGoodsVeterinariesMapping.ToTable(true,
                                                                  "VeterinaryLicence", "VeterinaryProducer", "VeterinaryName", "VeterinaryNote",
                                                                  "VeterinaryMark", "VeterinaryLaboratory", "VeterinaryDateOfProducing");
            DataTable tTable2 = CopyTable(tTable1, "tTable2", "1 = 2", "");

            tTable2.Columns.Add("ID", System.Type.GetType("System.Int32"));
            tTable2.Columns["ID"].AutoIncrement = true;
            tTable2.Merge(tTable1);

            DataTable tdLicence = CopyTable(tTable2, "tdLicence", "", "VeterinaryLicence");

            if (StartForm(new frmSelectID(this, tdLicence,
                                          "VeterinaryLicence, VeterinaryProducer, VeterinaryName, VeterinaryNote, " +
                                          "VeterinaryMark, VeterinaryLaboratory, VeterinaryDateOfProducing, VeterinaryDateBeg",
                                          "Сертификат №, Производитель, Наименование, Разрешение, " +
                                          "Маркировка, Лаборатория, Дата выработки, Дата нач.", false)) == DialogResult.Yes)
            {
                if (_SelectedID == null)
                {
                    return;
                }
                int nGoodVeterinaryID_Old = (int)_SelectedID;
                tdLicence.PrimaryKey = new DataColumn[] { tdLicence.Columns["ID"] };
                DataRow r = tdLicence.Rows.Find(nGoodVeterinaryID_Old);
                if (r != null)
                {
                    txtVeterinaryLicence.Text         = r["VeterinaryLicence"].ToString();
                    txtVeterinaryProducer.Text        = r["VeterinaryProducer"].ToString();
                    txtVeterinaryName.Text            = r["VeterinaryName"].ToString();
                    txtVeterinaryNote.Text            = r["VeterinaryNote"].ToString();
                    txtVeterinaryMark.Text            = r["VeterinaryMark"].ToString();
                    txtVeterinaryLaboratory.Text      = r["VeterinaryLaboratory"].ToString();
                    txtVeterinaryDateOfProducing.Text = r["VeterinaryDateOfProducing"].ToString();
                }
            }
            _SelectedID = null;

            return;
        }
Пример #20
0
 //---Metoda odtwórcza---
 public override void PrepareQuery(Good good)
 {
     this.Value = string.Format("SELECT * FROM Good WHERE Name = '{0}';", good.Name);
 }
Пример #21
0
        public OffhireDetail CreateOffhireDetail(decimal quantity, decimal feeInVoucherCurrency, decimal feeInMainCurrency, Good good, GoodUnit unit, Tank tank, Offhire offhire)
        {
            var offhireDetail = new OffhireDetail(
                quantity, feeInVoucherCurrency, feeInMainCurrency, good, unit, tank, offhire, offhireDomainService,
                tankDomainService, currencyDomainService, goodDomainService, goodUnitDomainService);

            return offhireDetail;
        }
Пример #22
0
 public GoodWithCount(Good good, int count) : base(good.Name, good.Price)
 {
     Count = count;
 }
 public void should_calculate_tax_for_a_cholocate()
 {
     var cholocate = new Good(0.85, GoodType.Food);
     Assert.Equal(0.85,cholocate.GetPrice(),_comparer);
 }
Пример #24
0
 public int CompareTo(Good rhs)
 {
     return GetType().ToString().CompareTo(rhs.GetType().ToString());
 }
        private void btnSave_Click(object sender, EventArgs e)
        {
            string sVeterinaryLicence = txtVeterinaryLicence.Text.Trim();
            string sVeterinaryName    = txtVeterinaryName.Text.Trim();

            // проверки
            if (sVeterinaryLicence.Length == 0)
            {
                RFMMessage.MessageBoxError("Не указан номер свидетельства...");
                txtVeterinaryLicence.Select();
                return;
            }

            if (dtpVeterinaryDateBeg.IsEmpty)
            {
                RFMMessage.MessageBoxError("Не указана дата начала действия свидетельства...");
                txtVeterinaryProducer.Select();
                return;
            }

            /*if (sExportXML.Length == 0)
             * {
             *  if (RFMMessage.MessageBoxYesNo("Не заполнены данные для экспорта...\n" +
             *      "Все-таки сохранить?") != DialogResult.Yes)
             *      return;
             * }*/

            if (grdData.Rows.Count == 0)
            {
                if (RFMMessage.MessageBoxYesNo("Не выбрано ни одного товара...\n" +
                                               "Все-таки сохранить?") != DialogResult.Yes)
                {
                    return;
                }
            }

            // уникальность номера
            RFMCursorWait.Set(true);

            Good oGoodTemp = new Good();

            oGoodTemp.FillTableGoodsVeterinaries(null, null);
            foreach (DataRow dr in oGoodTemp.TableGoodsVeterinaries.Rows)
            {
                if (dr["VeterinaryLicence"].ToString().Trim().ToUpper() == sVeterinaryLicence.ToUpper() &&
                    dr["VeterinaryName"].ToString().Trim().ToUpper() == sVeterinaryName.ToUpper() &&
                    (!nGoodVeterinaryID.HasValue || (int)nGoodVeterinaryID != (int)dr["ID"]))
                {
                    RFMCursorWait.Set(false);
                    RFMMessage.MessageBoxError("Такой номер свидетельства с таким же наименованием товара уже есть...");
                    txtVeterinaryLicence.Select();
                    return;
                }
            }
            RFMCursorWait.Set(false);

            // собственно сохранение
            oGood.ClearError();
            oGood.SaveGoodVeterinary(ref nGoodVeterinaryID, sVeterinaryLicence, txtVeterinaryProducer.Text.Trim(),
                                     txtVeterinaryName.Text.Trim(), txtVeterinaryNote.Text.Trim(),
                                     txtVeterinaryMark.Text.Trim(), txtVeterinaryLaboratory.Text.Trim(),
                                     txtVeterinaryDateOfProducing.Text.Trim(),
                                     dtpVeterinaryDateBeg.Value.Date, sExportXML,
                                     tGoodsVeterinaries);
            if (oGood.ErrorNumber == 0)
            {
                // код добавленной записи
                if (nGoodVeterinaryID.HasValue)
                {
                    MotherForm.GotParam = new object[] { (int)nGoodVeterinaryID };
                    DialogResult        = DialogResult.Yes;
                    Dispose();
                }
            }
        }
Пример #26
0
 public void B(Good o, EventArgs e)
 {
 }
Пример #27
0
 /// <summary>
 /// Изчиства данните за въведения продукт,което води и до визуалното изчистване на полетата
 /// </summary>
 private void ClearCode()
 {
     NewGood      = new Good();
     GoodSupplier = new Supplier();
     QRCode       = null;
 }
Пример #28
0
 public decimal computeTotal(Good good)
 {
     return good.Price + computeTax(good);
 }
Пример #29
0
        public IActionResult Edit(int Id)
        {
            Good oneGood = dbContext.Goods.FirstOrDefault(Good => Good.Id == Id);

            return(View("Edit", oneGood));
        }
 public void should_calculate_tax_for_imported_cholocate()
 {
     var good = new Good(10.00, GoodType.Food, true);
     Assert.Equal(10.50, good.GetPrice(), _comparer);
 }
Пример #31
0
 public string totalGoodToString(Good good)
 {
     return good.Description + " at " + (computeTotal(good)).ToString("F", CultureInfo.InvariantCulture);
 }
Пример #32
0
 public Material(int id, Good source, float density)
 {
     Id      = id;
     Density = density;
     Type    = source;
 }
Пример #33
0
 public bool Contains(Good good)
 {
     return(Goods.Contains(good));
 }
Пример #34
0
        public ActionResult Categories(string categoryName)
        {
            ViewBag.CategoryName = categoryName;

            List <Category> categories = new List <Category>(db.Categories.ToList());

            ViewBag.Categories = categories;
            List <Img> Imgs = new List <Img>(db.Imgs.ToList());

            ViewBag.Imgs = Imgs;
            List <CategoryGood> categoryGoods = new List <CategoryGood>(db.CategoryGoods.ToList());
            string sort = Request.Query["sort"];

            ViewBag.Sort = sort;
            string searchstr = Request.Query["searchstr"];

            ViewBag.Searchstr = searchstr;
            int page = Convert.ToInt32(Request.Query["page"]);

            ViewBag.Page = page;
            bool        isNext       = true;
            bool        isBack       = true;
            List <Good> goodsToCheck = new List <Good>(db.Goods);

            if (sort != null)
            {
                if (sort.Equals("lb"))
                {
                    goodsToCheck = goodsToCheck.OrderBy(s => s.Price).ToList();
                }
                else if (sort.Equals("bl"))
                {
                    goodsToCheck = goodsToCheck.OrderByDescending(s => s.Price).ToList();
                }
            }
            if (searchstr != null)
            {
                for (int i = 0; i < goodsToCheck.Count; i++)
                {
                    Good gn = goodsToCheck[i];
                    if (gn.Name.IndexOf(searchstr) < 0)
                    {
                        if ((Convert.ToString(gn.Good_Id)).IndexOf(searchstr) < 0)
                        {
                            goodsToCheck.Remove(gn);
                            i--;
                        }
                    }
                }
            }


            int categoryId = -1;

            if (categoryName != null)
            {
                Category ccc = categories.FirstOrDefault(s => s.Name == categoryName);
                if (ccc != null)
                {
                    categoryId = ccc.Category_Id;
                }
                else
                {
                    ViewBag.Goods  = new List <Good>();
                    ViewBag.IsNext = false;
                    ViewBag.IsBack = false;
                    return(View());
                }
                if (categoryName != null && categoryName.Length > 0)
                {
                    if (!categoryName.Equals("All"))
                    {
                        for (int i = 0; i < goodsToCheck.Count; i++)
                        {
                            Good gn = goodsToCheck[i];

                            if (gn.CategoryGoods == null || gn.CategoryGoods.FirstOrDefault(s => s.Category.Category_Id == categoryId) == null)
                            {
                                goodsToCheck.Remove(gn);
                                i--;
                            }
                        }
                    }
                }
            }



            List <Good> goodsToPaint = new List <Good>();

            if (1 > goodsToCheck.Count || page < 0)
            {
                goodsToCheck.Clear();
                isNext = false;
                isBack = false;
            }
            else
            {
                if (page * 12 >= goodsToCheck.Count)
                {
                    isNext = false;
                }
                if (page == 1)
                {
                    isBack = false;
                }

                int begin = (page - 1) * 12;
                int end   = isNext?page * 12:goodsToCheck.Count;
                while (begin < end)
                {
                    goodsToPaint.Add(goodsToCheck[begin]);
                    begin++;
                }
            }
            ViewBag.Goods  = goodsToPaint;
            ViewBag.IsNext = isNext;
            ViewBag.IsBack = isBack;
            return(View());
        }
Пример #35
0
        public void DeleteGoodInCells(Good good)
        {
            var goodInCells = _context.GoodsInCells.Where(gic => gic.GoodId == good.Id).ToList();

            _context.GoodsInCells.RemoveRange(goodInCells);
        }
Пример #36
0
        public static void ChooseOperationForGoodsRepository(IGoodsRepository goodsRepository, OperationForGoodsRepository goodsRepositoryOperation)
        {
            switch (goodsRepositoryOperation)
            {
            case OperationForGoodsRepository.ShowAll:
                ShowAllGoods(goodsRepository.Get());
                break;

            case OperationForGoodsRepository.ShowById:
                Console.WriteLine("Enter good Id: ");
                if (int.TryParse(Console.ReadLine(), out var getGoodId))
                {
                    Console.WriteLine(goodsRepository.Get(getGoodId));
                }
                break;

            case OperationForGoodsRepository.Add:
                Good goodToAdd = CreateGoodToAdd();
                goodsRepository.Add(goodToAdd);
                Console.WriteLine("New good added");
                break;

            case OperationForGoodsRepository.Update:

                Good goodToUpdate = null;
                Console.Write("Enter good Id to update: ");
                if (int.TryParse(Console.ReadLine(), out var getGoodIdToUpdate))
                {
                    goodToUpdate = goodsRepository.Get(getGoodIdToUpdate);
                }
                var fieldToUpdate = ShowGoodUpdateMenu();
                ChooseFieldToUpdate(goodToUpdate, fieldToUpdate);

                goodsRepository.Update(goodToUpdate);
                Console.WriteLine("Good updated");
                break;

            case OperationForGoodsRepository.Delete:
                Console.WriteLine("Enter good Id: ");
                if (int.TryParse(Console.ReadLine(), out var deleteGoodId))
                {
                    goodsRepository.Delete(deleteGoodId);
                    Console.WriteLine("Good deleted");
                }
                break;

            case OperationForGoodsRepository.ShowMaxQuantityGood:
                var goodMaxQuantity = goodsRepository.GetMaxQuantityGood();
                Console.WriteLine($" Max quantity Good: Name: {goodMaxQuantity.Name} Quantity: {goodMaxQuantity.Quantity}");
                break;

            case OperationForGoodsRepository.ShowMinQuantityGood:
                var goodMinQuantity = goodsRepository.GetMinQuantityGood();
                Console.WriteLine($" Min quantity Good: Name: {goodMinQuantity.Name} Quantity: {goodMinQuantity.Quantity}");
                break;

            case OperationForGoodsRepository.ShowMaxCostGood:
                var goodMaxCost = goodsRepository.GetMaxCostGood();
                Console.WriteLine($" Max cost Good: Name: {goodMaxCost.Name} Cost: {goodMaxCost.Cost}");
                break;

            case OperationForGoodsRepository.ShowMinCostGood:
                var goodMinCost = goodsRepository.GetMinCostGood();
                Console.WriteLine($" Min cost Good: Name: {goodMinCost.Name} Cost: {goodMinCost.Cost}");
                break;

            case OperationForGoodsRepository.ShowGoodsByType:
                IEnumerable <Good> goodsByTypeId = null;
                Console.Write("Enter type Id: ");
                if (int.TryParse(Console.ReadLine(), out var typeId))
                {
                    goodsByTypeId = goodsRepository.GetGoodsByType(typeId);
                }
                ShowAllGoods(goodsByTypeId);
                break;

            case OperationForGoodsRepository.ShowGoodsBySupplier:
                IEnumerable <Good> goodsBySupplier = null;
                Console.Write("Enter supplier Id: ");
                if (int.TryParse(Console.ReadLine(), out var supplierId))
                {
                    goodsBySupplier = goodsRepository.GetGoodsBySupplier(supplierId);
                }
                ShowAllGoods(goodsBySupplier);
                break;

            case OperationForGoodsRepository.ShowGoodsByPassedDays:
                IEnumerable <Good> goodsByPassedDays = null;
                Console.Write("Enter number of days: ");
                if (int.TryParse(Console.ReadLine(), out var numberOfDays))
                {
                    goodsByPassedDays = goodsRepository.GetGoodsByPassedDays(numberOfDays);
                }
                ShowAllGoods(goodsByPassedDays);
                break;

            case OperationForGoodsRepository.ShowGoodsByPassedMaxDays:
                var theOldestGood = goodsRepository.GetTheOldestGood();
                Console.WriteLine($" The oldest Good: Name: {theOldestGood.Name} DeliveryDate: {theOldestGood.DeliveryDate}");
                break;

            case OperationForGoodsRepository.ShowAverageGoodsQuantityByType:
                goodsRepository.GetAvgGoodsQuantityByType();
                break;

            default:
                Environment.Exit(0);
                break;
            }
        }
Пример #37
0
 public static bool CanEquip(int goodIndex, Good.EquipPosition position)
 {
     return(!IsInEquipRange(goodIndex) &&
            Good.CanEquip(Get(goodIndex), position));
 }
Пример #38
0
        public void GetGoods(int? id)
        {
            GetGoodsTree(id);

            if (id == null)
            {
                for (int i = 0; i < GoodsTree.Count; i++)
                {
                    int res = sh4.Goods(GoodsTree[i].ID);

                    if (res >= 0)
                    {
                        while (sh4.EOF(res) != 1)
                        {
                            Good g = new Good();
                            g.id = sh4.ValByName(res, "1.210.1.0");
                            g.GroupID = sh4.ValByName(res, "1.209.1.0");
                            g.Name = sh4.ValByName(res, "1.210.2.0");
                            g.CodePrefix = sh4.ValByName(res, "1.210.3.0");
                            g.CodeNumber = sh4.ValByName(res, "1.210.4.0");
                            g.Unit = sh4.ValByName(res, "1.206.2.0");
                            g.ComplectID = sh4.ValByName(res, "1.200.1.1");
                            g.ComplectName = sh4.ValByName(res, "1.200.2.1");

                            Goods.Add(g);
                            sh4.Next(res);
                        }

                        sh4.CloseQuery(res);
                    }
                }
            }
            else
            {
                int res = sh4.Goods((int)id);

                if (res >= 0)
                {
                    while (sh4.EOF(res) != 1)
                    {
                        Good g = new Good();
                        g.id = sh4.ValByName(res, "1.210.1.0");
                        g.GroupID = sh4.ValByName(res, "1.209.1.0");
                        g.Name = sh4.ValByName(res, "1.210.2.0");
                        g.CodePrefix = sh4.ValByName(res, "1.210.3.0");
                        g.CodeNumber = sh4.ValByName(res, "1.210.4.0");
                        g.Unit = sh4.ValByName(res, "1.206.2.0");
                        g.ComplectID = sh4.ValByName(res, "1.200.1.1");
                        g.ComplectName = sh4.ValByName(res, "1.200.2.1");

                        Goods.Add(g);
                        sh4.Next(res);
                    }

                    sh4.CloseQuery(res);
                }
            }

            for (int i = 0; i < Goods.Count; i++)
            {
                Goods[i].GroupName = GoodsTree.FirstOrDefault(p => p.ID == Goods[i].GroupID).Name;
            }
        }
Пример #39
0
 public void Delete(Good good)
 {
     Database.Delete(good);
 }
Пример #40
0
        public void GetBalances(int? GroupID, int? GoodID)
        {
            if (GroupID == null && GoodID == null)
            {
                GetGoods(null);

                //Остатки
                for (int i = 0; i < Goods.Count; i++)
                {
                    int res = sh4.GsFifo(Goods[i].id, 0, DateTime.Today.ToOADate(), DateTime.Today.ToOADate());

                    if (res >= 0)
                    {
                        while (sh4.EOF(res) != 1)
                        {
                            if (sh4.ValByName(res, "1.105.1.1").GetType() == typeof(DBNull))
                            {
                                GoodsBalance gb = new GoodsBalance();
                                gb.good = Goods[i];
                                gb.balance = sh4.ValByName(res, "1.105.3.0");
                                gb.cost_bal = sh4.ValByName(res, "1.105.4.0");
                                GoodsBalances.Add(gb);
                                break;
                            }

                            sh4.Next(res);
                        }

                        sh4.CloseQuery(res);
                    }
                }
            }
            else
                if (GroupID != null)
                {
                    GetGoods(GroupID);

                    for (int i = 0; i < Goods.Count; i++)
                    {
                        int res = sh4.GsFifo(Goods[i].id, 0, DateTime.Today.ToOADate(), DateTime.Today.ToOADate());

                        if (res >= 0)
                        {
                            while (sh4.EOF(res) != 1)
                            {
                                if (sh4.ValByName(res, "1.105.1.1").GetType() == typeof(DBNull))
                                {
                                    GoodsBalance gb = new GoodsBalance();
                                    gb.good = Goods[i];
                                    gb.balance = sh4.ValByName(res, "1.105.3.0");

                                    dynamic sum = sh4.ValByName(res, "1.105.4.0");

                                    if (gb.balance > 0)
                                        gb.cost_bal = (double)sum / (double)gb.balance;
                                    else
                                        gb.cost_bal = 0;

                                    GoodsBalances.Add(gb);
                                    break;
                                }

                                sh4.Next(res);
                            }

                            sh4.CloseQuery(res);
                        }
                    }
                }
                else
                {
                    GetGoodsTree(null);
                    int res = sh4.GoodByRID((int)GoodID);

                    if (res >= 0)
                    {
                        Good g = new Good();

                        while (sh4.EOF(res) != 1)
                        {
                            g.id = sh4.ValByName(res, "1.210.1.0");
                            g.GroupID = sh4.ValByName(res, "1.209.1.0");
                            g.Name = sh4.ValByName(res, "1.210.2.0");
                            g.CodePrefix = sh4.ValByName(res, "1.210.3.0");
                            g.CodeNumber = sh4.ValByName(res, "1.210.4.0");
                            g.Unit = sh4.ValByName(res, "1.206.2.0");
                            g.ComplectID = sh4.ValByName(res, "1.200.1.1");
                            g.ComplectName = sh4.ValByName(res, "1.200.2.1");
                            g.GroupName = GoodsTree.FirstOrDefault(p => p.ID == g.GroupID).Name;

                            Goods.Add(g);
                            sh4.Next(res);
                        }

                        sh4.CloseQuery(res);

                        res = sh4.GsFifo((int)GoodID, 0, DateTime.Today.ToOADate(), DateTime.Today.ToOADate());

                        if (res >= 0)
                        {
                            while (sh4.EOF(res) != 1)
                            {
                                if (sh4.ValByName(res, "1.105.1.1").GetType() == typeof(DBNull))
                                {
                                    GoodsBalance gb = new GoodsBalance();
                                    gb.good = g;
                                    gb.balance = sh4.ValByName(res, "1.105.3.0");
                                    dynamic sum = sh4.ValByName(res, "1.105.4.0");

                                    if (gb.balance > 0)
                                        gb.cost_bal = (double)sum / (double)gb.balance;
                                    else
                                        gb.cost_bal = 0;

                                    GoodsBalances.Add(gb);
                                    break;
                                }

                                sh4.Next(res);
                            }

                            sh4.CloseQuery(res);
                        }
                    }
                }

            if (GoodsBalances.Count > 0)
            {
                DateTime startdate = DateTime.Parse("01." + DateTime.Today.AddMonths(-1).Month + "." + DateTime.Today.AddMonths(-1).Year);
                DateTime enddate = DateTime.Parse(DateTime.DaysInMonth(DateTime.Today.AddMonths(-1).Year, DateTime.Today.AddMonths(-1).Month) + "." + DateTime.Today.AddMonths(-1).Month + "." + DateTime.Today.AddMonths(-1).Year);

                //Себестоимость
                for (int i = 0; i < GoodsBalances.Count; i++)
                {
                    GoodsBalances[i].cost = GetCost(GoodsBalances[i].good.id, startdate, enddate);
                }
            }
        }
 static bool TryParse(string s, out Good value)
 {
     value = new Good();
     return(s != null);
 }
 public void Add(Good good)
 {
     _dBCOntext.Goods.Add(good);
 }
Пример #43
0
    void Start()
    {
        MainCamera = GameObject.Find("Main Camera");
        CenterObj  = MainCamera;
        Menu       = GameObject.Find("Menu Canvas");
        Payment    = GameObject.Find("Payment Canvas");
        Msg        = GameObject.Find("Msg Canvas");
        Trans      = GameObject.Find("Trans Canvas");
        Search     = GameObject.Find("Search Canvas");
        Cart       = GameObject.Find("Cart Canvas");
        Info       = GameObject.Find("Info Canvas");
        Good       = GameObject.Find("Good Canvas");
        Voice      = GameObject.Find("Voice Canvas");
        NewOrder   = GameObject.Find("Order Canvas");
        Copy       = GameObject.Find("Copy Canvas");
        Model      = GameObject.Find("Model Canvas");
        House      = GameObject.Find("House Canvas");
        HouseView  = GameObject.Find("House View");
        Star       = GameObject.Find("Star");

        int langNum;

        if (!string.IsNullOrEmpty(GetString("lang")))
        {
            langNum = int.Parse(GetString("lang"));
        }
        else
        {
            langNum = Application.systemLanguage.ToString() == "Chinese" ? 1 : Application.systemLanguage.ToString() == "English" ? 0 : 0;
            SetString("lang", langNum.ToString());
        }
        Debug.Log(langNum);
        Language.ini(langNum);//语言初始化

        Star.SetActive(false);
        HouseView.SetActive(false);
        House.SetActive(false);
        Model.SetActive(false);
        Copy.SetActive(false);
        NewOrder.SetActive(false);
        Voice.SetActive(false);
        Good.SetActive(false);
        Info.SetActive(false);
        Cart.SetActive(false);
        Search.SetActive(false);
        Trans.SetActive(false);
        Msg.SetActive(false);
        Payment.SetActive(false);
        Menu.SetActive(false);

        facePosition = new Vector3(
            Mathf.Sin((CenterObj.transform.rotation.eulerAngles.y * Mathf.PI) / 180) * faceRadius,
            Mathf.Sin((-CenterObj.transform.rotation.eulerAngles.x * Mathf.PI) / 180) * 3f > 1.5f ? Mathf.Sin((-CenterObj.transform.rotation.eulerAngles.x * Mathf.PI) / 180) * 3f : 1.5f,
            Mathf.Cos((CenterObj.transform.rotation.eulerAngles.y * Mathf.PI) / 180) * faceRadius);
        faceRotation = Quaternion.Euler(
            CenterObj.transform.rotation.eulerAngles.x < 0f ? CenterObj.transform.rotation.eulerAngles.x : 0f,
            CenterObj.transform.rotation.eulerAngles.y,
            0f);


#if UNITY_EDITOR
        device = 1;
#endif
#if UNITY_ANDROID
        device = 2;
#endif
#if UNITY_IPHONE
        device = 3;
#endif
#if UNITY_METRO
        device = 4;
#endif
        Debug.Log("device: " + device);
        check();               //检查版本
        SetString("id", "-1"); //设置初始化id为-1,即未登录

        for (int i = 0; i < 10; i++)
        {
            star();
        }
        inied = false;

        //以上是正式代码,以下是测试代码
    }
Пример #44
0
        public IActionResult Individual(string nickname)
        {
            Errors error = Errors.Null;

            try
            {
                var countermeasureDroppers = Utils.GetDatabaseCollection <CountermeasureDropper>("CMs", ref error);
                if (error != Errors.Null)
                {
                    throw new InvalidOperationException("The database was unable to access the CMs collection.");
                }

                var goods = Utils.GetDatabaseCollection <Good>("Goods", ref error);
                if (error != Errors.Null)
                {
                    throw new InvalidOperationException("The database was unable to access the Goods collection.");
                }

                var infocards = Utils.GetDatabaseCollection <Infocard>("Infocards", ref error);
                if (error != Errors.Null)
                {
                    throw new InvalidOperationException("The database was unable to access the Infocards collection.");
                }

                var bases = Utils.GetDatabaseCollection <Base>("Bases", ref error);
                if (error != Errors.Null)
                {
                    throw new InvalidOperationException("The database was unable to access the Bases collection.");
                }

                var marketEquipment = Utils.GetDatabaseCollection <Market>("MarketsEquipment", ref error);
                if (error != Errors.Null)
                {
                    throw new InvalidOperationException("The database was unable to access the MarketsEquipment collection.");
                }

                var systems = Utils.GetDatabaseCollection <Ini.System>("Systems", ref error);
                if (error != Errors.Null)
                {
                    throw new InvalidOperationException("The database was unable to access the Systems collection.");
                }

                var factions = Utils.GetDatabaseCollection <Faction>("Factions", ref error);
                if (error != Errors.Null)
                {
                    throw new InvalidOperationException("The database was unable to access the Factions collection.");
                }

                CountermeasureDropper dropper = countermeasureDroppers.Find(x => x.Nickname == nickname);
                Good good = goods.Find(x => x.Nickname == nickname);
                dropper.Price = good.Price;

                Dictionary <string, decimal> baseList = new Dictionary <string, decimal>();
                foreach (var i in marketEquipment)
                {
                    if (i.Goods.FirstOrDefault(x => x.Nickname == nickname) != null)
                    {
                        baseList.Add(i.Base, i.Goods.FirstOrDefault(x => x.Nickname == nickname).PriceModifier);
                    }
                }

                Dictionary <Base, decimal> sellpoints = new Dictionary <Base, decimal>();
                foreach (var s in baseList)
                {
                    sellpoints[bases.First(x => x.Nickname == s.Key)] = s.Value;
                }

                ViewBag.Infocards  = infocards;
                ViewBag.Sellpoints = sellpoints;
                ViewBag.Factions   = factions;
                ViewBag.Systems    = systems;
                return(View(dropper));
            }
            catch (Exception ex)
            {
                return(View("DatabaseError", new PageException(ex, error)));
            }
        }
Пример #45
0
 protected void btnOK_Click(object sender, EventArgs e)
 {
     if (this.tbxName.Text != "" && this.tbxCount.Text != "" && this.tbxPicexplain.Text != "" && this.tbxPrice.Text != "" && this.tbxPriurl.Text != "")
     {
         GA   gAdmin = new GA();
         Good good   = new Good();//定义对象
         good.GoodName      = this.tbxName.Text;
         good.GoodIncentory = Convert.ToInt32(this.tbxCount.Text);
         good.GoodPrice     = this.tbxPrice.Text;
         FirstClassDm first = new FirstClassDm();
         first.FirstClassDmName = this.dplFirstClum.SelectedItem.Text;
         SecondClassDm second = new SecondClassDm();
         second.SecondClassDmName = this.dplSecondClum.SelectedItem.Text;
         ThirdClassDm Third = new ThirdClassDm();
         Third.ThirdClassDmName = this.dplThirdClum.SelectedItem.Text;
         good.FirstClassDmID    = gAdmin.FcNameGetID(first);//传一、二、三级类目ID
         good.SecondClassDmID   = gAdmin.ScNameGetID(second);
         good.ThirdClassDmID    = gAdmin.TcNameGetID(Third);
         if (gAdmin.AddGood(good) == true)                                        //添加商品表
         {
             for (int GoodCount = 0; GoodCount < good.GoodIncentory; GoodCount++) //添加单个商品
             {
                 SingleGoodInfo singleGoodinfo = new SingleGoodInfo();
                 singleGoodinfo.StaffID = Convert.ToInt32(Session["hStaffID"].ToString());
                 singleGoodinfo.GoodID  = Good.GoodNameGetID(good);
                 gAdmin.AddSingleGoodInfo(singleGoodinfo);
                 SaveSingleGoodInfo saveSinGoodinfo = new SaveSingleGoodInfo();
                 saveSinGoodinfo.StaffID = Convert.ToInt32(Session["hStaffID"].ToString());
                 saveSinGoodinfo.GoodID  = Good.GoodNameGetID(good);
                 gAdmin.AddSaveSingleGoodInfo(saveSinGoodinfo);
             }
             ImgInfo imginfo = new ImgInfo();
             imginfo.GoodID     = Good.GoodNameGetID(good);
             imginfo.ImgAddress = this.tbxPriurl.Text;
             imginfo.ImgTitle   = this.tbxPicexplain.Text;
             if (gAdmin.AddImginfo(imginfo) == true)//添加商品图片信息表
             {
                 GoodPropertyComb goodprocomb = new GoodPropertyComb();
                 ThirdClassDm     third       = new ThirdClassDm();
                 third.ThirdClassDmName = dplThirdClum.SelectedItem.Text;
                 third.ThirdClassDmID   = gAdmin.TcNameGetID(third);
                 PropertyClassDm propertyclass = new PropertyClassDm();
                 List <Property> prolist       = new List <Property>();
                 prolist = PropertyClassDm.TcIDGetPoID(third);
                 int count = 0;
                 for (int i = 0; i < prolist.Count; i++)
                 {
                     PropertyContent proCont = new PropertyContent();
                     goodprocomb.GoodID     = Good.GoodNameGetID(good);
                     goodprocomb.PropertyID = prolist[i].PropertyID;
                     DropDownList ddl = (DropDownList)DataList1.Items[i].FindControl("dpl_PropertyContent"); //在datalist中找dropdownlist
                     goodprocomb.PropertyContent = ddl.SelectedItem.Text;
                     if (gAdmin.AddGoodPropertyComb(goodprocomb))                                            //绑定属性、属性内容、和商品的关系
                     {
                         count += 1;
                     }
                 }
                 if (count == prolist.Count)
                 {
                     this.lblCheck.Text = "添加成功!";
                     //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language=javascript>alert('" + "添加成功" + "'); </script>");
                 }
             }
             else
             {
                 this.lblCheck.Text = "添加失败";
                 //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language=javascript>alert('" + "添加失败" + "'); </script>");
             }
         }
         else
         {
             this.lblCheck.Text = "添加失败!";
             //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "", "<script language=javascript>alert('" + "添加失败" + "'); </script>");
         }
     }
     else
     {
         this.lblCheck.Text = "添加项不能为空!";
     }
 }
Пример #46
0
 public void Setup()
 {
     good = new Good();
 }
Пример #47
0
 public void dbSaveGood()
 {
     try
     {
         using (AtapyContext db = new AtapyContext())
         {
             Good good = new Good
             {
                 GoodType = goodType,
                 GoodCategory =  goodCategory,
                 ProductName = productName,
                 Price = price,
                 Barcode = barcode,
                 OtherPropertiesJSON = otherPropertiesJSON
             };
             db.Database.Connection.Open();
             db.Goods.Add(good);
             db.SaveChanges();
             baseId = good.GoodId;
         }
     }
     catch (Exception ex)
     {
     }
 }
Пример #48
0
        protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            int rowIndex = Convert.ToInt32(e.CommandArgument);

            if (e.CommandName.Equals("warehousing"))
            {
                Good good = new Good();
                good.Good_name = this.GridView1.Rows[rowIndex].Cells[0].Text;
                ////good.Good_code = this.GridView1.Rows[rowIndex].Cells[3].Text;
                GoodProvider goodProvider = new GoodProvider();
                DataTable    table        = goodProvider.Select(good);
                if (table.Rows.Count != 0)
                {
                    Warehouse      warehouse      = new Warehouse();
                    Warehouse_info warehouse_info = new Warehouse_info();
                    warehouse.Good_id        = Convert.ToInt32(table.Rows[0]["good_id"]);
                    warehouse.Warehouse_type = "入库";
                    warehouse_info.Good_id   = Convert.ToInt32(table.Rows[0]["good_id"]);
                    WarehouseInfoProvider warehouseInfoProvider = new WarehouseInfoProvider();
                    table = warehouseInfoProvider.Select(warehouse_info);
                    WarehouseProvider warehouseProvider = new WarehouseProvider();
                    Shop shop = new Shop();
                    shop.Shop_id = Convert.ToInt32(this.GridView1.DataKeys[rowIndex].Value);
                    ShopProvider shopProvider = new ShopProvider();
                    if (table.Rows.Count != 0)
                    {
                        warehouse_info.Warehouse_info_number = Convert.ToInt32(this.GridView1.Rows[rowIndex].Cells[5].Text);
                        warehouse.Warehouse_number           = Convert.ToInt32(this.GridView1.Rows[rowIndex].Cells[5].Text);
                        warehouse.Order_id               = Convert.ToInt32(id);
                        warehouse.Warehouse_operators    = Session["LOGINED"].ToString();
                        warehouse.Warehouse_time         = Convert.ToDateTime(DateTime.Now.ToString("HH:mm:ss"));
                        warehouse_info.Warehouse_info_id = Convert.ToInt32(table.Rows[0]["warehouse_info_id"]);
                        if (warehouseInfoProvider.Update(warehouse_info.Warehouse_info_number, warehouse_info.Warehouse_info_id))
                        {
                            if (shopProvider.Delete(shop))
                            {
                                if (warehouseProvider.Insert(warehouse))
                                {
                                    this.Alert("入库成功!");
                                    Shop shop1 = new Shop();
                                    shop.Contrac_id = Convert.ToInt32(id);
                                    ContractShopProvider provider = new ContractShopProvider();
                                    this.ListPager1.RecordCount = provider.GetSize(shop1);
                                    this.BindSource(0);
                                    if (this.ListPager1.RecordCount > 0)
                                    {
                                        ContractProvider contractProvider = new ContractProvider();
                                        contractProvider.Update(id, "已部分收货");
                                    }
                                    else
                                    {
                                        ContractProvider contractProvider = new ContractProvider();
                                        contractProvider.Update(id, "已全部收货");
                                    }
                                }
                            }
                        }
                    }
                    else
                    {
                        warehouse_info.Warehouse_id          = warehouseProvider.GetSize() + 1;
                        warehouse_info.Warehouse_info_number = Convert.ToInt32(this.GridView1.Rows[rowIndex].Cells[5].Text);
                        warehouse.Warehouse_number           = Convert.ToInt32(this.GridView1.Rows[rowIndex].Cells[5].Text);
                        warehouse.Order_id            = Convert.ToInt32(id);
                        warehouse.Warehouse_operators = Session["LOGINED"].ToString();
                        warehouse.Warehouse_time      = Convert.ToDateTime(DateTime.Now.Date);
                        Place place = new Place();
                        place.Place_state = "空闲";
                        PlaceProvider placeProvider = new PlaceProvider();
                        table = placeProvider.Select(place);
                        warehouse_info.Place_id = Convert.ToInt32(table.Rows[0]["place_id"]);
                        if (warehouseInfoProvider.Insert(warehouse_info))
                        {
                            if (shopProvider.Delete(shop))
                            {
                                if (warehouseProvider.Insert(warehouse))
                                {
                                    this.Alert("入库成功!");
                                    Shop shop1 = new Shop();
                                    shop.Contrac_id = Convert.ToInt32(id);
                                    ContractShopProvider provider = new ContractShopProvider();
                                    this.ListPager1.RecordCount = provider.GetSize(shop1);
                                    this.BindSource(0);
                                    Contract contract = new Contract();
                                    if (this.ListPager1.RecordCount > 0)
                                    {
                                        ContractProvider contractProvider = new ContractProvider();
                                        contractProvider.Update(id, "已部分收货");
                                    }
                                    else
                                    {
                                        ContractProvider contractProvider = new ContractProvider();
                                        contractProvider.Update(id, "已全部收货");
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Пример #49
0
 internal GoodPeriodKey(Good good, int period)
 {
     Good = good;
     Period = period;
 }
Пример #50
0
 public void AddGood(Good good)
 {
     _context.Goods.Add(good);
 }
        private void btnAddGood_Click(object sender, EventArgs e)
        {
            _SelectedPackingsIDList = null;
            _SelectedPackingsIDList = _SelectedIDList = null;
            int       nGoodID = 0;
            bool      nFound  = false;
            DataTable dtSource;
            Good      oGoodTemp = new Good();

            if (_SelectedInputDocumentID != null || _SelectedInputID != null)
            {
                if (_SelectedInputDocumentID != null)
                {
                    InputDocument oInputDocument = new InputDocument();
                    oInputDocument.ID = _SelectedInputDocumentID;
                    oInputDocument.FillTableInputsDocumentsGoods();
                    if (oInputDocument.TableInputsDocumentsGoods.Rows.Count == 0)
                    {
                        RFMMessage.MessageBoxAttention("В выбранном приходном документе нет товаров...");
                        return;
                    }
                    dtSource = oInputDocument.TableInputsDocumentsGoods.Copy();
                }
                else
                {
                    Input oInput = new Input();
                    oInput.ID = _SelectedInputID;
                    oInput.FillTableInputsGoods();
                    if (oInput.TableInputsGoods.Rows.Count == 0)
                    {
                        RFMMessage.MessageBoxAttention("В выбранном задании на приход нет товаров...");
                        return;
                    }
                    dtSource = oInput.TableInputsGoods.Copy();
                }
                if (StartForm(new frmSelectID(this, dtSource,
                                              "GoodAlias, GoodBarcode, Articul, GoodGroupName, GoodBrandName, Retention, Weighting, GoodActual, CountryName, ERPCode",
                                              "Товар, Штрих-Код, Артикул, Группа, Бренд, Срок годн., Вес., Акт., Страна, ERP-код", true)) != DialogResult.Yes)
                {
                    _SelectedIDList = null;
                    return;
                }
                if (_SelectedIDList == null || !_SelectedIDList.Contains(","))
                {
                    return;
                }
                string[]      cIDList = _SelectedIDList.Split(',');
                StringBuilder sb      = new StringBuilder();
                DataRow       dr;
                for (int i = 0; i < cIDList.Length; i++)
                {
                    for (int j = 0; j < dtSource.Rows.Count; j++)
                    {
                        dr = dtSource.Rows[j];
                        if (cIDList[i] == dr["ID"].ToString())
                        {
                            sb.Append(dr["PackingID"].ToString() + ",");
                        }
                    }
                }
                oGoodTemp.PackingsIDList = "," + sb;
                oGoodTemp.FillData();
            }

            else
            {
                if (StartForm(new frmSelectOnePacking(this, true)) == DialogResult.Yes)
                {
                    if (_SelectedPackingsIDList == null || !_SelectedPackingsIDList.Contains(","))
                    {
                        return;
                    }

                    RFMCursorWait.Set(true);
                    oGoodTemp.PackingsIDList = "," + _SelectedPackingsIDList;
                    oGoodTemp.FillData();
                    if (oGoodTemp.ErrorNumber != 0 || oGoodTemp.MainTable == null || oGoodTemp.MainTable.Rows.Count == 0)
                    {
                        RFMCursorWait.Set(false);
                        return;
                    }
                }
            }
            foreach (DataRow rg in oGoodTemp.MainTable.Rows)
            {
                // нет ли уже такого товара?
                nGoodID = Convert.ToInt32(rg["GoodID"]);
                nFound  = false;

                foreach (DataRow drTemp in tGoodsVeterinaries.Rows)
                {
                    if (Convert.ToInt32(drTemp["GoodID"]) == nGoodID)
                    {
                        nFound = true;
                        if (oGoodTemp.MainTable.Rows.Count == 1)
                        {
                            RFMCursorWait.Set(false);
                            RFMMessage.MessageBoxError("Такой товар уже в списке...");
                            RFMCursorWait.Set(true);
                        }
                        break;
                    }
                }
                if (!nFound)
                {
                    // добавляем новую строку для выбранного товара
                    DataTable dtTemp = tGoodsVeterinaries.Clone();
                    dtTemp.Columns["GoodID"].AllowDBNull = true;
                    DataRow dr = dtTemp.Rows.Add();
                    dr["GoodID"]        = nGoodID;
                    dr["GoodName"]      = rg["GoodName"];
                    dr["GoodAlias"]     = rg["GoodAlias"];
                    dr["GoodBarCode"]   = rg["GoodBarCode"];
                    dr["Articul"]       = rg["Articul"];
                    dr["GoodGroupName"] = rg["GoodGroupName"];
                    dr["GoodBrandName"] = rg["GoodBrandName"];
                    dr["CountryName"]   = rg["CountryName"];
                    dr["Weighting"]     = rg["Weighting"];
                    dr["GoodActual"]    = rg["GoodActual"];
                    dr["Netto"]         = rg["Netto"];
                    dr["Brutto"]        = rg["Brutto"];
                    dr["Retention"]     = rg["Retention"];
                    dr["GoodERPCode"]   = rg["GoodERPCode"];

                    tGoodsVeterinaries.ImportRow(dr);
                }
                // встать на последнюю добавленную строку
                if (nGoodID != 0)
                {
                    grdData.GridSource.Position = grdData.GridSource.Find("GoodID", nGoodID);
                    if (grdData.GridSource.Position < 0)
                    {
                        grdData.GridSource.MoveFirst();
                    }
                }
                RFMCursorWait.Set(false);
            }
            _SelectedPackingsIDList = null;

            btnDeleteGood.Enabled = (grdData.Rows.Count > 0);
        }
Пример #52
0
 public void addAmount(Good good)
 {
     this._total += computeTotal(good);
 }
Пример #53
0
 public QRGenerationViewModel(MahApps.Metro.Controls.Dialogs.IDialogCoordinator instance)
 {
     newgood           = new Good();
     supplier          = new Supplier();
     dialogCoordinator = instance;
 }
Пример #54
0
 public void addTax(Good good)
 {
     _total_tax += this.computeTax(good);
 }
Пример #55
0
        public override void ShowGood(Good good)
        {
            IsShow = true;
            var name   = "无名称";
            var cost   = "价格: 0";
            var user   = "";
            var effect = new StringBuilder();
            var intro  = "无简介";

            if (good != null)
            {
                if (!string.IsNullOrEmpty(good.Name))
                {
                    name = good.Name;
                }
                cost = "价格: " + good.Cost;
                if (good.IsSellPriceSetted)
                {
                    cost += "\n" + "卖出价: " + good.SellPrice;
                }

                if (good.User != null && good.User.Length > 0)
                {
                    user = ("使用者:" + string.Join(",", good.User));
                }
                if (good.MinUserLevel > 0)
                {
                    user += (string.IsNullOrEmpty(user) ? "" : Environment.NewLine) + "等级需求:" + good.MinUserLevel;
                }

                if (good.Life != 0)
                {
                    effect.AppendLine("命" + good.Life.ToString("+#;-#"));
                }
                if (good.Thew != 0)
                {
                    effect.AppendLine("体" + good.Thew.ToString("+#;-#"));
                }
                if (good.Mana != 0)
                {
                    effect.AppendLine("气" + good.Mana.ToString("+#;-#"));
                }
                if (good.Attack != 0)
                {
                    effect.AppendLine("攻" + good.Attack.ToString("+#;-#"));
                }
                if (good.Attack2 != 0)
                {
                    effect.AppendLine("攻2 " + good.Attack2.ToString("+#;-#"));
                }
                if (good.Defend != 0)
                {
                    effect.AppendLine("防" + good.Defend.ToString("+#;-#"));
                }
                if (good.Defend2 != 0)
                {
                    effect.AppendLine("防2" + good.Defend2.ToString("+#;-#"));
                }
                if (good.Evade != 0)
                {
                    effect.AppendLine("捷" + good.Evade.ToString("+#;-#"));
                }
                if (good.LifeMax != 0)
                {
                    effect.AppendLine("命" + good.LifeMax.ToString("+#;-#"));
                }
                if (good.ThewMax != 0)
                {
                    effect.AppendLine("体" + good.ThewMax.ToString("+#;-#"));
                }
                if (good.ManaMax != 0)
                {
                    effect.AppendLine("气" + good.ManaMax.ToString("+#;-#"));
                }
                if (good.SpecialEffect == 1)
                {
                    effect.AppendLine(string.Format("不断恢复生命 {0}%/秒", good.SpecialEffectValue));
                }
                if (good.ChangeMoveSpeedPercent != 0)
                {
                    effect.AppendLine(string.Format("移动速度 {0:+#;-#}%", good.ChangeMoveSpeedPercent));
                }
                if (good.AddMagicEffectPercent > 0 || good.AddMagicEffectAmount > 0)
                {
                    var showName = "所有武功";
                    if (!string.IsNullOrEmpty(good.AddMagicEffectName))
                    {
                        showName = good.AddMagicEffectName;
                    }
                    else if (!string.IsNullOrEmpty(good.AddMagicEffectType))
                    {
                        showName = good.AddMagicEffectType;
                    }
                    effect.AppendLine(string.Format("{0} 攻击{1}{2}",
                                                    showName,
                                                    good.AddMagicEffectPercent > 0 ? (" +" + good.AddMagicEffectPercent + "%") : "",
                                                    good.AddMagicEffectAmount > 0 ? (" +" + good.AddMagicEffectAmount) : ""));
                }
                if (!string.IsNullOrEmpty(good.Intro))
                {
                    intro = good.Intro;
                }
            }

            var showText = new StringBuilder();

            showText.AppendLine(String.Format(FormatTemplate, _goodNameColor, name));
            showText.AppendLine(String.Format(FormatTemplate, _goodPriceColor, cost));
            if (!string.IsNullOrEmpty(user))
            {
                showText.AppendLine(String.Format(FormatTemplate, _goodUserColor, user));
            }

            if (effect.Length > 0)
            {
                showText.AppendLine(String.Format(FormatTemplate, _goodPropertyColor, effect.ToString().TrimEnd()));
            }
            showText.AppendFormat(FormatAlignLeft, String.Format(FormatTemplate, _goodIntroColor, intro));
            _text.Text = showText.ToString();
            RePose();
        }
 public void should_calculate_tax_for_a_book()
 {
     var book = new Good(12.49, GoodType.Book);
     Assert.Equal(12.49, book.GetPrice(), _comparer);
 }