Ejemplo n.º 1
0
 private void _view_LoadData(object sender, EventArgs e)
 {
     using (new WaitCursorHandler())
     {
         if (_view.ListDataGrid != null)
         {
             _listObjs    = _services.GetAll().ToList();
             _bindingView = new BindingListView <SupplierModel>(_listObjs);
             _view.ListDataGrid.DataSource = _bindingView;
         }
     }
 }
Ejemplo n.º 2
0
        private void Btn_Simpan_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                _supplierServices = new SupplierServices();

                if (string.IsNullOrEmpty(NamaSupplier.Text))
                {
                    MessageBox.Show("Nama Supplier tidak boleh kosong", "Warning", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }

                var Dto = new MasterSupplierDto();
                Dto.NAMA_SUPPLIER   = NamaSupplier.Text;
                Dto.ALAMAT_SUPPLIER = Alamat.Text;
                Dto.ID     = Convert.ToInt32(IdSupplier.Text);
                Dto.STATUS = (Status)StatusSupplier.SelectedItem;

                var GetDataExisting = _supplierServices.GetAll().Where(x => !string.IsNullOrEmpty(x.NAMA_SUPPLIER) && x.NAMA_SUPPLIER.ToUpper() == Dto.NAMA_SUPPLIER.ToUpper()).FirstOrDefault();
                if (GetDataExisting != null && GetDataExisting.ID != Dto.ID)
                {
                    MessageBox.Show("Nama Supplier sudah ada", "Warning", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }

                _supplierServices.Save(Dto);
                MessageBox.Show("Update Data Sukses", "Sukses", MessageBoxButton.OK, MessageBoxImage.Information);
                CloseWin();
            }
            catch (Exception exp)
            {
                MessageBox.Show("Update Data Error", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Ejemplo n.º 3
0
        public void ShouldReturnListOfModels()
        {
            var listModels = (List <SupplierModel>)_services.GetAll();

            Assert.NotEmpty(listModels);

            TestsHelper.WriteListModels(_testOutputHelper, listModels);
        }
Ejemplo n.º 4
0
        private void UpdateGridSupplierData()
        {
            var page = _supplierGrid.Pager;
            var sort = new SSM.Services.SortField(string.IsNullOrEmpty(page.Sidx) ? "FullName" : page.Sidx, page.Sord == "asc");
            var rows = 0;
            //var suppliers = _supplierServices.GetAll(_supplierGrid.SearchCriteria, sort, out rows, page.CurrentPage, page.PageSize);
            var suppliers = _supplierServices.GetAll(_supplierGrid.SearchCriteria);
            var q         = suppliers.OrderBy(sort);

            rows = q.Count();
            _supplierGrid.Pager.Init(rows);
            if (rows == 0)
            {
                _supplierGrid.Data = new List <Supplier>();
                return;
            }
            _supplierGrid.Data = _supplierServices.GetListPager(q, page.CurrentPage, page.PageSize);
            //_supplierGrid.Data = suppliers;
        }
Ejemplo n.º 5
0
        private void PopulateData()
        {
            var Data = AutoMapper.Mapper.Map <List <MasterSupplierDto> >(_supplierServices.GetAll());

            _data = CollectionViewSource.GetDefaultView(Data);

            _data.Filter = new Predicate <object>(FilterCandidates);

            Dgv_Home.ItemsSource = _data;
        }
        private void PopulateComboboxNamaPengirim()
        {
            _supplierServices = new SupplierServices();
            var Data = AutoMapper.Mapper.Map <List <MasterSupplierDto> >(_supplierServices.GetAll().Where(x => x.STATUS == Status.Aktif));

            _dataSupplier = CollectionViewSource.GetDefaultView(Data);

            var TransportCompositeCollection = new CompositeCollection();

            TransportCompositeCollection.Add(new ComboBoxItem()
            {
                Content = "Please Select"
            });
            TransportCompositeCollection.Add(new CollectionContainer()
            {
                Collection = _dataSupplier
            });

            NamaPengirim.ItemsSource   = TransportCompositeCollection;
            NamaPengirim.SelectedIndex = 0;
        }
Ejemplo n.º 7
0
        public JsonResult CheckSuggest(int?id, string name, string modelName, int tabIndex)
        {
            var supps = new List <StockRecevingDiagloModel>();

            if (!id.HasValue)
            {
                id = 0;
            }
            switch (modelName)
            {
            case "Supplier":
                if (id != 0)
                {
                    var supplierById = supplierServices.GetSupplier(id.Value);
                    if (supplierById != null && supplierById.FullName == name)
                    {
                        return(Json("ok"));
                    }
                }
                supps =
                    supplierServices.GetAll()
                    .Where(x => (string.IsNullOrEmpty(name) || x.FullName.Contains(name))).OrderBy(x => x.FullName)
                    .Select(x => new StockRecevingDiagloModel {
                    Id = x.Id, Display = x.FullName, Other = "N/A"
                })
                    .ToList();
                if (!supps.Any())
                {
                    supps = supplierServices.GetAll().Select(x => new StockRecevingDiagloModel {
                        Id = x.Id, Display = x.FullName, Other = "N/A"
                    }).ToList();
                }
                break;

            case "Customer":
                var customer = new Customer();
                if (id != 0)
                {
                    customer = customerServices.GetById(id.Value);
                    if (customer != null && customer.FullName == name)
                    {
                        return(Json("ok"));
                    }
                }
                customer.FullName = name;
                supps             =
                    customerServices.GetQuery()
                    .Where(x => (string.IsNullOrEmpty(name) || x.FullName.Contains(name))).OrderBy(x => x.FullName)
                    .Select(x => new StockRecevingDiagloModel {
                    Id = x.Id, Display = x.FullName, Other = "N/A"
                })
                    .ToList();
                if (!supps.Any())
                {
                    supps = customerServices.GetQuery().Select(x => new StockRecevingDiagloModel {
                        Id = x.Id, Display = x.FullName, Other = "N/A"
                    }).ToList();
                }
                break;

            case "Country":
                if (id != 0)
                {
                    var countryById = stockReceivingService.GetAllCountry().FirstOrDefault(x => x.Id == id);
                    if (countryById != null && countryById.CountryName == name)
                    {
                        return(Json("ok"));
                    }
                }
                supps =
                    stockReceivingService.GetAllCountry()
                    .Where(x => (string.IsNullOrEmpty(name) || x.CountryName.Contains(name))).OrderBy(x => x.CountryName)
                    .Select(x => new StockRecevingDiagloModel {
                    Id = x.Id, Display = x.CountryName, Other = "N/A"
                })
                    .ToList();
                if (!supps.Any())
                {
                    supps = stockReceivingService.GetAllCountry().Select(x => new StockRecevingDiagloModel {
                        Id = x.Id, Display = x.CountryName, Other = "N/A"
                    }).ToList();
                }
                break;

            case "Product":
                if (id != 0 && productServices.Exists(name))
                {
                    return(Json("ok"));
                }

                supps = productServices.GetAll(name, 20);
                if (!supps.Any())
                {
                    supps = productServices.GetAll().Select(x => new StockRecevingDiagloModel {
                        Id = x.Id, Display = x.Name, Other = "N/A"
                    }).ToList();
                }
                break;
            }
            ViewData["TabIndexAdd"] = tabIndex;
            ViewData["nameSearch"]  = name;
            ViewData["modelName"]   = modelName;
            var html = this.RenderPartialView("_EnterSearchDialogView", supps);

            return(Json(html, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 8
0
 // GET: Admin/Products/Create
 public ActionResult Create()
 {
     ViewBag.CategoryID = new SelectList(_category.GetAll(), "CategoryID", "CategoryName");
     ViewBag.SupplierID = new SelectList(_supplier.GetAll(), "SupplierID", "SupplierName");
     return(View());
 }