Exemplo n.º 1
0
 public override void FillFromDataRow(System.Data.DataRow dr)
 {
     this.Id     = DbConvert.ToString(dr, "Id");
     this.Active = DbConvert.ToBool(dr, "Active");
     this.OddIncreaseDecrease = DbConvert.ToDecimal(dr, "OddIncreaseDecrease");
     this.Markets             = DbConvert.ToString(dr, "Markets");
 }
Exemplo n.º 2
0
        /// <summary>
        ///  分页查询
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="whereCols">查询条件</typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public PageInfo <T> SelectPage <T>(PageInfo <T> pageInfo, string cols, string whereCols, WhereType whereType)
        {
            SqlModel selectModel = CreateSqlHelper.SelectSqlByPage(pageInfo, cols, whereCols, whereType);

            DataTable dataTable = SQLiteHelper.ExecuteDataTable(selectModel.Sql, false, selectModel.SqlParameters);

            List <T> lists = DbConvert.TableToList <T>(dataTable);


            SqlModel selectCountModel = CreateSqlHelper.SelectCount(pageInfo.ParamsSearch, whereCols, whereType);

            object result = SQLiteHelper.ExecuteScalar(selectCountModel.Sql, false, selectCountModel.SqlParameters);

            int total     = Convert.ToInt32(result);
            int totalPage = 0;

            if (total % pageInfo.PageSize == 0)
            {
                totalPage = total / pageInfo.PageSize;
            }
            else
            {
                totalPage = total / pageInfo.PageSize + 1;
            }

            pageInfo.TotalPage    = totalPage;
            pageInfo.Records      = lists;
            pageInfo.CurrentCount = total;
            //lists.Count;

            return(pageInfo);
        }
 private void ShowPreviousVersionDocLink()
 {
     if (doc.PreviousVersionId < 1)
     {
         PanPreviousVersionDocView.Visible = false;
     }
     else
     {
         ArrayList docEnum = new ArrayList();
         docEnum.Add(doc.PreviousVersionId);
         DataTable tab = DocumentEnt.FindEnum(docEnum);
         if (tab == null || tab.Rows.Count < 1)
         {
             PanPreviousVersionDocView.Visible = false;
         }
         else
         {
             PanPreviousVersionDocView.Visible = true;
             string sid = DbConvert.ToString(tab.Rows[0]["Id"]);
             PanPreviousVersionDocInfo.Rows[0].Cells[1].InnerHtml =
                 "<a href='javascript:ViewDoc(" + sid + ")' >" +
                 HttpUtility.HtmlEncode(DbConvert.ToString(tab.Rows[0]["Header"])) +
                 "</a>";
         }
     }
 }
Exemplo n.º 4
0
 public override void FillFromDataRow(System.Data.DataRow dr)
 {
     this.ResourceId   = DbConvert.ToInt64(dr, "ResourceId");
     this.ResourceType = (eResourceType)Enum.Parse(typeof(eResourceType), DbConvert.ToString(dr, "ResourceType"));
     this.MimeType     = DbConvert.ToString(dr, "MimeType");
     this.Data         = DbConvert.ToString(dr, "Data");
 }
