예제 #1
0
        public static void TestAddNewCurrentDelivery(DateTime expectedArrivalDate)
        {
            //getting all items
            IEnumerable <Item> allItems;

            using (var iRepo = new ItemRepository(new InventoryContext()))
            {
                allItems = iRepo.GetAll();
            }

            //getting vars

            //getting dict
            var itemsToQuantity = new Dictionary <Item, int>();

            foreach (Item item in allItems.Take(1))
            {
                itemsToQuantity.Add(item, 1);
            }
            //getting supplier
            Supplier supplier;

            using (var sRepo = new SupplierRepo(new InventoryContext()))
            {
                supplier = sRepo.GetByID(1);
                sRepo.Complete();
            }

            //adding new cd
            using (var cdRepo = new CurrentDeliveriesRepo(new InventoryContext()))
            {
                cdRepo.AddNewCurrentDelivery(itemsToQuantity, expectedArrivalDate, supplier);
                cdRepo.Complete();
            }
        }
예제 #2
0
        public ActionResult Edit(int id)
        {
            //ViewBag.SupplierList = new SelectList(SupplierRepo.GetAll(), "Id", "Description");
            SupplierViewModel model = SupplierRepo.GetById(id);

            return(PartialView(model));
        }
예제 #3
0
        public ActionResult Edit(int id)
        {
            ViewBag.SupplierList = new SelectList(SupplierRepo.GetAll(), "Id", "Nama");
            BarangViewModel model = BarangRepo.GetById(id);

            return(PartialView(model));
        }
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                var supplier = SupplierRepo.retrieveByName(txtSearch.Text);

                if (supplier.Count > 0)
                {
                    lvSupplier.Items.Clear();
                    foreach (var item in supplier)
                    {
                        ListViewItem lv = new ListViewItem(item.SupplierId.ToString());
                        lv.SubItems.Add(item.SupplierName);
                        lv.SubItems.Add(item.SupplierAddress);
                        lv.SubItems.Add(item.SupplierContactNumber.ToString());
                        lvSupplier.Items.Add(lv);
                    }
                }
                else
                {
                    MessageBox.Show("Item not found.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
 private void btnCategoryAdd_Click(object sender, EventArgs e)
 {
     if (txtSupplierName.Text != "")
     {
         if (SupplierRepo.checkIfSupplierExists(txtSupplierName.Text))
         {
             MessageBox.Show("Supplier already exists.");
         }
         else
         {
             double num;
             bool   b = double.TryParse(txtContactNumber.Text, out num);
             if (b)
             {
                 SupplierRepo.insert(Guid.NewGuid(), txtSupplierName.Text, txtAddress.Text, double.Parse(txtContactNumber.Text));
                 fillListView();
                 clearAll();
                 MessageBox.Show("Supplier has been added.");
             }
             else
             {
                 MessageBox.Show("Invalid contact number");
             }
         }
     }
     else
     {
         MessageBox.Show("Supplier name must not be empty");
     }
 }
        private void btnCategoryDelete_Click(object sender, EventArgs e)
        {
            DialogResult d = MessageBox.Show("Are you sure you want to delete?", "Delete", MessageBoxButtons.YesNo);

            if (d == DialogResult.Yes)
            {
                int index = 0;
                try
                {
                    index = lvSupplier.SelectedIndices[0];
                    SupplierRepo.delete(Guid.Parse(lvSupplier.Items[index].SubItems[0].Text));
                    fillListView();
                    clearAll();
                    MessageBox.Show("Supplier has been deleted.");
                    btnCategoryDelete.Enabled = false;
                    btnCategoryUpdate.Enabled = false;
                    btnCategoryAdd.Enabled    = true;
                    btnClear.Enabled          = true;
                }
                catch (Exception)
                {
                    MessageBox.Show("Please select a supplier to delete.");
                }
            }
        }
예제 #7
0
        public ActionResult Details(int id)
        {
            //ViewBag.JobPositionList = new SelectList(JobPositionRep.GetAll(), "Id", "Description");
            SupplierViewModel model = SupplierRepo.GetById(id);

            return(PartialView(model));
        }
예제 #8
0
        public static void CreateNewDelivery(DateTime expectedArrivalDate)
        {
            //vars needed
            Supplier supplier;

            //getting supplier
            using (var sRepo = new SupplierRepo(new InventoryContext()))
            {
                supplier = sRepo.GetByID(1);
            }

            //creating new delivery
            var NewCurrentDelivery = new CurrentDelivery()
            {
                Supplier            = supplier,
                IsArrived           = false,
                ExpectedArrivalDate = expectedArrivalDate
            };

            using (var cdRepo = new CurrentDeliveriesRepo(new InventoryContext()))
            {
                cdRepo.Add(NewCurrentDelivery);
                cdRepo.Complete();
            }
        }
예제 #9
0
 public ActionResult DeleteConfirm(int id)
 {
     if (SupplierRepo.DeleteById(id))
     {
         return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
     }
     else
     {
         return(Json(new { success = false, message = SupplierRepo.Message }, JsonRequestBehavior.AllowGet));
     }
 }
예제 #10
0
        public IHttpActionResult ActivateSupplier(SupplierModel sup)
        {
            string        error = "";
            SupplierModel sm    = SupplierRepo.ActivateSupplier(sup, out error);

            if (error != "" || sm == null)
            {
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(sm));
        }
예제 #11
0
 public UnitOfWork(DataContext context)
 {
     _context               = context;
     Users                  = new UserRepository(_context);
     Roles                  = new RoleRepo(_context);
     Products               = new ProductRepo(_context);
     Suppliers              = new SupplierRepo(_context);
     PosTransaction         = new PosTransactionRepo(_context);
     PosTransactionProducts = new PosTransactionProductRepo(_context);
     ChatMessages           = new ChatMessageRepo(_context);
     ProductLogs            = new ProductLogRepo(_context);
     Members                = new MemberRepo(_context);
 }
예제 #12
0
 public StoreSupServiceImpl(AdjustmentVoucherRepo avrepo, EmployeeRepo erepo, PurchaseRequestRepo purreqrepo,
                            PurchaseOrderRepo porepo, SupplierRepo srepo, CollectionPointRepo crepo, IMailer mailservice, PurchaseOrderDetailRepo podrepo, TransactionRepo trepo)
 {
     this.avrepo      = avrepo;
     this.erepo       = erepo;
     this.purreqrepo  = purreqrepo;
     this.porepo      = porepo;
     this.srepo       = srepo;
     this.crepo       = crepo;
     this.mailservice = mailservice;
     this.podrepo     = podrepo;
     this.trepo       = trepo;
 }
예제 #13
0
 private void SetRepo()
 {
     _ingredientRepo  = new IngredientRepo(_context);
     _tableRepo       = new TableRepo(_context);
     _reservationRepo = new ReservationRepo(_context);
     _categoryRepo    = new CategoryRepo(_context);
     _salesRepo       = new SaleRepo(_context);
     _occupancyRepo   = new OccupanciesRepo(_context);
     _recipeRepo      = new RecipeRepo(_context);
     _productRepo     = new ProductRepo(_context);
     _supplierRepo    = new SupplierRepo(_context);
     _subCategoryRepo = new SubCategoryRepo(_context);
     _logRepo         = new LogRepo(_context);
 }
예제 #14
0
        public IHttpActionResult GetSupplierByItemId(int itemid)
        {
            string error             = "";
            List <SupplierModel> sms = SupplierRepo.GetSuppliersByItemId(itemid, out error);

            if (error != "" || sms == null)
            {
                if (error == ConError.Status.NOTFOUND)
                {
                    return(Content(HttpStatusCode.NotFound, "Item Not Found"));
                }
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(sms));
        }
예제 #15
0
        public IHttpActionResult GetSupplierById(int supid)
        {
            string        error = "";
            SupplierModel sm    = SupplierRepo.GetSupplierById(supid, out error);

            if (error != "" || sm == null)
            {
                if (error == ConError.Status.NOTFOUND)
                {
                    return(Content(HttpStatusCode.NotFound, "Supplier Not Found"));
                }
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(sm));
        }
예제 #16
0
        public IHttpActionResult importsupplier(List <SupplierModel> sup)
        {
            string error             = "";
            List <SupplierModel> sim = SupplierRepo
                                       .importsupplier(sup, out error);

            if (error != "" || sim == null)
            {
                if (error == ConError.Status.NOTFOUND)
                {
                    return(Content(HttpStatusCode.NotFound, "Supplier Not Found"));
                }
                return(Content(HttpStatusCode.BadRequest, error));
            }
            return(Ok(sim));
        }
        private void fillListView()
        {
            var sup = SupplierRepo.suppliers();

            if (sup.Count > 0)
            {
                lvSupplier.Items.Clear();
                foreach (var item in sup)
                {
                    ListViewItem lv = new ListViewItem(item.SupplierId.ToString());
                    lv.SubItems.Add(item.SupplierName);
                    lv.SubItems.Add(item.SupplierAddress);
                    lv.SubItems.Add(item.SupplierContactNumber.ToString());
                    lvSupplier.Items.Add(lv);
                }
            }
        }
예제 #18
0
 private void AddProduct_Load(object sender, EventArgs e)
 {
     try
     {
         Guid categoryId = CategoryRepo.getCategoryId(cmbCategory.Text);
         if (categoryId != null)
         {
             this.CategoryId = categoryId;
         }
         Guid SubcategoryId = SubCategoryRepo.getSubCategoryId(cmbSubCategory.Text);
         if (SubcategoryId != null)
         {
             this.subcategory = SubcategoryId;
         }
         Guid SupplierId = SupplierRepo.getSupplierId(cmbSupplier.Text);
         if (SupplierId != null)
         {
             this.supplier = SupplierId;
         }
         Guid WarehouseId = WarehouseRepo.getWarehouseId(cmbWarehouse.Text);
         if (WarehouseId != null)
         {
             this.warehouse = WarehouseId;
         }
         Guid statusId = StatusRepo.getStatusId(cmbStatus.Text);
         if (statusId != null)
         {
             this.status = statusId;
         }
         Guid StoreId = StoreRepo.getStoreId(cmbStore.Text);
         if (StoreId != null)
         {
             this.store = StoreId;
         }
         Guid id = UnitOfMeasurementRepo.retrieveId(cmbUnitOfMeasurement.Text);
         if (id != null)
         {
             this.unitOfMeasurementId = id;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
예제 #19
0
        private void initialize()
        {
            productVMRepo      = new ProductVMRepo();
            productRepo        = new ProductRepo();
            manufacturerVMRepo = new ManufacturerVMRepo();
            manufacturerRepo   = new ManufacturerRepo();
            supplierRepo       = new SupplierRepo();
            //add database update listener delegate
            productRepo.DatabaseUpdated += ProductsUpdateListener;

            dataGridViewProducts.DataSource = bsProducts;
            comboBoxManufacturer.DataSource = bsManufacturers;
            comboBoxSupplier.DataSource     = bsSuppliers;

            refreshProductsData();
            loadManufacturers();
            loadSuppliers();
        }
예제 #20
0
 public ActionResult Edit(SupplierViewModel model)
 {
     if (ModelState.IsValid)
     {
         if (SupplierRepo.Update(model))
         {
             return(Json(new { success = true }, JsonRequestBehavior.AllowGet));
         }
         else
         {
             return(Json(new { success = false, message = SupplierRepo.Message }, JsonRequestBehavior.AllowGet));
         }
     }
     else
     {
         return(Json(new { success = false, message = "Invalid" }, JsonRequestBehavior.AllowGet));
     }
 }
예제 #21
0
        public void GetPartsForSupplier(int supplierId)
        {
            string expectedJsonPath = $"SupplierRepo\\GetPartsForSupplier\\expected{supplierId}.json";

            NutsAndBoltsContext context = ContextFactory.GetContext();
            SupplierRepo        repo    = new SupplierRepo(context);

            List <Part> actual   = repo.GetPartsForSupplier(supplierId);
            List <Part> expected = JToken.Parse(File.ReadAllText(expectedJsonPath)).ToObject <List <Part> >();

            string actualJson   = actual.ToJsonString();
            string expectedJson = expected.ToJsonString();

            string sideBySide = FileStringComparer.GetSideBySideFileStrings(expectedJson, actualJson, "EXPECTED", "ACTUAL");

            output.WriteLine(sideBySide);

            Assert.Equal(expectedJson, actualJson);
        }
예제 #22
0
 public StoreClerkServiceImpl(ProductRepo prepo, PurchaseRequestRepo purreqrepo, PurchaseOrderRepo porepo, PurchaseOrderDetailRepo podrepo,
                              RequisitionRepo rrepo, RequisitionDetailRepo rdrepo, TransactionRepo trepo, TenderQuotationRepo tqrepo, RetrievalRepo retrivrepo,
                              EmployeeRepo erepo, SupplierRepo srepo, IMailer mailservice, AdjustmentVoucherRepo avrepo, DepartmentRepo drepo, AdjustmentVoucherDetailRepo avdetrepo)
 {
     this.prepo       = prepo;
     this.purreqrepo  = purreqrepo;
     this.porepo      = porepo;
     this.podrepo     = podrepo;
     this.rrepo       = rrepo;
     this.rdrepo      = rdrepo;
     this.trepo       = trepo;
     this.retrivrepo  = retrivrepo;
     this.tqrepo      = tqrepo;
     this.erepo       = erepo;
     this.srepo       = srepo;
     this.mailservice = mailservice;
     this.avrepo      = avrepo;
     this.drepo       = drepo;
     this.avdetrepo   = avdetrepo;
 }
        private void pictureBox1_Click(object sender, EventArgs e)
        {
            DialogResult d = MessageBox.Show("Are you sure you want to exit?", "Exit", MessageBoxButtons.YesNo);

            if (d == DialogResult.Yes)
            {
                if (this.cmbSupplier != null)
                {
                    this.cmbSupplier.Items.Clear();
                    var sup = SupplierRepo.suppliers();
                    if (sup.Count > 0)
                    {
                        foreach (var item in sup)
                        {
                            this.cmbSupplier.Items.Add(item.SupplierName);
                        }
                    }
                }

                this.Hide();
            }
        }
예제 #24
0
        public IHttpActionResult GetAllSuppliers()
        {
            // declare and initialize error variable to accept the error from Repo
            string error = "";

            // get the list from supplierRepo and will insert the error if there is one
            List <SupplierModel> sms = SupplierRepo.GetAllSuppliers(out error);

            // if the erorr is not blank or the supplier list is null
            if (error != "" || sms == null)
            {
                // if the error is 404
                if (error == ConError.Status.NOTFOUND)
                {
                    return(Content(HttpStatusCode.NotFound, "Suppliers Not Found"));
                }
                // if the error is other one
                return(Content(HttpStatusCode.BadRequest, error));
            }
            // if there is no error
            return(Ok(sms));
        }
        private void btnCategoryUpdate_Click(object sender, EventArgs e)
        {
            int index = 0;

            try
            {
                index = lvSupplier.SelectedIndices[0];
                if (txtSupplierName.Text != "" && txtContactNumber.Text != "" && txtAddress.Text != "")
                {
                    double num;
                    bool   b = double.TryParse(txtContactNumber.Text, out num);
                    if (b)
                    {
                        SupplierRepo.update(Guid.Parse(lvSupplier.Items[index].SubItems[0].Text), txtSupplierName.Text, txtAddress.Text, num);
                        MessageBox.Show("Supplier details have been been updated.");
                        btnCategoryDelete.Enabled = false;
                        btnCategoryUpdate.Enabled = false;
                        btnCategoryAdd.Enabled    = true;
                        btnClear.Enabled          = true;
                        fillListView();
                        clearAll();
                    }
                    else
                    {
                        MessageBox.Show("Invalid contact number.");
                    }
                }
                else
                {
                    MessageBox.Show("All fields are required.");
                }
            }
            catch (Exception)
            {
                MessageBox.Show("Please select an item to update.");
            }
        }
예제 #26
0
 private void cmbSupplier_SelectedIndexChanged(object sender, EventArgs e)
 {
     this.supplier = SupplierRepo.getSupplierId(cmbSupplier.Text);
 }
예제 #27
0
        public IQueryable <Supplier> GetAll()
        {
            var repo = new SupplierRepo(_context);

            return(repo.GetAll());
        }
 // GET: Pembelian
 public ActionResult Index()
 {
     ViewBag.SupplierList = new SelectList(SupplierRepo.GetAll(), "Id", "Nama");
     return(View());
 }
예제 #29
0
 public ActionResult Create()
 {
     ViewBag.SupplierList = new SelectList(SupplierRepo.GetAll(), "Id", "Nama");
     return(PartialView());
 }
예제 #30
0
        public void initCombo()
        {
            var unitOfMeasurement = UnitOfMeasurementRepo.retrieve();

            if (unitOfMeasurement.Count > 0)
            {
                foreach (var item in unitOfMeasurement)
                {
                    cmbUnitOfMeasurement.Items.Add(item.UnitOfMeasurementName.ToString());
                }
            }
            var categories = CategoryRepo.retrieve();

            if (categories.Count > 0)
            {
                foreach (var item in categories)
                {
                    cmbCategory.Items.Add(item.CategoryValue);
                }
            }

            var subcategory = SubCategoryRepo.retrieve();

            if (subcategory.Count > 0)
            {
                foreach (var item in subcategory)
                {
                    cmbSubCategory.Items.Add(item.SubCategoryValue);
                }
            }

            var supplier = SupplierRepo.suppliers();

            if (supplier.Count > 0)
            {
                foreach (var item in supplier)
                {
                    cmbSupplier.Items.Add(item.SupplierName);
                }
            }

            var warehouse = WarehouseRepo.retrieve();

            if (warehouse.Count > 0)
            {
                foreach (var item in warehouse)
                {
                    cmbWarehouse.Items.Add(item.WarehouseName);
                }
            }

            var status = StatusRepo.retrieve();

            if (status.Count > 0)
            {
                foreach (var item in status)
                {
                    cmbStatus.Items.Add(item.StatusValue);
                }
            }

            List <SMLIB.Entity.ProductAttribute> attributes = ProductAttributeRepo.retrieve();

            if (attributes.Count > 0)
            {
                foreach (var item in attributes)
                {
                    cmbAttributes.Items.Add(item.AttributeName);
                }
            }

            var store = StoreRepo.retrieve();

            if (store.Count > 0)
            {
                foreach (var item in store)
                {
                    cmbStore.Items.Add(item.StoreName);
                }
            }
        }