예제 #1
0
        private void categoryNamecomboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (Convert.ToInt32(categoryNamecomboBox.SelectedValue) > 0)
                {
                    InventoryItemBLL     aBll  = new InventoryItemBLL();
                    List <InventoryItem> aList = new List <InventoryItem>();

                    Int32             category           = Convert.ToInt32(categoryNamecomboBox.SelectedValue);
                    InventoryCategory aInventoryCategory = (InventoryCategory)categoryNamecomboBox.Items[categoryNamecomboBox.SelectedIndex];
                    UnitCreateBLL     aCreateBll         = new UnitCreateBLL();
                    //Unit aUnit = new Unit();
                    //aUnit = aCreateBll.GetUnitByUnitId(aInventoryCategory.UnitId);
                    //unittypelabel.Text = aUnit.UnitName;

                    aList = aBll.GetItemByCategory(category);
                    itemNamecomboBox.DataSource    = aList;
                    itemNamecomboBox.DisplayMember = "ItemName";
                    itemNamecomboBox.ValueMember   = "ItemId";
                    if (Convert.ToInt32(itemNamecomboBox.SelectedValue) > 0)
                    {
                        InventoryItem aItem = new InventoryItem();
                        aItem = (InventoryItem)itemNamecomboBox.SelectedItem;
                        unittypelabel.Text = aItem.UnitName;
                    }
                }
            }
            catch
            {
            }
        }
        public async Task <IHttpActionResult> PutInventoryCategory(int id, InventoryCategory inventoryCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != inventoryCategory.Id)
            {
                return(BadRequest());
            }

            db.Entry(inventoryCategory).State = EntityState.Modified;

            try
            {
                await db.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!InventoryCategoryExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
예제 #3
0
        private void savebutton_Click(object sender, EventArgs e)
        {
            InventoryCategory aCategory = new InventoryCategory();

            aCategory.CategoryName = categoryNametextBox.Text;
            aCategory.UnitId       = Convert.ToInt32(0);

            if (categoryNametextBox.Text.Length != 0)
            {
                InventoryCategoryBLL aBll = new InventoryCategoryBLL();
                bool check = aBll.CheckExit(aCategory.CategoryName);
                if (!check)
                {
                    categoryCreatelabel.Visible = true;
                    categoryCreatelabel.Text    = aBll.InsertInventoryCategory(aCategory);
                    categoryNametextBox.Clear();
                }
                else
                {
                    MessageBox.Show("Category Already Exit");
                }
            }
            else
            {
                MessageBox.Show("Please Check Your Input");
            }
        }
 public void SetButton(Sprite icon, InventoryCategory cItem)
 {
     ActivateButton();
     this.image.overrideSprite = icon;
     this.category             = cItem;
     RefreshSelected();
 }
예제 #5
0
        public string InsertInventoryCategory(InventoryCategory aCategory)
        {
            InventoryCategoryDAO aDao = new InventoryCategoryDAO();
            string sr = aDao.InsertInventoryCategory(aCategory);

            return(sr);
        }
예제 #6
0
        public JsonResult UpdateInventoryCategory(int ID, InventoryCategory _InventoryCategory)
        {
            InventoriesController obj = new InventoriesController();
            var response = obj.PutInventoryCategory(ID, _InventoryCategory);

            return(Json(response, JsonRequestBehavior.AllowGet));
        }
예제 #7
0
        private void ShowReport(List <InventoryStockReport> aInventoryStockReports)
        {
            try
            {
                InventoryItem               aItem     = (InventoryItem)rawMaterialsNameComboBox.SelectedItem;
                InventoryCategory           aCategory = (InventoryCategory)categoryNameComboBox.SelectedItem;
                List <InventoryStockReport> aList     = new List <InventoryStockReport>();



                if (viewAllRawcheckBox.Checked)
                {
                    aList = aInventoryStockReports;
                }
                else if (viewAllAbovecheckBox.Checked)
                {
                    aList = (from report in aInventoryStockReports
                             where report.CategoryId == aCategory.CategoryId
                             select report).ToList();
                }
                else
                {
                    aList = (from report in aInventoryStockReports
                             where (report.ItemId == aItem.ItemId && report.CategoryId == aCategory.CategoryId)
                             select report).ToList();
                }

                double balanceAmount = aList.Sum(a => a.UnitPrice * a.BalanceQty);
                totalBalancelabel.Text = balanceAmount.ToString("F02");
                inventorystockDataGridView.DataSource = aList;
            }
            catch (Exception)
            {
            }
        }
 public ActionResult _FilterCategory(int id)
 {
     try
     {
         if (id == 0)
         {
             return(RedirectToAction("ViewItems"));
         }
         HttpCookie conString = Request.Cookies.Get("rwxgqlb");
         List <ViewItemsViewModel> lstItems = new List <ViewItemsViewModel>();
         InventoryCategory         category = new InventoryCategory(id, Cryptography.Decrypt(conString.Value));
         foreach (var item in category.GetItems())
         {
             lstItems.Add(new ViewItemsViewModel
             {
                 Category = item.Category.CategoryName,
                 Id       = item.ItemId,
                 Name     = item.Name,
                 Price    = item.Price,
                 Quantity = item.Quantity
             });
         }
         PagedList <ViewItemsViewModel> model = new PagedList <ViewItemsViewModel>(lstItems, 1, (lstItems.Count > 1) ? lstItems.Count : 1);
         return(View("ViewItems", model));
     }
     catch (Exception ex)
     {
         return(Content(ex.Message));
     }
 }
        public async Task OnGetAsync()
        {
            IQueryable <string> warehouseQuery = from a in _context.Warehouse
                                                 orderby a.CWhCode + "-" + a.CWhName
                                                 select a.CWhCode + "-" + a.CWhName;

            IQueryable <string> inventoryCategoryQuery = from x in _context.InventoryClass
                                                         where x.CInvCcode.Length == 2
                                                         orderby x.CInvCcode + "-" + x.CInvCname
                                                         select x.CInvCcode + "-" + x.CInvCname;

            Warehouses         = new SelectList(await warehouseQuery.Distinct().ToListAsync());
            InventoryCategorys = new SelectList(await inventoryCategoryQuery.Distinct().ToListAsync());

            var ic = InventoryCategory == null ? "03" : InventoryCategory.Substring(0, 2);

            this.AnotherCreateData(StartDate, EndDate, ic);

            IQueryable <TjgCgdj> tjgCgdjs = from t in _context.TjgCgdj
                                            select t;

            if (!string.IsNullOrEmpty(Warehouse))
            {
                tjgCgdjs = tjgCgdjs.Where(t => t.Whcode == Warehouse.Substring(0, 3));
            }

            TjgCgdjs = await tjgCgdjs.AsNoTracking().ToListAsync();
        }
예제 #10
0
 public ActionResult AddCategory(AddCategoryViewModel model)
 {
     try
     {
         if (!ModelState.IsValid)
         {
             return(View());
         }
         HttpCookie        conString = Request.Cookies.Get("rwxgqlb");
         InventoryCategory category  = null;
         try
         {
             category = new InventoryCategory(model.Name, Cryptography.Decrypt(conString.Value));
         }
         catch (Exception ex)
         {
             ViewBag.Success = false;
             ModelState.AddModelError(String.Empty, ex.Message);
             return(View());
         }
         ViewBag.Success = true;
         return(View());
     }
     catch (Exception ex)
     {
         return(Content(ex.Message));
     }
 }
예제 #11
0
        public List <InventoryCategory> GetAllCategory()
        {
            List <InventoryCategory> aList = new List <InventoryCategory>();

            try
            {
                this.OpenConnection();
                string      sqlCommand = String.Format(SqlQueries.GetQuery(Query.GetAllCategory));
                IDataReader oReader    = this.ExecuteReader(sqlCommand);
                if (oReader != null)
                {
                    while (oReader.Read())
                    {
                        InventoryCategory aCategory = new InventoryCategory();
                        aCategory = ReaderToCategory(oReader);

                        aList.Add(aCategory);
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex + " Try Again");
            }
            finally
            {
                this.CloseConnection();
            }
            return(aList);
        }
예제 #12
0
        public JsonResult AddInventoryCategory(InventoryCategory inventoryCategory)
        {
            InventoriesController obj = new InventoriesController();
            var response = obj.PostInventoryCategory(inventoryCategory);

            return(Json(((InventoryCategory)(((System.Net.Http.ObjectContent)(response.Content)).Value)).ICID, JsonRequestBehavior.AllowGet));
        }
    public void OnPointerUp(PointerEventData eventData)
    {
        InventoryCategory invetoryCategory = AdventureModeManager.Instance.playerController.invetoryCategory;
        Canvas            canvas           = AdventureModeManager.Instance.playerController.canvas;

        Debug.Log(string.Format("{0}의 {1}번 슬롯 드랍", invetoryCategory, itemSlotData.index, itemSlotData.itemData.key));
    }
예제 #14
0
        private InventoryCategory ReaderToCategory(IDataReader oReader)
        {
            InventoryCategory aCategory = new InventoryCategory();

            try
            {
                aCategory.CategoryId = Convert.ToInt32(oReader["IC_id"]);
            }
            catch
            {
            }
            try
            {
                aCategory.CategoryName = oReader["IC_name"].ToString();
            }
            catch
            {
            }
            try
            {
                aCategory.UnitId = Convert.ToInt32(oReader["IC_unit"]);
            }
            catch
            {
            }
            return(aCategory);
        }
예제 #15
0
    public List <IItem> GetInventoryList(InventoryCategory inventoryCategory)
    {
        switch (inventoryCategory)
        {
        case InventoryCategory.Equip:
        {
            return(Equips);
        }

        case InventoryCategory.Item:
        {
            List <IItem> allList = new List <IItem>();
            allList.AddRange(Potions);
            allList.AddRange(Matrials);
            return(allList);
        }

        case InventoryCategory.Etc:
        {
            return(Costumes);
        }

        default:
        {
            List <IItem> allList = new List <IItem>();
            allList.AddRange(GetInventoryList(InventoryCategory.Equip));
            allList.AddRange(GetInventoryList(InventoryCategory.Item));
            allList.AddRange(GetInventoryList(InventoryCategory.Etc));
            return(allList);
        }
        }
    }
 public void ActivateButton()
 {
     this.image.color          = new Color(255, 255, 255, 190);
     this.image.overrideSprite = null;
     this.image.color          = Color.white;
     this.category             = null;
     this.btn.interactable     = true;
 }
 public void ClearButton()
 {
     this.image.overrideSprite = null;
     this.image.color          = Color.clear;
     this.category             = null;
     this.btn.interactable     = false;
     this.bg.color             = Color.white;
 }
예제 #18
0
 public void ClearButton()
 {
     image.overrideSprite = null;
     image.color          = Color.clear;
     category             = null;
     btn.interactable     = false;
     bg.color             = Color.white;
 }
예제 #19
0
        public void TestMethod1()
        {
            InventoryCategory inventoryCategory = new InventoryCategory();

            inventoryCategory.Name = "testing1";

            inventoryCategoryDao.create(inventoryCategory);
        }
예제 #20
0
        public ActionResult Contact()
        {
            ViewBag.Message = "Your contact page.";
            InventoryCategory inventoryCategory = new InventoryCategory();

            inventoryCategory.Name = "Create1";
            inventoryCategoryDao.create(inventoryCategory);
            return(View());
        }
예제 #21
0
        public InventoryCategory GetInventoryCategoryById(int id)
        {
            InventoryCategory objFine = unitOfWork.InventoryCategoryRepository.GetById(id);

            if (objFine == null)
            {
                throw new HttpResponseException(Request.CreateResponse(HttpStatusCode.NotFound));
            }
            return(objFine);
        }
        public async Task <IHttpActionResult> GetInventoryCategory(int id)
        {
            InventoryCategory inventoryCategory = await db.InventoryCategory.FindAsync(id);

            if (inventoryCategory == null)
            {
                return(NotFound());
            }

            return(Ok(inventoryCategory));
        }
예제 #23
0
    void CreateCategoryButton(InventoryCategory ic, ScrollingGrid grid)
    {
        GUIButton categoryButton = CreateObjectButton(ic, grid, ic.id);

        categoryButton.OnSingleClick = new Action(() =>
        {
            BigBoss.Gooey.categoryDisplay = true;
            BigBoss.Gooey.category        = (categoryButton.refObject as InventoryCategory).id;
            BigBoss.Gooey.OpenInventoryGUI();
        });
    }
예제 #24
0
        public void TestMethod1()
        {
            DaoContext dao = new DaoContext();

            InventoryCategory inventoryCat = new InventoryCategory();

            inventoryCat.Name = "testing";

            dao.InventoryCategories.Add(inventoryCat);
            dao.SaveChanges();
        }
        public async Task <IHttpActionResult> PostInventoryCategory(InventoryCategory inventoryCategory)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.InventoryCategory.Add(inventoryCategory);
            await db.SaveChangesAsync();

            return(CreatedAtRoute("DefaultApi", new { id = inventoryCategory.Id }, inventoryCategory));
        }
예제 #26
0
        /// <summary>
        /// Maps Inventory Category EF object to Inventory Category Model Object and
        /// returns the Inventory Category model object.
        /// </summary>
        /// <param name="result">EF Inventory Category object to be mapped.</param>
        /// <returns>Inventory Category Model Object.</returns>
        public InventoryCategory MapEFToModel(EF.Models.InventoryCategory data)
        {
            var inventoryCategory = new InventoryCategory()
            {
                InventoryCategoryId = data.InventoryCategoryId,
                Name      = data.Name,
                CreatedOn = data.CreatedOn,
                TimeStamp = data.TimeStamp,
            };

            return(inventoryCategory);
        }
예제 #27
0
        private void ShowReport(List <Transaction> aTransactions)
        {
            try
            {
                string             sr        = (string)transactionNamecomboBox.SelectedItem;
                InventoryItem      aItem     = (InventoryItem)rawMaterialsNameComboBox.SelectedItem;
                InventoryCategory  aCategory = (InventoryCategory)categoryNameComboBox.SelectedItem;
                List <Transaction> aList     = new List <Transaction>();


                if (viewAllRawcheckBox.Checked && transactioncheckBox.Checked)
                {
                    aList = (from aTransaction in aTransactions
                             where aTransaction.TransactionType == sr
                             select aTransaction).ToList();
                }
                else if (viewAllAbovecheckBox.Checked && transactioncheckBox.Checked)
                {
                    aList = (from aTransaction in aTransactions
                             where (aTransaction.TransactionType == sr && aTransaction.Category.CategoryId == aCategory.CategoryId)
                             select aTransaction).ToList();
                }
                else if (transactioncheckBox.Checked)
                {
                    aList = (from aTransaction in aTransactions
                             where (aTransaction.TransactionType == sr && aTransaction.Item.ItemId == aItem.ItemId &&
                                    aTransaction.Category.CategoryId == aCategory.CategoryId)
                             select aTransaction).ToList();
                }
                else if (viewAllRawcheckBox.Checked)
                {
                    aList = aTransactions;
                }
                else if (viewAllAbovecheckBox.Checked)
                {
                    aList = (from aTransaction in aTransactions
                             where (aTransaction.Category.CategoryId == aCategory.CategoryId)
                             select aTransaction).ToList();
                }
                else
                {
                    aList = (from aTransaction in aTransactions
                             where (aTransaction.Item.ItemId == aItem.ItemId && aTransaction.Category.CategoryId == aCategory.CategoryId)
                             select aTransaction).ToList();
                }

                List <TransationReport> aReport = ConvertReport(aList);
                inventoryTransactionDataGridView.DataSource = aReport;
            }
            catch (Exception)
            {
            }
        }
예제 #28
0
        public InventoryItem(string _itemName, int _itemID, string _itemDescription, WeaponType _weaponType, float _itemPrice)
        {
            itemName = _itemName;
            itemID = _itemID;
            itemDescription = _itemDescription;
            itemIcon = (bool)Resources.Load<Texture2D>("ItemIcons/" + itemName) ? Resources.Load<Texture2D>("ItemIcons/" + itemName) : Resources.Load<Texture2D>("ItemIcons/" + "DefaultIcon");
            // itemPrefab = _itemPrefab;
            category = InventoryCategory.Weapon;
            itemPrice = _itemPrice;


        }
예제 #29
0
    void SetUpChaEquipment(EquipmentType type)
    {
        readyToEquipedImg.overrideSprite = null;
        readyToEquipedNameText.text      = "";
        equipedStatText.text             = "";

        myEquip = null;
        if (type == EquipmentType.Weapon && selectedCha.saved.characterData.EquipedWeapon != null)
        {
            myEquip = PF_PlayerData.inventoryByCategory[selectedCha.saved.characterData.EquipedWeapon.EquipmentName];
        }
        else if (type == EquipmentType.Armor && selectedCha.saved.characterData.EquipedArmor != null)
        {
            myEquip = PF_PlayerData.inventoryByCategory[selectedCha.saved.characterData.EquipedArmor.EquipmentName];

            //foreach (var st in selectedCha.saved.characterData.EquipedArmor.stat)
            //{
            //    if (st.Key.Contains("icon"))
            //        continue;
            //    equipedStatText.text += string.Format("{0} : {1} \n", st.Key, st.Value);

            //}
        }
        else if (type == EquipmentType.Jewelry && selectedCha.saved.characterData.EquipedJewelry != null)
        {
            myEquip = PF_PlayerData.inventoryByCategory[selectedCha.saved.characterData.EquipedJewelry.EquipmentName];

            //foreach (var st in selectedCha.saved.characterData.EquipedJewelry.stat)
            //{
            //    if (st.Key.Contains("icon"))
            //        continue;
            //    equipedStatText.text += string.Format("{0} : {1} \n", st.Key, st.Value);
            //}
        }
        else
        {
            equipedNameText.text = "null";
            return;
        }

        equipedImg.overrideSprite = myEquip.icon;
        equipedNameText.text      = myEquip.catalogRef.DisplayName;

        foreach (var st in myEquip.customData)
        {
            if (st.Key.Contains("icon"))
            {
                continue;
            }
            equipedStatText.text += string.Format("{0} : {1} \n", st.Key, st.Value);
        }
    }
예제 #30
0
 public bool Update(InventoryCategory obj)
 {
     try
     {
         _db.SubmitChanges();
     }
     catch (Exception ex)
     {
         Debug.Print(ex.Message);
         return(false);
     }
     return(true);
 }
        //>>>for Category full path<<<

        internal string GetCategoryFullPathById(int id)
        {
            string            categoryFullPath = "";
            Inventory         item             = _itemDal.GetById(id);
            InventoryCategory itemCategory     = _itemCategoryDal.GetById(item.ItemCategoryId);

            categoryFullPath = itemCategory.Name;
            //if (itemCategory.ParentId != null)
            //{
            //    categoryFullPath = categoryFullPath + "," + GetCategoryParent(itemCategory.ParentId);
            //}
            return(categoryFullPath);
        }
예제 #32
0
        public InventoryCategory category;// = InventoryCategory.None;
 

        public InventoryItem (string _itemName, int _itemID, string _itemDescription, GameObject _itemPrefab, InventoryCategory _category, float _itemPrice)
        {
            itemName = _itemName;
            itemID = _itemID;
            itemDescription = _itemDescription;
            string filename = _itemName.Replace(" ", "") + "Icon";
            Debug.Log(filename);
            itemIcon = Resources.Load<Texture2D>("ItemIcons/" + filename) ? Resources.Load<Texture2D>("ItemIcons/" + filename): Resources.Load<Texture2D>("ItemIcons/" + "DefaultIcon");
            itemPrefab =_itemPrefab;
            category = _category;
            itemPrice = _itemPrice;


        }
예제 #33
0
        private InventoryPurchase ReaderToReadInventoryPurchase(IDataReader aReader)
        {
            InventoryPurchase aInventoryPurchase = new InventoryPurchase();
               InventoryCategory aCategory=new InventoryCategory();
               InventoryItem aItem=new InventoryItem();
               Supplier aSupplier=new Supplier();
               Unit aUnit = new Unit();
               CUserInfo aCUserInfo=new CUserInfo();

               try
               {
               aCategory.CategoryId = Convert.ToInt32(aReader["category_id"]);

               }
               catch
               {

               }
               try
               {

               aCategory.CategoryName = aReader["category_name"].ToString();
               }
               catch
               {
               }

               try
               {
              aItem.ItemId = Convert.ToInt32(aReader["item_id"]);

               }
               catch
               {

               }
               try
               {
               aItem.ItemName = (aReader["item_name"]).ToString();

               }
               catch
               {

               }
               try
               {
               aSupplier.SupplierId = Convert.ToInt32(aReader["supplier_id"]);

               }
               catch
               {

               }
               try
               {
               aSupplier.Name =(aReader["supplier_name"]).ToString();

               }
               catch
               {

               }
               try
               {
               aInventoryPurchase.PurchaseId = Convert.ToInt32((aReader["purchase_id"]));

               }
               catch
               {

               }

               try
               {
               aInventoryPurchase.Quantity = Convert.ToDouble((aReader["quantity"]));

               }
               catch
               {
               }
               try
               {
              aUnit.UnitName = (aReader["unit"]).ToString();

               }
               catch
               {
               }

               try
               {
               aInventoryPurchase.Price = Convert.ToDouble((aReader["total_price"]));

               }
               catch
               {
               }
               try
               {
               aSupplier.PaidAmount = Convert.ToDouble((aReader["paid_amount"]));

               }
               catch
               {

               }
               try
               {
               aSupplier.AdvanceAmount = Convert.ToDouble((aReader["advance_amount"]));

               }
               catch
               {

               }
               try
               {
               aSupplier.DueAmount = Convert.ToDouble((aReader["due_amount"]));

               }
               catch
               {

               }
               try
               {
               aInventoryPurchase.Date = Convert.ToDateTime((aReader["date"]));

               }
               catch
               {
               }
               try
               {
               aInventoryPurchase.PaymentType = ((aReader["payment_type"])).ToString();

               }
               catch
               {
               }

               try
               {
               aCUserInfo.UserName = ((aReader["user_name"])).ToString();

               }
               catch
               {
               }

               try
               {
               aInventoryPurchase.ExpireDate = Convert.ToDateTime((aReader["ExpireDate"]));

               }
               catch
               {
               }

               aInventoryPurchase.Category = aCategory;
               aInventoryPurchase.Item = aItem;
               aInventoryPurchase.Supplier = aSupplier;
               aInventoryPurchase.Unit = aUnit;
               aInventoryPurchase.CUserInfo = aCUserInfo;

               return aInventoryPurchase;

              // DateTime aTime = DateTime.Now.AddDays(-1);
        }
예제 #34
0
 public string InsertInventoryCategory(InventoryCategory aCategory)
 {
     InventoryCategoryDAO aDao=new InventoryCategoryDAO();
        string sr = aDao.InsertInventoryCategory(aCategory);
        return sr;
 }
예제 #35
0
 public bool TryGetIndex(InventoryCategory category, out uint index)
 {
     return _inventoryIndexMap.TryGetValue(InventoryKeys[category], out index);
 }
예제 #36
0
        /// <summary>
        /// Gets the price multiplier for a particular category of item.
        /// The base price is multiplied by a value which depends on the category of the item (and whether the vendor would be interested), as well as the level of the vendor in question 
        /// Generally it's better to buy from specific big vendors and sell to specific small ones
        /// </summary>
        /// <param name="category"></param>
        /// <param name="vendorIsBuying"></param>
        /// <returns></returns>
        public double GetPriceMultiplier(InventoryCategory category, bool vendorIsBuying)
        {
            if (this.VendorType == DRObjects.Enums.VendorType.GENERAL)
            {
                //Everything is at a markup, regardless of the type. Later food won't be
                double multiplier = 1;

                if (vendorIsBuying)
                {
                    multiplier = 0.50;
                }
                else
                {
                    switch (this.VendorLevel)
                    {
                        case 1:
                            multiplier = 1.50;
                            break;
                        case 2:
                            multiplier = 1.40; break;
                        case 3:
                            multiplier = 1.30;
                            break;
                    }
                }

                return multiplier;
            }
            else if (this.VendorType == DRObjects.Enums.VendorType.TAVERN)
            {
                double multiplier = 1;

                if (vendorIsBuying && category != InventoryCategory.SUPPLY)
                {
                    multiplier = 0.5;
                }
                else if (vendorIsBuying)
                {
                    multiplier = 0.75;
                }
                else
                {
                    switch (this.VendorLevel)
                    {
                        case 1:
                            multiplier = 1.50;
                            break;
                        case 2:
                            multiplier = 1.40; break;
                        case 3:
                            multiplier = 1.30;
                            break;
                    }
                }

                return multiplier;
            }
            else if (this.VendorType == DRObjects.Enums.VendorType.TRADER)
            {
                //Will buy loot at best price
                double multiplier = 1;

                if (vendorIsBuying)
                {
                    if (category == InventoryCategory.LOOT)
                    {
                        multiplier = 1;
                    }
                    else
                    {
                        multiplier = 0.50;
                    }
                }
                else
                {
                    if (category == InventoryCategory.LOOT)
                    {
                        switch (this.VendorLevel)
                        {
                            case 1:
                                multiplier = 1.20;
                                break;
                            case 2:
                                multiplier = 1.10; break;
                            case 3:
                                multiplier = 1.00;
                                break;
                        }
                    }
                    else
                    {
                        switch (this.VendorLevel)
                        {
                            case 1:
                                multiplier = 1.50;
                                break;
                            case 2:
                                multiplier = 1.40; break;
                            case 3:
                                multiplier = 1.30;
                                break;
                        }
                    }
                }

                return multiplier;
            }
            else if (this.VendorType == DRObjects.Enums.VendorType.SMITH)
            {
                //Will buy weapons and armour at best price
                double multiplier = 1;

                if (vendorIsBuying)
                {
                    if (category == InventoryCategory.WEAPON || category == InventoryCategory.ARMOUR)
                    {
                        multiplier = 0.8;
                    }
                    else
                    {
                        multiplier = 0.50;
                    }
                }
                else
                {
                    if (category == InventoryCategory.WEAPON || category == InventoryCategory.ARMOUR)
                    {
                        switch (this.VendorLevel)
                        {
                            case 1:
                                multiplier = 1.20;
                                break;
                            case 2:
                                multiplier = 1.10; break;
                            case 3:
                                multiplier = 1.00;
                                break;
                        }
                    }
                    else
                    {
                        switch (this.VendorLevel)
                        {
                            case 1:
                                multiplier = 1.50;
                                break;
                            case 2:
                                multiplier = 1.40; break;
                            case 3:
                                multiplier = 1.30;
                                break;
                        }
                    }
                }

                return multiplier;
            }
            else
            {
                throw new NotImplementedException("No code for vendor of type " + VendorType);
            }
        }
예제 #37
0
        private void savePurchasebutton_Click(object sender, EventArgs e)
        {
            try
            {

                if (expiredateTimePicker.Value.Date == DateTime.Now.Date)
                {
                    DialogResult result = MessageBox.Show("Do you want to Empty Expire Date?", "Confirmation",
                                                          MessageBoxButtons.YesNo);
                    if (result == DialogResult.Yes)
                    {

                    }
                    else if (result == DialogResult.No)
                    {
                        return;
                    }

                }

                if (pricetextBox.Text.Length != 0 && paidPricetextBox.Text.Length != 0 && quantitytextBox.Text.Length != 0)
                {
                    InventoryPurchase aInventoryPurchase = new InventoryPurchase();
                    InventoryCategory aCategory = new InventoryCategory();
                    InventoryItem aItem = new InventoryItem();
                    Supplier aSupplier = new Supplier();
                    Supplier aaSupplier = new Supplier();
                    Unit aUnit = new Unit();

                    //Add for purchase record
                    aCategory = (InventoryCategory) categoryNamecomboBox.Items[categoryNamecomboBox.SelectedIndex];

                    SupplierBLL aSupplierBll = new SupplierBLL();
                    aSupplier = aSupplierBll.GetSupplierByid(Convert.ToInt32(supplierNamecomboBox.SelectedValue));
                   // aSupplier = (Supplier) supplierNamecomboBox.Items[supplierNamecomboBox.SelectedIndex];
                    if (aSupplier.PaidAmount > aSupplier.TotalAmount)
                    {
                        aSupplier.AdvanceAmount = aSupplier.PaidAmount - aSupplier.TotalAmount;
                    }
                    else aSupplier.DueAmount = aSupplier.TotalAmount - aSupplier.PaidAmount;

                    aItem = (InventoryItem) itemNamecomboBox.Items[itemNamecomboBox.SelectedIndex];
                    aInventoryPurchase.Quantity = Convert.ToDouble(quantitytextBox.Text);
                    aInventoryPurchase.Price = Convert.ToDouble(pricetextBox.Text);
                    aInventoryPurchase.Date = DateTime.Now;
                    aInventoryPurchase.Category = aCategory;
                    aInventoryPurchase.Item = aItem;
                    aaSupplier.PaidAmount = Convert.ToDouble(paidPricetextBox.Text);
                    aInventoryPurchase.Supplier = aaSupplier;
                    if (((aSupplier.DueAmount + Convert.ToDouble(pricetextBox.Text) -
                          (Convert.ToDouble(paidPricetextBox.Text) + aSupplier.AdvanceAmount))) >= 0)
                        aInventoryPurchase.Supplier.DueAmount = aSupplier.DueAmount +
                                                                Convert.ToDouble(pricetextBox.Text) -
                                                                (Convert.ToDouble(paidPricetextBox.Text) +
                                                                 aSupplier.AdvanceAmount);
                    else aInventoryPurchase.Supplier.DueAmount = 0.0;
                    if (((Convert.ToDouble(paidPricetextBox.Text) + aSupplier.AdvanceAmount) -
                         (aSupplier.DueAmount + Convert.ToDouble(pricetextBox.Text))) >= 0)
                    {
                        aInventoryPurchase.Supplier.AdvanceAmount = (Convert.ToDouble(paidPricetextBox.Text) +
                                                                     aSupplier.AdvanceAmount) -
                                                                    (aSupplier.DueAmount +
                                                                     Convert.ToDouble(pricetextBox.Text));
                    }
                    else aInventoryPurchase.Supplier.AdvanceAmount = 0.0;
                    aInventoryPurchase.Supplier.Name = aSupplier.Name;
                    aInventoryPurchase.Supplier.SupplierId = aSupplier.SupplierId;
                    aUnit.UnitName = unittypelabel.Text;
                    aInventoryPurchase.Unit = aUnit;
                    CUserInfo aUserInfo= new CUserInfo();
                    aUserInfo.UserName= RMSGlobal.LogInUserName;
                    aInventoryPurchase.PaymentType= paymentTypecomboBox.SelectedItem.ToString();
                    aInventoryPurchase.CUserInfo= aUserInfo;
                    if (expiredateTimePicker.Value.Date == DateTime.Now.Date)
                    {

                    }
                    else
                    {
                        aInventoryPurchase.ExpireDate = expiredateTimePicker.Value.Date;
                    }

                    string res = string.Empty;

                    InventoryPurchaseBLL aInventoryPurchaseBll = new InventoryPurchaseBLL();
                    res = aInventoryPurchaseBll.InsertPurchase(aInventoryPurchase);

                    if(res=="Purchase Insert Sucessfully")
                    {
                        //Add for Supplier Update
                        aSupplier.TotalAmount += Convert.ToDouble(pricetextBox.Text);
                        aSupplier.PaidAmount += Convert.ToDouble(paidPricetextBox.Text);

                        aSupplierBll.UpdateSupplierForPurchase(aSupplier);

                        //Add for Supplier payment report
                        Supplier paymentSupplier=new Supplier();
                        paymentSupplier.PaidAmount = Convert.ToDouble(paidPricetextBox.Text);
                        paymentSupplier.TotalAmount = Convert.ToDouble(pricetextBox.Text);
                        paymentSupplier.SupplierId = aSupplier.SupplierId;
                        paymentSupplier.PaymentType = paymentTypecomboBox.SelectedItem.ToString();
                        aSupplierBll.InsertIntosupplier_payment_reportForSupplierPaymentTrack(paymentSupplier);

                        //Add for stock update
                        Stock aStock=new Stock();
                        aStock.Category = aCategory;
                        aStock.Item = aItem;
                        aStock.Unit = aUnit;
                        aStock.Stocks = Convert.ToDouble(quantitytextBox.Text);
                        aStock.UnitPrice = Convert.ToDouble(pricetextBox.Text)/aStock.Stocks;
                        StockBLL aStockBll=new StockBLL();
                        aStockBll.InsertStockOrUpdate(aStock);

                        purchaseActionlabel.Visible = true;
                        purchaseActionlabel.Text = res;
                        Clear();
                    }else
                    {
                        purchaseActionlabel.Visible = true;
                        purchaseActionlabel.Text = res;
                    }

                }else
                {
                    purchaseActionlabel.Visible = true;
                    purchaseActionlabel.Text = "Please Check Your Input";
                }

            }
            catch
            {
                MessageBox.Show("Try Again May Be Your Given Input Format Not Correct Please Given Again ");

            }
        }
예제 #38
0
        private void TransactionWhenProfessionalPackageIsActive()
        {
            InventoryItem aItem = new InventoryItem();
            aItem = (InventoryItem)itemNamecomboBox.SelectedItem;
            InventoryCategory aInventoryCategory = new InventoryCategory();
            aInventoryCategory = (InventoryCategory)categoryNamecomboBox.SelectedItem;

            Stock aStock = new Stock();
            StockBLL aStockBll = new StockBLL();
            string transactiontype = transactionTypecomboBox.SelectedItem.ToString();
            Transaction aTransaction = new Transaction();
            aTransaction.TransactionDate = DateTime.Now;
            aTransaction.Item = aItem;
            aTransaction.Category = aInventoryCategory;
            aTransaction.TransactionType = transactiontype;
            CUserInfo aUserInfo = new CUserInfo();
            aUserInfo.UserName = RMSGlobal.LogInUserName;
            aTransaction.UserInfo = aUserInfo;
            string sr = string.Empty;
            if (transactiontype == "Damage_in_Stock")
            {
                if (danmagetextBox.Text.Length > 0)
                {
                    aStock = aStockBll.GetStockByItemid(aItem.ItemId);

                    if ((aStock.Stocks >= Convert.ToDouble(quantitytextBox.Text)) &&
                        (Convert.ToDouble(quantitytextBox.Text) != 0))
                    {
                        aStock.Stocks = Convert.ToDouble(quantitytextBox.Text);
                        aStock.Item = aItem;
                        aStock.Category = aInventoryCategory;
                        aTransaction.Stock = aStock;
                        aTransaction.DamageReport = danmagetextBox.Text.Replace("'", "''");

                        TransactionBLL aBll = new TransactionBLL();
                        sr = aBll.DamageInStock(aTransaction);
                        ShowAndClear(sr);
                    }
                    else
                        MessageBox.Show("Your Quantity Must be Greater than 0 and  less than or equal to  " + aStock.Stocks + " " +
                                        unittypelabel.Text);
                }
                else MessageBox.Show("Please Check Your Damage Report Field It's Never Empty");
            }

            if (transactiontype == "Send_to_Kitchen")
            {
                aStock = aStockBll.GetStockByItemid(aItem.ItemId);

                if ((aStock.Stocks >= Convert.ToDouble(quantitytextBox.Text)) && (Convert.ToDouble(quantitytextBox.Text) != 0))
                {
                    aStock.Stocks = Convert.ToDouble(quantitytextBox.Text);
                    aStock.Item = aItem;
                    aStock.Category = aInventoryCategory;
                    aTransaction.Stock = aStock;
                    TransactionBLL aBll = new TransactionBLL();
                    sr = aBll.SendToKitchen(aTransaction);
                    ShowAndClear(sr);
                }
                else MessageBox.Show("Your Quantity Must be Greater than 0 and  less than or equal to " + aStock.Stocks + " " + unittypelabel.Text);
            }

            //aStock = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem);
            if (transactiontype == "Return_from_Kitchen")
            {
                aStock = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem);

                if ((aStock.Stocks >= Convert.ToDouble(quantitytextBox.Text)) && (Convert.ToDouble(quantitytextBox.Text) != 0))
                {
                    aStock.Stocks = Convert.ToDouble(quantitytextBox.Text);
                    aStock.Item = aItem;
                    aStock.Category = aInventoryCategory;
                    aTransaction.Stock = aStock;
                    TransactionBLL aBll = new TransactionBLL();
                    sr = aBll.ReturnFromKitchen(aTransaction);
                    ShowAndClear(sr);
                }
                else MessageBox.Show("Your Quantity Must be Greater than 0 and  less than or equal to " + aStock.Stocks + " " + unittypelabel.Text);
            }

            if (transactiontype == "Damage_in_kitchen")
            {
                if (danmagetextBox.Text.Length > 0)
                {
                    aStock = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem);

                    if ((aStock.Stocks >= Convert.ToDouble(quantitytextBox.Text)) &&
                        (Convert.ToDouble(quantitytextBox.Text) != 0))
                    {
                        aStock.Stocks = Convert.ToDouble(quantitytextBox.Text);
                        aStock.Item = aItem;
                        aStock.Category = aInventoryCategory;
                        aTransaction.Stock = aStock;
                        aTransaction.DamageReport = danmagetextBox.Text.Replace("'", "''");

                        TransactionBLL aBll = new TransactionBLL();
                        sr = aBll.DamageInKitchen(aTransaction);
                        ShowAndClear(sr);
                    }
                    else
                        MessageBox.Show("Your Quantity Must be Greater than 0 and  less than or equal to  " + aStock.Stocks + " " +
                                        unittypelabel.Text);
                }
                else MessageBox.Show("Please Check Your Damage Report Field It's Never Empty");
            }

            if (transactiontype == "Stock_Out_In_Kitchen")
            {
                if (danmagetextBox.Text.Length > 0)
                {
                    aStock = aStockBll.GetStockByItemidFrominventory_kitchen_stock(aItem);

                    if ((aStock.Stocks >= Convert.ToDouble(quantitytextBox.Text)) &&
                        (Convert.ToDouble(quantitytextBox.Text) != 0))
                    {
                        aStock.Stocks = Convert.ToDouble(quantitytextBox.Text);
                        aStock.Item = aItem;
                        aStock.Category = aInventoryCategory;
                        aTransaction.Stock = aStock;
                        aTransaction.DamageReport = danmagetextBox.Text.Replace("'", "''");

                        TransactionBLL aBll = new TransactionBLL();
                        sr = aBll.SendOutInKitchen(aTransaction);

                        StockDAO aStockDao=new StockDAO();
                        aStockDao.InsertOrUpdateSaleRawmaterialsReport(aTransaction.Item.ItemId, Convert.ToDouble(quantitytextBox.Text),aStock.UnitPrice);
                        ShowAndClear(sr);
                    }
                    else
                        MessageBox.Show("Your Quantity Must be Greater than 0 and  less than or equal to  " + aStock.Stocks + " " +
                                        unittypelabel.Text);
                }
                else MessageBox.Show("Please Check Your Damage Report Field It's Never Empty");
            }
        }
