Esempio n. 1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                if (ViewState["items"] == null)
                {
                    items = new List <CartItem>();
                    ViewState["items"]    = items;
                    gvReqItems.DataSource = items;
                    gvReqItems.DataBind();
                }
                lblReqNum.Text               = requisitionNum = "DDS/" + DateTime.Now.Month + "/" + DateTime.Now.ToString("HHmm");
                itemDao                      = new ItemDao();
                DdlCategories.DataSource     = reqController.GetCategories();
                DdlCategories.DataValueField = "CategoryID";
                DdlCategories.DataTextField  = "CategoryCode";
                DdlCategories.DataBind();
            }


            if (ViewState["items"] != null)
            {
                items = (List <CartItem>)ViewState["items"];
                for (int i = 0; i < items.Count; i++)
                {
                    GridViewRow row    = gvReqItems.Rows[i];
                    string      amount = ((TextBox)row.FindControl("tbQuantity")).Text;
                    items[i].Quantity = (amount != null || !amount.Equals("")) ? Convert.ToInt32(amount) : items[i].Quantity;
                }
                ViewState["items"] = items;
            }
        }
Esempio n. 2
0
        public UnitOfWork(IDbConnection connection)
        {
            _connection = connection;

            StoredProcedures          = new StoredProcedures(connection);
            Brands                    = new BrandDao(connection);
            Carts                     = new CartDao(connection);
            Categories                = new CategoryDao(connection);
            CategoryProducts          = new CategoryProductDao(connection);
            ContactInfo               = new ContactInfoDao(connection);
            Characteristics           = new CharacteristicDao(connection);
            CharacteristicProducts    = new CharacteristicProductDao(connection);
            FavouriteProducts         = new FavouriteProductDao(connection);
            Items                     = new ItemDao(connection);
            OptionalParameters        = new OptionalParameterDao(connection);
            OptionalParameterProducts = new OptionalParameterProductDao(connection);
            Orders                    = new OrderDao(connection);
            OrderDeliveryTypes        = new OrderDeliveryTypeDao(connection);
            OrderPaymentTypes         = new OrderPaymentTypeDao(connection);
            OrderProducts             = new OrderProductDao(connection);
            OrderStatuses             = new OrderStatusDao(connection);
            Products                  = new ProductDao(connection);
            ProductImages             = new ProductImageDao(connection);
            Roles                     = new RoleDao(connection);
            SupportMessages           = new SupportMessageDao(connection);
            Users                     = new UserDao(connection);
        }
Esempio n. 3
0
        public IActionResult Index(SearchVM model)
        {
            ItemDao item = new ItemDao(_context);

            if (CheckRequest(model) == 0) // kiem tra hop le
            {
                return(RedirectToAction(nameof(NotFound)));
            }
            model.TenNoiDi     = _context.DiaDiem.Where(x => x.id_DiaDiem == model.NoiDi).Select(x => x.TenDiaDiem).SingleOrDefault();
            model.TenNoiDen    = _context.DiaDiem.Where(x => x.id_DiaDiem == model.NoiDen).Select(x => x.TenDiaDiem).SingleOrDefault();
            model.TenHangVe    = _context.HangVe.Where(x => x.id_HangVe == model.HangVe).Select(x => x.TenHangVe).SingleOrDefault();
            model.TenSanBayDi  = _context.SanBay.Include(d => d.DiaDiem).Where(d => d.id_DiaDiem == model.NoiDi).Select(d => d.TenSanBay).FirstOrDefault();
            model.TenSanBayDen = _context.SanBay.Include(d => d.DiaDiem).Where(d => d.id_DiaDiem == model.NoiDen).Select(d => d.TenSanBay).FirstOrDefault();
            model.MaSanBayDi   = _context.SanBay.Include(d => d.DiaDiem).Where(d => d.id_DiaDiem == model.NoiDen).Select(d => d.MaSanBay).FirstOrDefault();
            model.MaSanBayDen  = _context.SanBay.Include(d => d.DiaDiem).Where(d => d.id_DiaDiem == model.NoiDen).Select(d => d.MaSanBay).FirstOrDefault();

            CustomSessionExtensions.SetObject(HttpContext.Session, SessionManager.Request, model);
            if (CheckRequest(model) == 1)
            {
                return(RedirectToAction("OneWaySearch", "Flight", model));
            }
            else
            {
                return(RedirectToAction("RoundTripSearch", "Flight", model));
            }
        }
Esempio n. 4
0
 public void CreateItem(Item item, User currentUser)
 {
     Connect();
     item.User = currentUser.ID;
     ItemDao.create(MyConnection.Instance, item);
     CloseConnect();
 }
