public SupplyProductsViewModel(AppDbContext dbContext, SupplyModel supply)
        {
            _dbContext = dbContext;
            _supply    = supply;

            FillData();
        }
 public SuppliesFormViewModel(AppDbContext dbContext, SupplyModel supply = null)
 {
     _dbContext = dbContext;
     Model      = supply ?? new SupplyModel();
     Suppliers  = dbContext.Suppliers.ToList();
     Warehouses = dbContext.Warehouses.ToList();
 }
Пример #3
0
 public SupplyAddModel()
 {
     Supply      = new SupplyModel();
     Supply.Date = DateTime.Today;
     Supply.Summ = 0;
     Shops       = new List <ShopModel>();
 }
Пример #4
0
 public EditViewModel(SupplyModel supplyModel)
 {
     Id              = supplyModel.Id;
     PartNumber      = supplyModel.PartNumber;
     Name            = supplyModel.Name;
     Comment         = supplyModel.Comment;
     PrinterModelIds = supplyModel.PrinterModels.Select(x => x.Id).ToList();
 }
Пример #5
0
 public Item(SupplyModel supplyModel)
 {
     Id         = supplyModel.Id;
     PartNumber = supplyModel.PartNumber;
     Name       = supplyModel.Name;
     Comment    = supplyModel.Comment;
     CompatiblePrinterModels = supplyModel.PrinterModels.Select(x => x.Name).ToList();
     SuppliesCount           = supplyModel.Supplies.Count();
 }
        public AddProductViewModel(AppDbContext dbContext, SupplyModel supply)
        {
            _dbContext = dbContext;

            Products = _dbContext.Products.ToList();
            Model    = new ProductToSupplyModel
            {
                SupplyId = supply.SupplyId
            };
        }
Пример #7
0
 public ActionResult EditSupply(SupplyModel supply)
 {
     if (ModelState.IsValid)
     {
         entityUnit.Supplies.Update(supply);
         entityUnit.Save();
         return(RedirectToAction(nameof(GetSupplyList)));
     }
     return(View());
 }