예제 #39
0
        private Transaction ReaderToReadInventoryTransaction(IDataReader aReader)
        {
            Transaction aTransaction=new Transaction();
               InventoryCategory aCategory = new InventoryCategory();
               InventoryItem aItem = new InventoryItem();
               Unit aUnit = new Unit();
               CUserInfo aCUserInfo = new CUserInfo();
               Stock aStock = new Stock();

               try
               {
               aTransaction.TransactionId = Convert.ToInt32(aReader["transaction_id"]);

               }
               catch
               {

               }

               try
               {
               aTransaction.TransactionType = (aReader["transaction_type"]).ToString();

               }
               catch
               {

               }
               try
               {
               aTransaction.TransactionDate = Convert.ToDateTime((aReader["date"]));

               }
               catch
               {

               }

               try
               {
               aTransaction.TransactionAmount = Convert.ToDouble(aReader["total_price"]);

               }
               catch
               {

               }
               try
               {
               aTransaction.DamageReport = (aReader["damage_report"]).ToString();

               }
               catch
               {

               }

               try
               {
               aCategory.CategoryId = Convert.ToInt32(aReader["category_id"]);

               }
               catch
               {

               }
               try
               {

               aCategory.CategoryName = aReader["category_name"].ToString();
               }
               catch
               {
               }

               try
               {
               aItem.ItemId = Convert.ToInt32(aReader["item_id"]);

               }
               catch
               {

               }
               try
               {
               aItem.ItemName = (aReader["item_name"]).ToString();

               }
               catch
               {

               }

               try
               {
               aUnit.UnitName = (aReader["unit"]).ToString();

               }
               catch
               {
               }
               try
               {
               aCUserInfo.UserName = ((aReader["user_name"])).ToString();

               }
               catch
               {
               }

               try
               {
               aCUserInfo.UserName = ((aReader["user_name"])).ToString();

               }
               catch
               {
               }
               try
               {
               aStock.Stocks = Convert.ToDouble(aReader["quantity"]);

               }
               catch
               {
               }
               try
               {
               aStock.UnitPrice = Convert.ToDouble(aReader["unit_price"]);

               }
               catch
               {
               }

               aTransaction.Category = aCategory;
               aTransaction.Item = aItem;
               aTransaction.Unit = aUnit;
               aTransaction.UserInfo = aCUserInfo;
               aTransaction.Stock = aStock;
               return aTransaction;
        }
예제 #40
0
        /// <summary>
        /// Fills a treasure chest as follows:
        /// 1. Pick a random category. Produce an item of that category costing between 1/5 and 3/3 of the remaining value
        /// 2. Repeat 1 for 6 more times
        /// 3. Done
        /// </summary>
        /// <param name="categories"></param>
        /// <param name="spendValue"></param>
        /// <returns></returns>
        public List<InventoryItem> FillTreasureChest(InventoryCategory[] categories,int spendValue)
        {
            List<InventoryItem> items = new List<InventoryItem>();

            for (int i = 0; i < 7; i++)
            {
                InventoryCategory cat = categories.GetRandom();

                var item = GetItemWithinPriceRange(cat.ToString(), spendValue / 5, spendValue);

                if (item != null)
                {
                    spendValue -= item.BaseValue;
                    item.InInventory = true; //to get the proper description

                    items.Add(item);
                }

            }

            return items;
        }