Esempio n. 5
0
        private void btnExcluirItem_Click(object sender, EventArgs e)
        {
            int codigoItem = 0;

            DialogResult result = MessageBox.Show("Deseja realmente excluir o Item?",
                                                  "Confirma exclusão ", MessageBoxButtons.YesNo,
                                                  MessageBoxIcon.Question);

            if (result == DialogResult.Yes)
            {
                foreach (DataGridViewRow row in dtgridConsultaItem.SelectedRows)
                {
                    int codigoItemSelecionado = Convert.ToInt32(row.Cells["CodigoItem"].Value);
                    codigoItem = codigoItemSelecionado;
                }

                ItemDao.ExcluirItem(codigoItem);
                MessageBox.Show("Item excluido com sucesso.");

                IList <IItemEntity> itens = ItemDao.ConsultarItem(txtConsultaItem.Text);
                dtgridConsultaItem.Rows.Clear();

                int rowId = 0;
                foreach (IItemEntity Item in itens)
                {
                    rowId = dtgridConsultaItem.Rows.AddCopy(0);
                    dtgridConsultaItem.Rows[rowId].Cells["CodigoItem"].Value    = Item.IdItem;
                    dtgridConsultaItem.Rows[rowId].Cells["Nome"].Value          = Item.Nome;
                    dtgridConsultaItem.Rows[rowId].Cells["DescricaoItem"].Value = Item.DescricaoItem;
                    dtgridConsultaItem.Rows[rowId].Cells["TipoItem"].Value      = Item.TipoItem.Descricao;
                    dtgridConsultaItem.Rows[rowId].Cells["Deposito"].Value      = Item.deposito.DescricaoDeposito;
                }
            }
        }
Esempio n. 6
0
 private void gridView1_RowUpdated(object sender, DevExpress.XtraGrid.Views.Base.RowObjectEventArgs e)
 {
     try
     {
         DataTable Tmp = (DataTable)(grdItem.DataSource);
         for (int i = 0; i < Tmp.Rows.Count; i++)
         {
             DataRow dr = Tmp.Rows[i];
             if (isModifedRow(dr))
             {
                 ItemDao.Update(_ConfigItem, dr);
             }
             if (isNewRow(dr))
             {
                 ItemDao.Insert(_ConfigItem, dr);
             }
             if (isDeletedRow(dr))
             {
                 ItemDao.Delete(_ConfigItem, (int)GetOriginalItemData(dr, "Id"));
             }
         }
         Initdata(l_Str_Item, 0);
     }
     catch (Exception ex)
     {
         AppDebug(ex);
         ShowMessageBox("ITEM_I_003", COREBASE.COMMAND.MessageUtils.MessageType.ERROR);
     }
 }
        public ActionResult MakeAdjustments()
        {
            Dictionary <string, List <Item> > items = ItemDao.getItemsForRequisition();

            ViewData["Items"] = items;
            return(View("MakeAdjustment"));
        }
        public void StopSupplyItem(List <Item> itemList)
        {
            try
            {
                //save record to database

                ItemDao.StopSupplyItem(itemList);
                List <RequestHandleInfo> requestList = new List <RequestHandleInfo>();
                foreach (Item item in itemList)
                {
                    RequestHandleInfo info = new RequestHandleInfo();
                    info.RequestType = RequestType.DeorderItem;
                    info.SourceId    = item.Id;
                    requestList.Add(info);
                }
                //HandleEventHandler(StopSupplyItemEvent, new HandleEventArgs("stop supply item", requestList));
            }
            catch (HCSMSException ex)
            {
                raiseError(ex);
                throw new FaultException <HCSMSException>(ex);
            }
            catch (Exception ex)
            {
                raiseError(ex);
            }
        }
Esempio n. 9
0
        public ActionResult Index()
        {
            Dictionary <string, List <Item> > items = ItemDao.getItemsForRequisition();

            ViewData["Items"] = items;
            return(View());
        }
Esempio n. 10
0
        private void AlterarItem_Load(object sender, EventArgs e)
        {
            //Lista depositos
            cbDeposito.DisplayMember = "TextoExibicao";
            cbDeposito.ValueMember   = "IdDeposito";

            IList <IDepositoEntity> lstDepositos = DepositoDao.RetornarDepositos();

            foreach (IDepositoEntity deposito in lstDepositos)
            {
                cbDeposito.Items.Add(deposito);
            }

            //Lista tipo itens
            cbTipoItem.DisplayMember = "TextoExibicao";
            cbTipoItem.ValueMember   = "IdTipoItem";

            IList <ITipoItemEntity> lstTipoItens = TipoItemDao.RetornarTipoItem();

            foreach (ITipoItemEntity tipoitem in lstTipoItens)
            {
                cbTipoItem.Items.Add(tipoitem);
            }

            //Preenche todos os campos
            IList <IItemEntity> itens = ItemDao.ConsultarById(this.CodigoItem);

            foreach (IItemEntity item in itens)
            {
                txtNomeItem.Text      = item.Nome.ToString();
                txtDescricaoItem.Text = item.DescricaoItem.ToString();
                cbTipoItem.Text       = item.TipoItem.TextoExibicao.ToString();
                cbDeposito.Text       = item.deposito.TextoExibicao.ToString();
            }
        }
