Exemple #1
0
        public IActionResult PurchaseLists(PurchaseListViewModel purchaseListViewModel)
        {
            ViewBag.WareHouseList = _context.Warehouse.ToList();
            ViewBag.SupplierList  = _context.Supplier.ToList();

            int?     SupplierId            = purchaseListViewModel.SupplierID;
            int?     WarehouseId           = purchaseListViewModel.WarehouseID;
            DateTime?fromDate              = purchaseListViewModel.FromDate;
            DateTime?toDate                = purchaseListViewModel.ToDate;
            var      PurchaseListViewModel = new PurchaseListViewModel();
            var      PurcahseList          = _context.Purchase.AsEnumerable()
                                             .Join(_context.Supplier, p => p.SupplierId, sp => sp.Id, (p, sp) => new { p, sp })
                                             .Select(pr => new Purchase
            {
                PurchaseOrderDate = pr.p.PurchaseOrderDate,
                OrderNumber       = pr.p.OrderNumber,
                SupplierId        = pr.p.SupplierId,
                WarehouseId       = pr.p.WarehouseId,
                SupplierName      = pr.sp.Name
            }).Where(p => (SupplierId == null || p.SupplierId == SupplierId) && (WarehouseId == null || p.WarehouseId == WarehouseId) && (fromDate == null || p.PurchaseOrderDate.Date >= fromDate) && (toDate == null || p.PurchaseOrderDate.Date <= toDate)).ToList();

            var PRListViewModel = new PurchaseListViewModel();

            PRListViewModel.PurchasesList = PurcahseList;
            return(View(PRListViewModel));
        }
 public PurchaseList()
 {
     //PurchaseListViewModel ViewModel
     InitializeComponent();
     _ViewModel      = new PurchaseListViewModel();
     DataContext     = _ViewModel;
     _ViewModel.Edit = Edit;
 }
Exemple #3
0
        public async Task <IActionResult> GetCurrencyAndPurchase(string PurchaseId)
        {
            // 1-2.系統在Get Action[Purchase/GetCurrencyAndPurchase]讀取幣別。
            List <CurrencyViewModel> lCVM = await IAR.GetCurrency();

            // 1-3.系統在Get Action[Purchase/GetCurrencyAndPurchase]讀取進貨單。
            PurchaseListViewModel plvm = await IAR.GetPurchase(PurchaseId);

            // 1-4.系統回傳Json(new {Currency=1-2讀取值, Purchase=1-3讀取值})。
            return(Json(new { Currency = lCVM, Purchase = plvm }));
        }
        public PurchaseListPage(PurchaseListViewModel vm)
        {
            InitializeComponent();
            viewModel      = vm;
            BindingContext = viewModel;

            if (App.CurrentPurchases.Count < 1)
            {
                CreateButton();
                emptyListstack.IsVisible = true;
            }
            else if (App.CurrentPurchases.All(p => p.Completed))
            {
                CreateButtons();
                allCompliteListStack.IsVisible = true;
            }
        }
Exemple #5
0
        public IActionResult PurchaseLists()
        {
            ViewBag.WareHouseList = _context.Warehouse.ToList();
            ViewBag.SupplierList  = _context.Supplier.ToList();

            var PurchaseListViewModel = new PurchaseListViewModel();
            var PurcahseList          = _context.Purchase.AsEnumerable()
                                        .Join(_context.Supplier, p => p.SupplierId, sp => sp.Id, (p, sp) => new { p, sp })
                                        .Select(pr => new Purchase
            {
                PurchaseOrderDate = pr.p.PurchaseOrderDate,
                OrderNumber       = pr.p.OrderNumber,
                SupplierName      = pr.sp.Name
            }).ToList();

            PurchaseListViewModel.PurchasesList = PurcahseList;
            return(View(PurchaseListViewModel));
        }
        public CompletedPurchaseListPage(PurchaseListViewModel vm)
        {
            InitializeComponent();
            BindingContext = vm;

            purchaseList.ItemSelected += (object sender, SelectedItemChangedEventArgs e) => {
                if (e.SelectedItem == null)
                {
                    return;
                }
                ((ListView)sender).SelectedItem = null;
            };

            if (App.CurrentPurchases.Count < 1 || !App.CurrentPurchases.Any(p => p.Completed))
            {
                ((Tab)(vm.Main.CompletedPurchasesStackLayout.Parent.Parent.Parent.Parent)).IsEnabled = false;
            }
        }
Exemple #7
0
        public ViewResult ListPurchases(int page = 1)
        {
            var user      = repository.Users.FirstOrDefault(u => u.Email == System.Web.HttpContext.Current.User.Identity.Name) ?? throw new UserNotFoundException();
            var purchases = repository.GetPurchases(user.Id);
            PurchaseListViewModel model = new PurchaseListViewModel()
            {
                Purchases = purchases
                            .OrderBy(p => p.DateBuy)
                            .Skip((page - 1) * PageSize)
                            .Take(PageSize).ToList(),
                PagingInfo = new PagingInfo {
                    CurrentPage  = page,
                    ItemsPerPage = PageSize,
                    TotalItems   = purchases.Count()
                }
            };

            return(View(model));
        }
 public MainPage()
 {
     InitializeComponent();
     RateAppCommand = new Command(RateApp);
     BindingContext = this;
     CurrentPurchasesStackLayout   = CurrentStack;
     CompletedPurchasesStackLayout = CompletetCurrentStack;
     HistoryStackLayout            = HistoryStack;
     PlanStackLayout      = PlanStack;
     PhotoStackLayout     = PhotoStack;
     SettingsStackLayout  = SettingsStack;
     GroupStackLayout     = GroupStack;
     NameLabel.FontFamily = Device.RuntimePlatform == Device.Android ? "jakobextractt.ttf#JacobExtraCTT" : "Assets/jakobextractt.ttf#JacobExtraCTT";//убрать в XAML
     activePurchases      = new PurchaseListViewModel(this);
     plan     = new PlanListViewModel(this);
     history  = new HistoryListViewModel(this);
     settings = new SettingsViewModel(this);
     groups   = new GroupListViewModel(this);
 }
Exemple #9
0
        public async Task <PurchaseListViewModel> GetPurchase(string PurchaseId)
        {
            PurchaseListViewModel ret = null;

            try
            {
                using (SqlConnection con = new SqlConnection(constr))
                {
                    var p = new DynamicParameters();
                    p.Add("@PurchaseId", PurchaseId, dbType: DbType.String, direction: ParameterDirection.Input);
                    p.Add("@r", dbType: DbType.Int32, direction: ParameterDirection.ReturnValue);
                    await con.OpenAsync();

                    IEnumerable <PurchaseListViewModel> tmp = await con.QueryAsync <PurchaseListViewModel>("sp_GetPurchase", p, commandType : CommandType.StoredProcedure);

                    ret = tmp.FirstOrDefault <PurchaseListViewModel>();
                }
            }
            catch (Exception)
            {
                ret = null;
            }
            return(ret);
        }
 public PurchaseListView(PurchaseListViewModel purchaseViewModel)
 {
     InitializeComponent();
     this.vm     = purchaseViewModel;
     DataContext = vm;
 }
 public PurchaseListView()
 {
     InitializeComponent();
     vm          = ContainerHelper.Container.Resolve <PurchaseListViewModel>();
     DataContext = vm;
 }