Ejemplo n.º 1
0
        /// <summary>
        /// 根据SQL语句获得对象列表
        /// </summary>
        /// <param name="strSql"></param>
        /// <param name="dbParameter"></param>
        /// <param name="pagination"></param>
        /// <returns></returns>
        public ResultClass <List <TEntity> > FindList(string strSql, Dictionary <string, object> dbParameters, Pagination pagination)
        {
            ResultClass <List <TEntity> > _ret = new ResultClass <List <TEntity> >();

            try
            {
                ResultClass <List <TEntity> > tmp = FindList(strSql, dbParameters);
                pagination.records = tmp.Result ? tmp.ResultData.Count : 0;
                if (pagination.records > 0)
                {
                    string StrSql = DatabasePage.GetStrSql(strSql, dbParameters, pagination);
                    _ret.ResultData = dbcontext.Database.SqlQuery <TEntity>(strSql, new List <DbParameter>()).ToList <TEntity>();
                    if (_ret.ResultData != null)
                    {
                        _ret.Result = true;
                    }
                    else
                    {
                        _ret.ErrorMessage = "没有数据!";
                    }
                }
                else
                {
                    _ret.ErrorMessage = "没有数据!";
                }
            }
            catch (Exception ex)
            {
                _ret.ErrorMessage = ex.Message;
            }
            return(_ret);
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="objectType"></param>
        /// <param name="objectID"></param>
        /// <returns></returns>
        public ResultClass <List <ModuleButtonEntity> > GetModuleButtonByObjectID(Pagination pagination, string objectType, string objectID)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(@"select t.*
                            from Sys_ModuleButton t,Sys_RoleAuthorize r
                            where t.F_Id=r.F_ItemId and r.F_ItemType=2
                                  and r.F_ObjectType=@F_ObjectType and r.F_ObjectId=@F_ObjectId");
            Dictionary <string, object> parameter = new Dictionary <string, object>();

            parameter.Add("F_ObjectType", objectType);
            parameter.Add("F_ObjectId", objectID);
            string sql = DatabasePage.GetStrSql(strSql.ToString(), parameter, pagination);

            return(this.FindList(sql, new Dictionary <string, object>()));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="enCode"></param>
        /// <returns></returns>
        public List <ItemsDetailEntity> GetItemList(Pagination pagination, string enCode)
        {
            StringBuilder strSql = new StringBuilder();

            strSql.Append(@"SELECT  d.*
                            FROM    Sys_ItemsDetail d
                                    INNER  JOIN Sys_Items i ON i.F_Id = d.F_ItemId
                            WHERE   1 = 1
                                    AND i.F_EnCode = @enCode
                                    AND d.F_EnabledMark = 1
                                    AND d.F_DeleteMark = 0 ");
            Dictionary <string, object> parameter = new Dictionary <string, object>();

            parameter.Add("enCode", enCode);
            string sql = DatabasePage.GetStrSql(strSql.ToString(), parameter, pagination);
            ResultClass <List <ItemsDetailEntity> > _ret = this.FindList(sql, new Dictionary <string, object>());

            if (_ret.Result)
            {
                return(_ret.ResultData);
            }
            return(new List <ItemsDetailEntity>());
        }
Ejemplo n.º 4
0
        public static AzusaDexTimeline LoadFrom(DexcomDevice dd)
        {
            AzusaDexTimeline result = new AzusaDexTimeline();

            result.Timestamp = dd.ReadRTC();
            PartitionInfo pi = dd.ReadDatabaseParitionInfo();

            for (int i = 0; i < pi.Partition.Length; i++)
            {
                DatabasePageRange dpr = dd.ReadDatabasePageRange(pi.Partition[i]);
                if (dpr.Start == -1)
                {
                    continue;
                }
                for (int j = dpr.Start; j < dpr.End; j++)
                {
                    DatabasePage page = dd.ReadDatabasePage(pi.Partition[i], j);
                    for (int k = 0; k < page.Record.Length; k++)
                    {
                        switch (page.RecordType)
                        {
                        case RecordType.SensorData:
                            SensorData sd = page.Record[k] as SensorData;
                            result[sd.DisplayTime].Rssi             = sd.Rssi;
                            result[sd.DisplayTime].SensorFiltered   = sd.Filtered;
                            result[sd.DisplayTime].SensorUnfiltered = sd.Unfiltered;
                            break;

                        case RecordType.EgvData:
                            EGVRecord egv = page.Record[k] as EGVRecord;
                            if (egv.SpecialGlucoseValue == null)
                            {
                                result[egv.DisplayTime].Glucose = egv.Glucose;
                            }
                            else
                            {
                                result[egv.DisplayTime].SpecialGlucoseValue = egv.SpecialGlucoseValue;
                            }
                            result[egv.DisplayTime].TrendArrow = egv.TrendArrow;
                            break;

                        case RecordType.InsertionTime:
                            InsertionTime it = page.Record[k] as InsertionTime;
                            result[it.DisplayTime].SessionState = it.SessionState;
                            break;

                        case RecordType.MeterData:
                            MeterData md = page.Record[k] as MeterData;
                            result[md.DisplayTime].MeterGlucose = md.MeterGlucose;
                            break;

                        case RecordType.UserEventData:
                            UserEventData ued = page.Record[k] as UserEventData;
                            result[ued.DisplayTime2].EventType = ued.EventType;
                            switch (ued.EventType)
                            {
                            case EventType.Carbs:
                                result[ued.DisplayTime2].Carbs = ued.EventValue;
                                break;

                            case EventType.Insulin:
                                result[ued.DisplayTime2].Insulin = ued.EventValue;
                                break;

                            default:
                                result[ued.DisplayTime2].HealthEvent   = ued.HealthEvent;
                                result[ued.DisplayTime2].ExerciseEvent = ued.ExerciseEvent;
                                break;
                            }
                            break;

                        case RecordType.ManufacturingData:
                            ManufacturingParameters mp = page.Record[k] as ManufacturingParameters;
                            result[mp.DisplayTime].ManufacturingParameters = mp;
                            break;

                        case RecordType.FirmwareParameterData:
                            FirmwareParameterData fpd = page.Record[k] as FirmwareParameterData;
                            result[fpd.DisplayTime].FirmwareParameters = fpd.FPR;
                            break;

                        case RecordType.PcSoftwareParameter:
                            PcSoftwareParameter pcp = page.Record[k] as PcSoftwareParameter;
                            result[pcp.DisplayTime].PcSoftwareParameter = pcp;
                            break;

                        case RecordType.CalSet:
                        case RecordType.ReceiverLogData:
                        case RecordType.UserSettingData:
                        case RecordType.Deviation:
                            break;

                        default:
                            throw new NotImplementedException(page.RecordType.ToString());
                        }
                    }
                }
            }

            result.Order();
            return(result);
        }
 public IActionResult UpdateDatabasePage([FromBody] DatabasePage entity)
 {
     _databasePageService.Update(entity);
     return(Ok());
 }
Ejemplo n.º 6
0
 public Task SavePageAsync(string allRecordsKey, DatabasePage databasePage)
 => _redis.Db0.AddAsync(allRecordsKey, databasePage);
 public void Update(DatabasePage entity)
 {
     _databaseDal.Update(entity);
 }
 public void Delete(DatabasePage entity)
 {
     _databaseDal.Delete(entity);
 }
 public void Add(DatabasePage entity)
 {
     _databaseDal.Add(entity);
 }
 public Task SavePageAsync(string allRecordsKey, DatabasePage databasePage)
 {
     DbPageToUpdate = databasePage;
     return(Task.CompletedTask);
 }
Ejemplo n.º 11
0
 public static string GetDatabasePageUniqueKey(this DatabasePage databasePage)
 {
     return($"{databasePage.PageID}_{databasePage.FileID}");
 }