Esempio n. 11
0
        private static void TestRelations()
        {
            IDataParameter parameter = new SqlParameter("@ItemID", 3);

            ItemRelationshipsDto dto = ItemDao.GetRelations(parameter);

            Console.WriteLine($"Here is the relationships for: {Environment.NewLine + Environment.NewLine} {dto.Item.Name} {Environment.NewLine + Environment.NewLine}");

            foreach (IItemRelation relation in dto.Relations)
            {
                if (relation.ItemOneId == dto.Item.Id)
                {
                    IItem relatedItem = dto.Items.FirstOrDefault(item => item.Id == relation.ItemTwoId);

                    Console.WriteLine($"{dto.Item.Name} has a downstream dependency to {relatedItem.Name}.");
                }
                else
                {
                    IItem relatedItem = dto.Items.FirstOrDefault(item => item.Id == relation.ItemOneId);

                    Console.WriteLine($"{dto.Item.Name} has a upstream dependency to {relatedItem.Name}.");
                }
            }

            Console.Read();
        }
Esempio n. 12
0
        public void Handle(Player player, Request request)
        {
            int itemId = request.ReadInt();

            if (player.RoomUser.Room == null)
            {
                return;
            }

            Room room = player.RoomUser.Room;

            if (room == null)
            {
                return;
            }

            Item item = room.ItemManager.GetItem(itemId);

            if (item == null && item.Data.OwnerId != player.Details.Id && !room.IsOwner(player.Details.Id)) // TODO: Staff check
            {
                return;
            }

            room.FurnitureManager.RemoveItem(item, player);

            ItemDao.DeleteItem(item.Data);
        }
Esempio n. 13
0
        public List <Item> getUserItems(User user)
        {
            Connect();
            List <Item> Items = ItemDao.getUserItems(MyConnection.Instance, user).Cast <Item>().ToList();

            CloseConnect();
            return(Items);
        }
        /// <summary>
        /// Service that returns all items in the table to consumer
        /// </summary>
        /// <returns>List of items in DB</returns>
        List <Item> IGetItems.GetItems()
        {
            //Getting items from table through dao, then returning it to consumer
            var itemDao = new ItemDao(Properties.Settings.Default.conString);
            var items   = itemDao.GetItems();

            return(items);
        }
Esempio n. 15
0
        public ActionResult GetTrendPage()
        {
            List <string> categories = ItemDao.GetCategoryNames();

            ViewData["Categories"] = categories;

            return(View("Chart"));
        }
Esempio n. 16
0
        public IItem Get(int itemId)
        {
            IDbDataParameter itemParameter = new SqlParameter("@ItemID", SqlDbType.VarChar)
            {
                Value = itemId
            };

            return(ItemDao.Get(itemParameter));
        }
Esempio n. 17
0
        public ItemRelationshipsDto GetItemRelations(int itemId)
        {
            IDbDataParameter itemParameter = new SqlParameter("@ItemID", SqlDbType.VarChar)
            {
                Value = itemId
            };

            return(ItemDao.GetRelations(itemParameter));
        }
        public AdjustmentVoucherManagerController()
        {
            LogicUniStoreModel db = new LogicUniStoreModel();

            adj  = new AdjustmentItemDao();
            adao = new AdjustmentDao(db);
            idao = new ItemDao();
            sdao = new StockCardDao();
        }
Esempio n. 19
0
 public ActionResult delete(int cod_item)
 {
     if (verifica_acesso("Itens", "Deletar"))
     {
         ItemDao _ItemDao = new ItemDao();
         return(Json(_ItemDao.delete(cod_item)));
     }
     return(Json("Acesso não permitido"));
 }