Пример #8
0
        public JsonResult GetSupplyAjax(string supplyNumber)
        {
            var model = new SupplyModel();

            try
            {
                var supply = SupplyService.GetSupplyBySupplyNumber(supplyNumber);
                model = Mapper.Map <SupplyModel>(supply);
                model.SetSucces();
            }
            catch (Exception ex)
            {
                model.SetError(ex);
            }

            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Пример #9
0
    // Start is called before the first frame update
    void Start()
    {
        transfer = gameObject.AddComponent <TransferModel>();
        transfer.connectionScope = connectionScope;

        switch (whatModel)
        {
        case Model.supply:
            supply            = gameObject.AddComponent <SupplyModel>();
            transfer.isSupply = true;
            break;

        case Model.consumption:
            Consumption    = gameObject.AddComponent <ConsumptionModel>();
            transfer.isUse = true;
            break;
        }
    }
Пример #10
0
        public Result Add(string partNumber, string name, string comment, IEnumerable <int> printerModelIds)
        {
            var supplyModel = new SupplyModel()
            {
                PartNumber = partNumber,
                Name       = name,
                Comment    = comment
            };

            context.SupplyModelSet.Add(supplyModel);

            if (printerModelIds != null)
            {
                var printerModels = context.PrinterModelSet.Where(x => printerModelIds.Contains(x.Id)).ToList();

                printerModels.ForEach(x => supplyModel.PrinterModels.Add(x));
            }

            return(context.SaveChangesWithValidation());
        }
Пример #11
0
 public void Register(string gridName, SupplyModel model)
 {
     Input(gridName, model.outputPower);
 }
        public MetadataBase metadata;                   // A field to cache this item's basic metadata, if requested.

        /// <summary>
        /// Constructor
        /// </summary>
        public CryptoItem()
        {
            supplyModel         = SupplyModel.FIXED;
            transferable        = Transferable.PERMANENT;
            transferFeeSettings = new TransferFeeSettings();
        }
Пример #13
0
 public ActionResult DeleteSupply(SupplyModel supply)
 {
     entityUnit.Supplies.Delete(supply);
     entityUnit.Save();
     return(RedirectToAction(nameof(GetSupplyList)));
 }
Пример #14
0
        // コンストラクタ
        public SupplyViewModel()
        {
            // 設定ファイルに記録していた情報を書き戻す
            {
                if (SettingsStore.MemoryWindowPositionFlg)
                {
                    WindowPositionLeft.Value   = SettingsStore.SupplyWindowRect[0];
                    WindowPositionTop.Value    = SettingsStore.SupplyWindowRect[1];
                    WindowPositionWidth.Value  = SettingsStore.SupplyWindowRect[2];
                    WindowPositionHeight.Value = SettingsStore.SupplyWindowRect[3];
                }
                AutoOpenWindowFlg.Value = SettingsStore.AutoSupplyWindowFlg;
            }
            // 画面の位置が変更された際、自動で設定ファイルに書き戻すようにする
            WindowPositionLeft.Subscribe(x => {
                if (!SettingsStore.MemoryWindowPositionFlg)
                {
                    return;
                }
                SettingsStore.SupplyWindowRect[0] = x;
                SettingsStore.ChangeSettingFlg    = true;
            });
            WindowPositionTop.Subscribe(x => {
                if (!SettingsStore.MemoryWindowPositionFlg)
                {
                    return;
                }
                SettingsStore.SupplyWindowRect[1] = x;
                SettingsStore.ChangeSettingFlg    = true;
            });
            WindowPositionWidth.Subscribe(x => {
                if (!SettingsStore.MemoryWindowPositionFlg)
                {
                    return;
                }
                SettingsStore.SupplyWindowRect[2] = x;
                SettingsStore.ChangeSettingFlg    = true;
            });
            WindowPositionHeight.Subscribe(x => {
                if (!SettingsStore.MemoryWindowPositionFlg)
                {
                    return;
                }
                SettingsStore.SupplyWindowRect[3] = x;
                SettingsStore.ChangeSettingFlg    = true;
            });
            // 起動時にこの画面を表示するか?
            AutoOpenWindowFlg.Subscribe(value => {
                SettingsStore.AutoSupplyWindowFlg = value;
            });
            // 表示する資材のモードに対応してボタンの色・表示内容を変える
            SupplyModeButtonColor = ShowSupplyMode.Select(x => {
                return((Brush)(x == 0 ? new SolidColorBrush(Colors.Pink) : new SolidColorBrush(Colors.SkyBlue)));
            }).ToReadOnlyReactiveProperty();
            SupplyModeButtonContent = ShowSupplyMode.Select(x => {
                return(x == 0 ? "通常資材" : "特殊資材");
            }).ToReadOnlyReactiveProperty();
            // その他staticな初期化
            GraphPeriodList = new ReactiveProperty <List <string> >(graphPeriodDic.Keys.Select(p => p).ToList());
            // 表示期間・資材モードが変更された際、グラフを再描画する
            SupplyGraphModel = GraphPeriodIndex.CombineLatest(ShowSupplyMode, (_, mode) => RedrawSupplyGraph()).ToReactiveProperty();
            // コマンドを設定
            ChangeSupplyModeCommand.Subscribe(_ => {
                ShowSupplyMode.Value = (ShowSupplyMode.Value == 0 ? 1 : 0);
                RedrawSupplyGraph();
            });
            SaveSupplyGraphCommand.Subscribe(_ => SupplyModel.SaveSupplyGraph(SupplyGraphModel.Value));
            ShowEditorCommand.Subscribe(_ => {
                var vm   = new SupplyEditorViewModel();
                var view = new Views.SupplyEditorView {
                    DataContext = vm
                };
                view.ShowDialog();
            });
            // タイマーを指定してグラフ更新を定期実行する
            var timer = new Timer(1000 * 60 * 5);

            timer.Elapsed += (sender, e) => {
                try {
                    timer.Stop();
                    RedrawSupplyGraph();
                }
                finally { timer.Start(); }
            };
            timer.Start();
            // まず最初の画面更新を掛ける
            SupplyGraphModel.Value = RedrawSupplyGraph();
        }
Пример #15
0
 // グラフを再描画する
 private PlotModel RedrawSupplyGraph()
 {
     return(SupplyModel.RedrawSupplyGraph(ShowSupplyMode.Value, NowGraphPeriodInfo));
 }