/// <summary> /// コンストラクタ /// </summary> /// <param name="stationData">計算機で使用するステーション情報</param> public StationSummaryViewModel(IStationData stationData) { Workforce = stationData.Settings.Workforce; // 労働力関係初期化 { _WorkForceModuleInfoModel = new WorkForceModuleInfoModel(stationData.ModulesInfo, stationData.Settings); } { _NeedWareInfoModel = new NeedWareInfoModel(stationData.ModulesInfo, stationData.ProductsInfo); WorkforceNeedWareCollectionView = (ListCollectionView)CollectionViewSource.GetDefaultView(_NeedWareInfoModel.NeedWareInfoDetails); WorkforceNeedWareCollectionView.SortDescriptions.Clear(); WorkforceNeedWareCollectionView.SortDescriptions.Add(new SortDescription(nameof(NeedWareInfoDetailsItem.Method), ListSortDirection.Ascending)); WorkforceNeedWareCollectionView.SortDescriptions.Add(new SortDescription(nameof(NeedWareInfoDetailsItem.WareName), ListSortDirection.Ascending)); WorkforceNeedWareCollectionView.GroupDescriptions.Clear(); WorkforceNeedWareCollectionView.GroupDescriptions.Add(new PropertyGroupDescription(nameof(NeedWareInfoDetailsItem.Method))); } // 損益関係初期化 { _ProfitModel = new ProfitModel(stationData.ProductsInfo); _ProfitModel.PropertyChanged += ProfitModel_PropertyChanged; } // 建造コスト関係初期化 { _BuildingCostModel = new BuildingCostModel(stationData.BuildResourcesInfo); _BuildingCostModel.PropertyChanged += BuildingCostModel_PropertyChanged; } }
public ProfitModel ProfitToRow(IDataReader reader) { ProfitModel model = new ProfitModel(); model.Id = reader["Id"] != DBNull.Value ? Convert.ToInt32(reader["Id"]) : 0; model.UserId = reader["UserId"] != DBNull.Value ? reader["UserId"].ToString() : string.Empty; model.Profit = reader["Profit"] != DBNull.Value ? Convert.ToInt32(reader["Profit"]) : 0; model.Amount = reader["Amount"] != DBNull.Value ? Convert.ToDouble(reader["Amount"]) : 0; model.Description = reader["Description"] != DBNull.Value ? reader["Description"].ToString() : string.Empty; model.CardId = reader["CardId"] != DBNull.Value ? Convert.ToInt32(reader["CardId"]) : 0; return(model); }
//构造方法 public ProfitService() { try { //获取token string token = FinanceToken.getFinanceCheckToken().getToken(); //获取对象 account = FinanceToken.getFinanceCheckToken().checkToken(token); //实例化model层 profitModel = new ProfitModel(); }catch { throw new InvalidOperationException("身份验证不通过"); } }
public void Insert(ProfitModel model) { string commandText = @" Insert into dbo.Profit (UserId, Profit, Amount, Description, CardId) values (@UserId, @Profit, @Amount, @Description, @CardId) "; var parameters = new Dictionary <string, object>() { { "@UserId", model.UserId }, { "@Profit", model.Profit }, { "@Amount", model.Amount }, { "@Description", model.Description }, { "@CardId", model.CardId } }; DbHelper.ExecuteNonQuery(connectionString, commandText, parameters); }
public ProfitModelDetailPage(ProfitModel profitmodel) { if (profitmodel == null) { throw new ArgumentNullException(nameof(profitmodel)); } InitializeComponent(); conn = DependencyService.Get <ISQLiteDb>().GetConnection(); BindingContext = new ProfitModel { ProfitModel_ID = profitmodel.ProfitModel_ID, ProfitModel_Name = profitmodel.ProfitModel_Name, ExchangeRate = profitmodel.ExchangeRate, Profit = profitmodel.Profit, }; }
private void Plus_Click(object sender, RoutedEventArgs e) { ProfitModel Profit = new ProfitModel(); MainContent.DataContext = Profit; }