Esempio n. 20
0
 public ItemManagerImpl(ItemManager itemManager)
 {
     itemDao             = ItemDao.getInstance();
     categoryManagerImpl = new CategoryManagerImpl();
     companyManagerImpl  = new CompanyManagerImpl();
     unitManagerImpl     = new UnitManagerImpl();
     stockManagerImpl    = new StockManagerImpl();
     this.itemManager    = itemManager;
 }
 public PurchaseOrderController()
 {
     ItemDao         = new ItemDao();
     StockCardDao    = new StockCardDao();
     SupplierItemDao = new SupplierItemDao();
     POBatchDao      = new PoBatchDao();
     StockReorder    = new Dictionary <Item, List <SupplierItem> >();
     PODao           = new PurchaseOrderDao();
     POItemDao       = new PurchaseOrderItemDao();
 }
Esempio n. 22
0
        public static Item Get(int id)
        {
            Item       item;
            ItemEntity entity;

            entity = ItemDao.Get(id);
            item   = ItemMapper.Get(entity);

            return(item);
        }
Esempio n. 23
0
        public void Load()
        {
            Items = new ConcurrentDictionary <int, Item>();

            foreach (var itemData in ItemDao.GetRoomItems(room.Data.Id))
            {
                Item item = new Item(itemData);
                Items.TryAdd(item.Id, item);
            }
        }
        private void btnBuscarItem_Click(object sender, EventArgs e)
        {
            lstItens.DisplayMember = "TextoExibicao";
            lstItens.ValueMember = "ItemId";
            IList<IItemEntity> lst = ItemDao.ConsultarItem(txtBuscarItem.Text);
            if (lst.Count <= 0)
                MessageBox.Show("A busca não retornou resultados.");

            lstItens.DataSource = lst;
        }
Esempio n. 25
0
        public ActionResult Index()
        {
            Dictionary <string, List <Item> > items = ItemDao.getItemsForRequisition();
            List <Supplier> suppliers = SupplierDao.GetSuppliers();

            ViewData["Items"]     = items;
            ViewData["Suppliers"] = suppliers;

            return(View("OrderItems"));
        }
Esempio n. 26
0
        public ActionResult Detail20(int id = 0)
        {
            ItemDao itemDao = new ItemDao();
            var     item    = itemDao.GetItem_20(id);

            if (item == null)
            {
                return(RedirectToAction("Error"));
            }

            return(View(item));
        }
Esempio n. 27
0
        public void ChangeItemTest()
        {
            string dinningId = "002"; // TODO: 初始化为适当的值
            string oldItemId = "002"; // TODO: 初始化为适当的值
            string newItemId = "001"; // TODO: 初始化为适当的值

            Dictionary <string, string> list = new Dictionary <string, string>();

            list.Add(oldItemId, newItemId);

            ItemDao.ChangeItem(dinningId, list);
        }
        public ActionResult Disbursements(List <RetrievalItem> items)
        {
            List <AdjustmentDetail> adjustmentDetails = new List <AdjustmentDetail>();
            bool valid = true;

            foreach (var i in items)
            {
                if (i.AllocatedQuantity > i.ActualQuantity)
                {
                    AdjustmentDetail detail = new AdjustmentDetail()
                    {
                        Count = (i.StockQuantity - i.ActualQuantity),
                        Item  = new Item()
                        {
                            ItemId = i.ItemId
                        }
                    };

                    adjustmentDetails.Add(detail);
                }
                else if (i.AllocatedQuantity == i.ActualQuantity)
                {
                }
                else
                {
                    valid = false;
                    break;
                }
            }
            if (valid != false)
            {
                if (adjustmentDetails.Count > 0)
                {
                    int  userId = Convert.ToInt32(RouteData.Values["userId"]);
                    User u      = new User()
                    {
                        UserId = userId
                    };
                    Adjustment ad = AdjustmentDao.InsertAdjustment(adjustmentDetails, u);
                    AdjustmentDao.CalculateAdjustmentCost(ad);
                    ItemDao.UpdateStockForAdjustment(adjustmentDetails);
                }

                DisbursementDao.GenerateDisbursements(items);
                Task.Run(() => EmailUtility.SendEmailForItemsPickUp());
                return(RedirectToAction("Retrieval", "Stationery"));
            }
            else
            {
                return(RedirectToAction("Retrieval", "Stationery"));
            }
        }
Esempio n. 29
0
        public ActionResult Index()
        {
            if (!verifica_acesso("Itens", "Visualizar"))
            {
                return(RedirectToAction("Index", "Login"));
            }

            ViewBag.pagina = "Itens";
            ItemDao      _ItemDao = new ItemDao();
            IList <Item> _Itens   = _ItemDao.Listar_Itens_dt();

            return(View(_Itens));
        }
Esempio n. 30
0
        public static void Update(Item item)
        {
            try
            {
                ItemEntity entity;

                entity = ItemMapper.Get(item);

                ItemDao.Update(entity);
            }
            catch (Exception)
            {
                throw;
            }
        }