protected override Task Context() { _quantityInfoMapper = A.Fake <QuantityInfoMapper>(); _dataInfoMapper = A.Fake <DataInfoMapper>(); _dimensionRepository = A.Fake <IDimensionRepository>(); sut = new DataColumnMapper(_dataInfoMapper, _quantityInfoMapper, _dimensionRepository); var observedData = DomainHelperForSpecs.ObservedData(); _dataColumn = observedData.ObservationColumns().First(); _baseGrid = observedData.BaseGrid; _relatedColumn = new DataColumn("related", DomainHelperForSpecs.NoDimension(), observedData.BaseGrid) { Values = new[] { 0f, 0f, 0f }, DataInfo = { Origin = ColumnOrigins.ObservationAuxiliary } }; _dataColumn.AddRelatedColumn(_relatedColumn); _quantityInfoSnapshot = new Snapshots.QuantityInfo(); _dataInfoSnapshot = new Snapshots.DataInfo(); A.CallTo(() => _quantityInfoMapper.MapToSnapshot(_dataColumn.QuantityInfo)).Returns(_quantityInfoSnapshot); A.CallTo(() => _dataInfoMapper.MapToSnapshot(_dataColumn.DataInfo)).Returns(_dataInfoSnapshot); A.CallTo(() => _dimensionRepository.DimensionByName(_dataColumn.Dimension.Name)).Returns(_dataColumn.Dimension); A.CallTo(() => _dimensionRepository.DimensionByName(_baseGrid.Dimension.Name)).Returns(_baseGrid.Dimension); return(Task.FromResult(true)); }
public dynamic GetDatainfoList([FromUri] DataInfoModel1 model) { DataInfoMapper mapper = new DataInfoMapper(); var dict = mapper.GetDatainfoList(model, this.System_Station_ID); return(Success(dict, model.PageIndex == 1 ? mapper.selectDatainfoCount(model, this.System_Station_ID) : 0)); }
public dynamic DeleteDatainfo(W_DataInfo model) { DataInfoMapper mapper = new DataInfoMapper(); if (mapper.DeleteDataInfo(model.ID)) { return(Success("操作成功")); } else { return(Success("操作失败")); } }
public dynamic GetDownInfo(int ID) { DataInfoMapper mapper = new DataInfoMapper(); var dict = mapper.GetDownInfo(ID); dict.DownCount = dict.DownCount + 1; if (mapper.UpdateDataInfo(dict)) { return(Success(dict)); } else { return(Success("下载失败")); } }
public dynamic AddDatainfo(DataInfoModel1 model) { W_DataInfo newModel = new W_DataInfo(); if (model != null) { if (model.BusType == 0) { newModel.BusType = 0; newModel.BusID = model.Course_ID; } else if (model.BusType == 1) { newModel.BusType = 1; newModel.BusID = model.CourseChapters_ID; } else if (model.BusType == 2) { newModel.BusType = 2; newModel.BusID = model.CourseUnit_ID; } newModel.Title = model.Title; newModel.Path = model.Path; newModel.DownCount = model.DownCount; newModel.DataSize = model.DataSize; newModel.DataInfoType = model.DataInfoType; newModel.Content = model.Content; newModel.AddPerson = this.AccountID; newModel.AddTime = DateTime.Now.ToString(); newModel.System_Station_ID = this.System_Station_ID; DataInfoMapper mapper = new DataInfoMapper(); var dict = mapper.AddDataInfo(newModel); if (dict) { return(Success("操作成功")); } else { return(Success("操作失败")); } } else { return(Success("操作失败")); } }
public dynamic UpdateDatainfo(W_DataInfo model) { if (model != null) { model.System_Station_ID = this.System_Station_ID; DataInfoMapper mapper = new DataInfoMapper(); if (mapper.UpdateDataInfo(model)) { return(Success("操作成功")); } else { return(Success("操作失败")); } } else { return(Success("操作失败")); } }