コード例 #1
0
        public PickUpStatic TodayStaticData()
        {
            PickUpStatic ps = new PickUpStatic();

            try
            {
                string sql = @"select 
( SELECT  count(Id)   FROM TecentQQData)  as DBTotal,
(select count( distinct(uin))    FROM TecentQQData) as DBPrimaryTotal,
(select count(Id)   from TecentQQData where dayint=cast( strftime('%Y%m%d', 'now')  as int)) as  Total  ,
(select count(distinct(uin)) from TecentQQData where dayint=cast( strftime('%Y%m%d', 'now')  as int))  as IdTotal,
(select cast( strftime('%Y%m%d', 'now')  as int) ) as StaticDay";
                DBReporistory <PickUpStaticSQLite> sync = new DBReporistory <PickUpStaticSQLite>(ConnString);
                IEnumerable <PickUpStaticSQLite>   arr  = sync.ExecuteSQL <PickUpStaticSQLite> (sql, "StaticDay");
                PickUpStaticSQLite[] detail             = arr.ToArray();
                PickUpStatic         data = new PickUpStatic()
                {
                    DBPrimaryTotal = detail[0].DBPrimaryTotal,
                    DBTotal        = detail[0].DBTotal,
                    IdTotal        = detail[0].IdTotal,
                    StaticDay      = detail[0].StaticDay.ToString(),
                    Total          = detail[0].Total
                };

                /*
                 * One or more validation errors were detected during model generation:
                 *
                 * Infrastructure.EFSQLite.PickUpStatic: : EntityType 'PickUpStatic' has no key defined. Define the key for this EntityType.
                 * Entity: EntityType: EntitySet 'Entity' is based on type 'PickUpStatic' that has no keys defined.
                 *
                 */
                return(data);
            }
            catch (Exception ex)
            {
                /*
                 * 1.设置一个属性为 实体主键之后出现错误:
                 * The 'StaticDay' property on 'PickUpStatic' could not be set to a 'System.Int64' value. You must set this property to a non-null value of type 'System.String'.
                 * 2.更改属性数据类型为int 出现新错误:
                 * 类型为“System.Int32”的表达式不能用于返回类型“System.Object 该问题是由于去重排序表达式导致
                 * 3.没有在类型“System.Int32”和“ApplicationService.SQLiteService.SQLiteQQDataService+PickUpStaticSQLite”之间定义强制运算符。
                 */
            }
            return(ps);
        }
コード例 #2
0
ファイル: TecentDataFrm.cs プロジェクト: Joy011024/PickUpData
 private void QueryTodayPickUp(object data)
 {
     try
     {
         if (this.InvokeRequired)
         {
             DelegateData.BaseDelegate bd = new DelegateData.BaseDelegate(QueryTodayPickUp);
             this.Invoke(bd, data);
             return;
         }
         PickUpStatic pc = data as PickUpStatic;
         lsbStatic.Items.Clear();
         lsbStatic.Items.Add("时间戳" + DateTime.Now.ToString());
         lsbStatic.Items.Add("库\t" + pc.DBTotal);
         lsbStatic.Items.Add("库唯一\t" + pc.DBPrimaryTotal);
         lsbStatic.Items.Add("日期\t" + pc.StaticDay);
         lsbStatic.Items.Add("今日总计\t" + pc.Total);
         lsbStatic.Items.Add("今日QQ号\t" + pc.IdTotal);
     }
     catch (Exception ex)
     {
         LogHelperExt.WriteLog("Query pick up number\r\n" + ex.Message);
     }
 }