Exemplo n.º 5
0
        /// <summary>
        ///  sqlite 查询数据库所有表
        /// </summary>
        /// <param name="dbConnect"></param>
        /// <param name="dbName"></param>
        /// <param name="tableName"></param>
        /// <returns></returns>
        public static List <TableInfo> SelectTableNameBySqlite(string dbConnect, string dbName, string tableKeyword)
        {
            List <TableInfo> lists = new List <TableInfo>();

            try
            {
                string sqlAllTable = "SELECT name as TABLE_NAME FROM sqlite_master WHERE type='table' and name!='sqlite_sequence' ";
                if (!string.IsNullOrEmpty(tableKeyword))
                {
                    sqlAllTable += $" and name like '%{tableKeyword}%'";
                }
                sqlAllTable += " ORDER BY name";

                SQLiteHelper.connectionString = dbConnect;
                DataTable dataTable = SQLiteHelper.ExecuteDataTable(sqlAllTable, false, null);
                lists = DbConvert.TableToList <TableInfo>(dataTable);
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                SQLiteHelper.connectionString = $@"data source={AppDomain.CurrentDomain.BaseDirectory}{ConfigurationManager.AppSettings["dbRootFolder"].ToString()}\{ConfigurationManager.AppSettings["dbName"].ToString()}";
            }
            return(lists);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 获取指定 供应商/客户 、 仓库 、商品的相关单据明细列表
        /// </summary>
        /// <param name="shType"></param>
        /// <param name="typeId"></param>
        /// <param name="id"></param>
        /// <returns></returns>
        public List <SheetGoodsInfoModel> GetSheetGoodsInfoList(int shType, int typeId, int id)
        {
            DataTable dt   = GetSheetGoodsInfoDt(shType, typeId, id);
            string    cols = "Id,SheetId,SheetNo,ShType,IsChecked,CreateTime,UnitId,UnitName,Count,Price,Amount,DealPerson,Creator,CheckPerson,CheckTime,StoreId,StoreName,GoodsId,GoodsNo,GoodsName,GUnit";

            return(DbConvert.DataTableToList <SheetGoodsInfoModel>(dt, cols));
        }
Exemplo n.º 7
0
        //clob字段单独获取
        public string GetLayoutValue(string logid)
        {
            //string sqlString = " select * from fg_layoutlog where logid=" + DbConvert.ToSqlString(logid);
            string sqlString = " select value from fg_layoutlog where logid=" + DbConvert.ToSqlString(logid);

            return(DbHelper.GetString(sqlString));
        }
Exemplo n.º 8
0
        /// <summary>
        /// 删除数据
        /// </summary>
        /// <param name="primaryKey"></param>
        /// <returns></returns>
        public int DeleteLayoutLogInfo(string primaryKey)
        {
            //需要修改 parmaryKey 为自己的主键
            string Sql = string.Format("delete from fg_layoutlog where gid ={0}", DbConvert.ToSqlString(primaryKey));

            return(DbHelper.ExecuteNonQuery(Sql));
        }
Exemplo n.º 9
0
 public override void FillFromDataRow(System.Data.DataRow dr)
 {
     this.ResourceId   = DbConvert.ToInt64(dr, "ResourceId");
     this.ResourceType = (eAssignmentType)Enum.Parse(typeof(eAssignmentType), DbConvert.ToString(dr, "ObjectClass"));
     this.ObjectId     = DbConvert.ToInt64(dr, "ObjectId");
     this.Active       = DbConvert.ToBool(dr, "Active");
 }
Exemplo n.º 10
0
        /// <summary>
        /// 保存用户查询数据
        /// </summary>
        /// <param name="PageId"></param>
        /// <param name="ClientJsonString"></param>
        /// <returns></returns>
        public int SetQueryPanelData(string PageId, string ClientJsonString)
        {
            string sqlWhere = " pageid=" + DbConvert.ToSqlString(PageId) + " and userid=" + DbConvert.ToSqlString(NG3.AppInfoBase.LoginID) + " and cboo=" + DbConvert.ToSqlString(NG3.AppInfoBase.OCode);
            string query    = DataConverterHelper.ConvertQueryString(ClientJsonString);


            //目前是直接删除后创建  这样的话,guid的主从明细表就查不到明细数据了
            //若存在 则更新,否则 删除后创建
            DataTable tmpDT = DbHelper.GetDataTable("select * from c_sys_search_def_master where " + sqlWhere);

            if (tmpDT.Rows.Count == 0)
            {
                DataRow dr = tmpDT.NewRow();
                dr["id"]         = Guid.NewGuid().ToString();
                dr["pageid"]     = PageId;
                dr["userid"]     = NG3.AppInfoBase.LoginID;
                dr["cboo"]       = NG3.AppInfoBase.OCode;
                dr["isdefault"]  = 0;
                dr["ismember"]   = 0;
                dr["remeberstr"] = ClientJsonString;
                dr["reembersql"] = query;
                tmpDT.Rows.Add(dr);
                return(DbHelper.Update(tmpDT, "select * from c_sys_search_def_master"));
            }
            else
            {
                tmpDT.Rows[0]["isdefault"]  = 0;
                tmpDT.Rows[0]["ismember"]   = 0;
                tmpDT.Rows[0]["remeberstr"] = ClientJsonString;
                tmpDT.Rows[0]["reembersql"] = query;
                return(DbHelper.Update(tmpDT, "select * from c_sys_search_def_master where " + sqlWhere));
            }
        }
Exemplo n.º 11
0
 public override void FillFromDataRow(DataRow dr)
 {
     this.MatchId  = DbConvert.ToInt64(dr, "MatchId");
     this.GroupId  = DbConvert.ToInt64(dr, "GroupId");
     this.Type     = DbConvert.ToString(dr, "Type");
     this.Sort     = DbConvert.ToInt32(dr, "Sort");
     this.UpdateId = DbConvert.ToInt64(dr, "UpdateId");
 }
Exemplo n.º 12
0
        public const string BETDOMAIN_MULTISTRING_GROUP      = "BETDOMAIN_MSG";    // BetDomain

        public override void FillFromDataRow(DataRow dr)
        {
            this.MultiStringGroupID    = DbConvert.ToInt64(dr, "MultiStringGroupID");
            this.MultiStringGroupTag   = DbConvert.ToString(dr, "MultiStringGroupTag");
            this.Comment               = DbConvert.ToString(dr, "Comment");
            this.LastModified          = DbConvert.ToDateTime(dr, "LastModified");
            this.SvrMultiStringGroupID = DbConvert.ToInt64(dr, "SvrMultiStringGroupID");
        }
Exemplo n.º 13
0
        public override void FillFromDataRow(System.Data.DataRow dr)
        {
            this.MatchInfoId  = DbConvert.ToInt64(dr, "matchinfoid");
            this.LastModified = DbConvert.ToDateTime(dr, "LastModified");

            MatchInfosValuesExternalState obj = LineSerializeHelper.StringToObject <MatchInfosValuesExternalState>(DbConvert.ToString(dr, "external_state"));

            this.external_state.StatisticValues = obj.StatisticValues;
        }
Exemplo n.º 14
0
 public override void FillFromDataRow(DataRow dr)
 {
     this.CategoryID    = DbConvert.ToInt64(dr, "CategoryID");
     this.SvrCategoryID = DbConvert.ToInt64(dr, "SvrCategoryID");
     this.MultiStringID = DbConvert.ToInt64(dr, "MultiStringID");
     this.DefaultName   = DbConvert.ToString(dr, "DefaultName");
     this.Sort          = DbConvert.ToInt32(dr, "Sort");
     this.LastModified  = DbConvert.ToDateTime(dr, "LastModified");
 }
Exemplo n.º 15
0
 public override void FillFromDataRow(DataRow dr)
 {
     this.SportID       = DbConvert.ToInt64(dr, "SportID");
     this.SvrSportID    = DbConvert.ToInt64(dr, "SvrSportID");
     this.BtrSportID    = DbConvert.ToNullableInt64(dr, "BtrSportID");
     this.DefaultName   = DbConvert.ToString(dr, "DefaultName");
     this.MultiStringID = DbConvert.ToInt64(dr, "MultiStringID");
     this.LastModified  = DbConvert.ToDateTime(dr, "LastModified");
 }
Exemplo n.º 16
0
        public override void FillFromDataRow(System.Data.DataRow dr)
        {
            this.TournamentInfoId = DbConvert.ToInt64(dr, "tournamentinfoid");
            this.LastModified     = DbConvert.ToDateTime(dr, "LastModified");

            TournamentInfosValuesExternalState obj = LineSerializeHelper.StringToObject <TournamentInfosValuesExternalState>(DbConvert.ToString(dr, "external_state"));

            this.external_state.CompetitorsContainer = obj.CompetitorsContainer;
        }
Exemplo n.º 17
0
        /// <summary>
        /// Compare two FieldTest entities
        /// </summary>
        /// <param name="expected"></param>
        /// <param name="actual"></param>
        public static void Compare(FieldTest expected, FieldTest actual)
        {
            // Check for nulls
            if (expected == null && actual == null)
            {
                return;
            }
            if (expected == null)
            {
                Assert.Fail("Expected null, got FieldTest");
            }
            if (actual == null)
            {
                Assert.Fail("Expected FieldTest, got null");
            }

            // Compare simple properties
            Assert.AreEqual(expected.Id, actual.Id, "FieldTest.Id not equal");
            Assert.AreEqual(expected.IntField, actual.IntField, "FieldTest.IntField not equal");
            Assert.AreEqual(expected.IntFieldNullable, actual.IntFieldNullable, "FieldTest.IntFieldNullable not equal");
            Assert.AreEqual(expected.DecimalField, actual.DecimalField, "FieldTest.DecimalField not equal");
            Assert.AreEqual(expected.DecimalFieldNullable, actual.DecimalFieldNullable, "FieldTest.DecimalFieldNullable not equal");
            Assert.AreEqual(expected.StringField, actual.StringField, "FieldTest.StringField not equal");
            Assert.AreEqual(expected.StringFieldNullable, actual.StringFieldNullable, "FieldTest.StringFieldNullable not equal");
            Assert.AreEqual(expected.TextField, actual.TextField, "FieldTest.TextField not equal");
            Assert.AreEqual(expected.TextFieldNullable, actual.TextFieldNullable, "FieldTest.TextFieldNullable not equal");
            Compare(expected.DatetimeField, actual.DatetimeField, "FieldTest.DatetimeField");
            Compare(expected.DatetimeFieldNullable, actual.DatetimeFieldNullable, "FieldTest.DatetimeFieldNullable");
            Assert.AreEqual(expected.TinyintField, actual.TinyintField, "FieldTest.TinyintField not equal");
            Assert.AreEqual(expected.TinyintFieldNullable, actual.TinyintFieldNullable, "FieldTest.TinyintFieldNullable not equal");
            Compare(expected.TimestampField, actual.TimestampField, "FieldTest.TimestampField");
            Compare(expected.TimestampFieldNullable, actual.TimestampFieldNullable, "FieldTest.TimestampFieldNullable");
            Assert.AreEqual(expected.EnumField, actual.EnumField, "FieldTest.EnumField not equal");
            Assert.AreEqual(expected.EnumFieldNullable, actual.EnumFieldNullable, "FieldTest.EnumFieldNullable not equal");
            Assert.AreEqual(expected.ForeignKeyField, actual.ForeignKeyField, "FieldTest.ForeignKeyField not equal");
            Assert.AreEqual(expected.ForeignKeyFieldNullable, actual.ForeignKeyFieldNullable, "FieldTest.ForeignKeyFieldNullable not equal");
            Assert.AreEqual(DbConvert.ToDateInt(expected.IntDateField), DbConvert.ToDateInt(actual.IntDateField), "FieldTest.IntDateField not equal");
            Assert.AreEqual(DbConvert.ToDateInt(expected.IntDateFieldNullable), DbConvert.ToDateInt(actual.IntDateFieldNullable), "FieldTest.IntDateFieldNullable not equal");
            Assert.AreEqual(expected.IndexedField, actual.IndexedField, "FieldTest.IndexedField not equal");
            Assert.AreEqual(expected.IndexedFieldNullable, actual.IndexedFieldNullable, "FieldTest.IndexedFieldNullable not equal");
            Assert.AreEqual(expected.NodeIdField, actual.NodeIdField, "FieldTest.NodeIdField not equal");
            Assert.AreEqual(expected.NodeIdFieldNullable, actual.NodeIdFieldNullable, "FieldTest.NodeIdFieldNullable not equal");
            Assert.AreEqual(expected.DefaultValueIsTwo, actual.DefaultValueIsTwo, "FieldTest.DefaultValueIsTwo not equal");

            // Compare ForeignKeyFieldWidget
            if (expected.ForeignKeyFieldWidgetPopulated && actual.ForeignKeyFieldWidgetPopulated)
            {
                WidgetComparer.Compare(expected.ForeignKeyFieldWidget, actual.ForeignKeyFieldWidget);
            }

            // Compare ForeignKeyFieldNullableWidget
            if (expected.ForeignKeyFieldNullableWidgetPopulated && actual.ForeignKeyFieldNullableWidgetPopulated)
            {
                WidgetComparer.Compare(expected.ForeignKeyFieldNullableWidget, actual.ForeignKeyFieldNullableWidget);
            }
        }
Exemplo n.º 18
0
        /// <summary>
        ///  查询
        /// </summary>
        /// <typeparam name="T"></typeparam>
        /// <typeparam name="whereCols">查询条件</typeparam>
        /// <param name="t"></param>
        /// <returns></returns>
        public List <T> SelectPage <T>(T t, string cols, string whereCols, WhereType whereType)
        {
            SqlModel insertModel = CreateSqlHelper.SelectSql(t, cols, whereCols, whereType);

            DataTable dataTable = SQLiteHelper.ExecuteDataTable(insertModel.Sql, false, insertModel.SqlParameters);

            List <T> lists = DbConvert.TableToList <T>(dataTable);

            return(lists);
        }
Exemplo n.º 19
0
 public override void FillFromDataRow(DataRow dr)
 {
     this.LanguageID         = DbConvert.ToInt64(dr, "LanguageID");
     this.ShortName          = DbConvert.ToString(dr, "ShortName");
     this.MultiStringID      = DbConvert.ToInt64(dr, "MultiStringID");
     this.Priority           = DbConvert.ToNullableInt32(dr, "Priority");
     this.LastModified       = DbConvert.ToDateTime(dr, "LastModified");
     this.SvrLanguageId      = DbConvert.ToInt64(dr, "SvrLanguageId");
     this.IsTerminalLanguage = DbConvert.ToInt32(dr, "IsTerminalLanguage");
 }
Exemplo n.º 20
0
        public override void FillFromDataRow(DataRow dr)
        {
            this.CompetitorId    = DbConvert.ToInt64(dr, "CompetitorId");
            this.BtrCompetitorId = DbConvert.ToInt64(dr, "BtrCompetitorId");
            this.UpdateId        = DbConvert.ToInt64(dr, "UpdateId");
            this.ExternalState   = DbConvert.ToString(dr, "ExternalState");
            this.Base64Image     = DbConvert.ToString(dr, "Base64Image");

            EnsureExternalObjects();
        }
Exemplo n.º 21
0
 public override void FillFromDataRow(DataRow dr)
 {
     this.match2competitorid = DbConvert.ToInt64(dr, "competitor_to_outright_id");
     this.CompetitorId       = DbConvert.ToInt64(dr, "competitor_id");
     this.MatchId            = DbConvert.ToInt64(dr, "match_id");
     this.hometeam           = DbConvert.ToInt64(dr, "position");
     this.ExtendedId         = DbConvert.ToInt32(dr, "extended_id");
     this.ExtendedState      = DbConvert.ToString(dr, "extended_state");
     this.UpdateId           = DbConvert.ToInt64(dr, "update_id");
 }
Exemplo n.º 22
0
 public override void FillFromDataRow(DataRow dr)
 {
     this.MatchId           = DbConvert.ToInt64(dr, "MatchId");
     this.ExpiryDate.Value  = DbConvert.ToDateTimeSr(dr, "ExpiryDate");
     this.UpdateId          = DbConvert.ToInt64(dr, "UpdateId");
     this.MatchMinute.Value = DbConvert.ToInt32(dr, "MatchMinute");
     this.PeriodInfo.Value  = IntToPeriodInfo(DbConvert.ToInt32(dr, "PeriodInfo"));
     this.Status.Value      = IntToMatchStatus(DbConvert.ToInt32(dr, "Status"));
     this.Score.Value       = DbConvert.ToString(dr, "Score");
 }
Exemplo n.º 23
0
 public override void FillFromDataRow(DataRow dr)
 {
     this.StringId = DbConvert.ToInt64(dr, "string_id");
     this.Category = DbConvert.ToString(dr, "category");
     this.Tag      = DbConvert.ToString(dr, "tag");
     this.Language = DbConvert.ToString(dr, "language");
     this.UpdateId = DbConvert.ToInt64(dr, "update_id");
     this.ObjectId = DbConvert.ToNullableInt64(dr, "object_id");
     this.Text     = DbConvert.ToString(dr, "Text");
 }
Exemplo n.º 24
0
 public override void FillFromDataRow(DataRow dr)
 {
     this.UpdateFileID = DbConvert.ToInt64(dr, "UpdateFileID");
     //this.UpdateId = DbConvert.ToInt64(dr, "UpdateId");
     this.DataSyncCacheID   = DbConvert.ToInt64(dr, "DataSyncCacheID");
     this.DataSyncCacheType = DbConvert.ToString(dr, "DataSyncCacheType");
     this.FileName          = DbConvert.ToString(dr, "FileName");
     this.Description       = DbConvert.ToString(dr, "Description");
     this.CreateDate        = DbConvert.ToDateTime(dr, "CreateDate");
 }
Exemplo n.º 25
0
 public override void FillFromDataRow(DataRow dr)
 {
     this.LanguageStringID    = DbConvert.ToInt64(dr, "LanguageStringId");
     this.Text                = DbConvert.ToString(dr, "Text");
     this.MultiStringID       = DbConvert.ToInt64(dr, "MultiStringID");
     this.LanguageID          = DbConvert.ToInt64(dr, "LanguageID");
     this.LastModified        = DbConvert.ToDateTime(dr, "LastModified");
     this.SvrLanguageStringID = DbConvert.ToInt64(dr, "SvrLanguageStringID");
     this.IsLiveBet           = DbConvert.ToBool(dr, "IsLiveBet");
 }
Exemplo n.º 26
0
        /// <summary>
        /// 将DataSet 转换为PageModel<S> 针对分页查询得到的DataSet
        /// </summary>
        /// <typeparam name="S"></typeparam>
        /// <param name="ds"></param>
        /// <param name="cols"></param>
        /// <returns></returns>
        public PageModel <S> DsToPageModel <S>(DataSet ds, string cols)
        {
            int      total = (int)ds.Tables[0].Rows[0][0];
            List <S> list  = DbConvert.DataTableToList <S>(ds.Tables[1], cols);

            return(new PageModel <S>()
            {
                TotalCount = total, ReList = list
            });
        }
 /// <summary>
 /// 读取可空Guid值
 /// </summary>
 /// <param name="row">数据行</param>
 /// <param name="columns">列集合</param>
 /// <param name="columnName">列名称</param>
 /// <returns>Guid结果</returns>
 protected Guid?LoadNullableGuid(DataRow row, DataColumnCollection columns, String columnName)
 {
     if (columns.Contains(columnName) && !Convert.IsDBNull(row[columnName]))
     {
         return(DbConvert.ToGuid(row[columnName]));
     }
     else
     {
         return(null);
     }
 }
 /// <summary>
 /// 获取实体
 /// </summary>
 /// <param name="table">数据表</param>
 /// <returns>数据表实体</returns>
 internal T GetEntity(DataTable table)
 {
     if (!DbConvert.IsDataTableNullOrEmpty(table))
     {
         return(this.GetEntity(table.Rows[0]));
     }
     else
     {
         return(null);
     }
 }
 /// <summary>
 /// 读取指定类型数据
 /// </summary>
 /// <param name="row">数据行</param>
 /// <param name="columns">列集合</param>
 /// <param name="columnName">列名称</param>
 /// <param name="dbType">数据类型</param>
 /// <typeparam name="TValue">指定类型</typeparam>
 /// <returns>指定类型数据</returns>
 protected Nullable <TValue> LoadNullableValue <TValue>(DataRow row, DataColumnCollection columns, String columnName, DbType dbType) where TValue : struct
 {
     if (columns.Contains(columnName) && !Convert.IsDBNull(row[columnName]))
     {
         return((TValue)DbConvert.ToValue(row[columnName], dbType));
     }
     else
     {
         return(null);
     }
 }
 /// <summary>
 /// 读取指定类型数据
 /// </summary>
 /// <param name="row">数据行</param>
 /// <param name="columns">列集合</param>
 /// <param name="columnName">列名称</param>
 /// <param name="dbType">数据类型</param>
 /// <returns>指定类型数据</returns>
 protected Object LoadNullableValue(DataRow row, DataColumnCollection columns, String columnName, DbType dbType)
 {
     if (columns.Contains(columnName) && !Convert.IsDBNull(row[columnName]))
     {
         return(DbConvert.ToValue(row[columnName], dbType));
     }
     else
     {
         return(null);
     }
 }