Beispiel #1
0
        public virtual IDataReader GetDataReader(KeyValuePair <string, object> parameter, int topLimit = 0, string order = null)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(parameter);
            return(DbLogic.GetDataReader(DbHelper, this.CurrentTableName, parameters, topLimit, order));
        }
Beispiel #2
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="categoryId">类别主键</param>
        /// <returns>数据表</returns>
        public virtual IDataReader GetDataReaderByCategory(string categoryCode)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldCategoryCode, categoryCode));
            return(DbLogic.GetDataReader(DbHelper, this.CurrentTableName, parameters));
        }
Beispiel #3
0
        public DataTable GetDataTableByPage(BaseUserInfo userInfo, out int recordCount, string tableName, string selectField, int pageIndex, int pageSize, string conditions, IDbDataParameter[] dbParameters, string orderBy)
        {
            DataTable result = null;

            recordCount = 0;
            string connectionString = string.Empty;

            connectionString = ConfigurationHelper.AppSettings("OpenMasDbConnection", BaseSystemInfo.EncryptDbConnection);
            if (!string.IsNullOrEmpty(connectionString))
            {
                if (SecretUtil.IsSqlSafe(conditions))
                {
                    using (IDbHelper dbHelper = DbHelperFactory.GetHelper(CurrentDbType.SqlServer, connectionString))
                    {
                        recordCount = DbLogic.GetCount(dbHelper, tableName, conditions, dbParameters);
                        result      = DbLogic.GetDataTableByPage(dbHelper, tableName, selectField, pageIndex, pageSize, conditions, dbParameters, orderBy);
                    }
                }
                else
                {
                    if (System.Web.HttpContext.Current != null)
                    {
                        // 记录注入日志
                        FileUtil.WriteMessage("userInfo:" + userInfo.Serialize() + " " + conditions, System.Web.HttpContext.Current.Server.MapPath("~/Log/") + "SqlSafe" + DateTime.Now.ToString(BaseSystemInfo.DateFormat) + ".txt");
                    }
                }
            }

            return(result);
        }
        /// <summary>
        /// 检查用户的网卡Mac地址
        /// </summary>
        /// <param name="macAddress">Mac地址</param>
        /// <returns>是否符合限制</returns>
        private bool CheckMacAddress(string macAddress, string userId)
        {
            bool returnValue = false;

            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>(BaseParameterEntity.FieldParameterId, userId));
            parameters.Add(new KeyValuePair <string, object>(BaseParameterEntity.FieldCategoryId, "MacAddress"));
            parameters.Add(new KeyValuePair <string, object>(BaseParameterEntity.FieldEnabled, 1));

            DataTable dt = DbLogic.GetDataTable(this.DbHelper, BaseParameterEntity.TableName, parameters);

            if (dt.Rows.Count > 0)
            {
                string parameterCode   = string.Empty;
                string parameterCotent = string.Empty;

                for (int i = 0; i < dt.Rows.Count; i++)
                {
                    parameterCode   = dt.Rows[i][BaseParameterEntity.FieldParameterCode].ToString();
                    parameterCotent = dt.Rows[i][BaseParameterEntity.FieldParameterContent].ToString();
                    returnValue     = (macAddress.ToLower()).Equals(parameterCotent.ToLower());//简单格式化一下
                    if (returnValue)
                    {
                        break;
                    }
                }
            }
            return(returnValue);
        }
        public virtual int Delete(object id)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>(this.PrimaryKey, id));
            return(DbLogic.Delete(DbHelper, this.CurrentTableName, parameters));
        }
        /// <summary>
        /// 下移记录的方法
        /// </summary>
        /// <param name="dbHelper">当前数据库连接</param>
        /// <param name="tableName">表名</param>
        /// <param name="categoryId">类别主键</param>
        /// <param name="id">当前主键</param>
        /// <returns>目标主键</returns>
        public static int SetDown(IDbHelper dbHelper, string tableName, string categoryId, string id)
        {
            string downId       = string.Empty;
            string sortCode     = string.Empty;
            string downSortCode = string.Empty;
            int    returnValue  = 0;

            downId = GetDownId(dbHelper, tableName, categoryId, id);
            if (downId.Length == 0)
            {
                return(returnValue);
            }
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldId, id));
            sortCode   = DbLogic.GetProperty(dbHelper, tableName, parameters, BaseBusinessLogic.FieldSortCode);
            parameters = new List <KeyValuePair <string, object> >();
            parameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldId, downId));
            downSortCode = DbLogic.GetProperty(dbHelper, tableName, parameters, BaseBusinessLogic.FieldSortCode);

            List <KeyValuePair <string, object> > whereParameters = new List <KeyValuePair <string, object> >();

            whereParameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldId, downId));
            parameters = new List <KeyValuePair <string, object> >();
            parameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldSortCode, sortCode));
            DbLogic.SetProperty(dbHelper, tableName, whereParameters, parameters);

            whereParameters = new List <KeyValuePair <string, object> >();
            whereParameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldId, id));
            parameters = new List <KeyValuePair <string, object> >();
            parameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldSortCode, downSortCode));
            returnValue = DbLogic.SetProperty(dbHelper, tableName, whereParameters, parameters);
            return(returnValue);
        }
        public virtual string GetId(KeyValuePair <string, object> parameter)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(parameter);
            return(DbLogic.GetProperty(DbHelper, this.CurrentTableName, parameters, BaseBusinessLogic.FieldId));
        }
        /// <summary>
        /// 是否合法的用户
        /// 若有用户的Id,这个可以走索引,效率会很高,若没有Id会是全表扫描了。
        /// </summary>
        /// <param name="userId">用户主键</param>
        /// <param name="openId">Key</param>
        /// <param name="systemCode">独立子系统</param>
        /// <returns>合法</returns>
        public bool ValidateOpenId(string userId, string openId, string systemCode = null)
        {
            bool result = false;

            if (string.IsNullOrEmpty(systemCode))
            {
                systemCode = string.Empty;
            }

            // 这个是独立业务系统
            if (systemCode.Equals("PDA"))
            {
                this.CurrentTableName = "PDAUserLogOn";
            }

            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            if (!string.IsNullOrWhiteSpace(userId))
            {
                parameters.Add(new KeyValuePair <string, object>(BaseUserLogOnEntity.FieldId, userId));
            }
            parameters.Add(new KeyValuePair <string, object>(BaseUserLogOnEntity.FieldOpenId, openId));
            result = DbLogic.Exists(DbHelper, this.CurrentTableName, parameters);

            return(result);
        }
        //
        // 读取属性
        //

        public virtual string GetProperty(object id, string targetField)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldId, id));
            return(DbLogic.GetProperty(DbHelper, this.CurrentTableName, parameters, targetField));
        }
        public virtual string GetProperty(KeyValuePair <string, object> parameter, string targetField)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(parameter);
            return(DbLogic.GetProperty(DbHelper, this.CurrentTableName, parameters, targetField));
        }
        public virtual DataTable GetDataTable(KeyValuePair <string, object> parameter, string order)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(parameter);
            return(DbLogic.GetDataTable(DbHelper, this.CurrentTableName, parameters, 0, order));
        }
Beispiel #12
0
        //
        // 设置属性
        //

        public virtual int SetProperty(KeyValuePair <string, object> parameter)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(parameter);
            return(DbLogic.SetProperty(DbHelper, this.CurrentTableName, null, parameters));
        }
 public virtual string[] GetProperties(KeyValuePair<string, object> parameter1, KeyValuePair<string, object> parameter2, string targetField)
 {
     List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>();
     parameters.Add(parameter1);
     parameters.Add(parameter2);
     return DbLogic.GetProperties(DbHelper, this.CurrentTableName, parameters, 0, targetField);
 }
Beispiel #14
0
        public virtual IDataReader ExecuteReader(KeyValuePair <string, object> parameter, string order)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(parameter);
            return(DbLogic.ExecuteReader(DbHelper, this.CurrentTableName, parameters, 0, order));
        }
Beispiel #15
0
        public virtual bool Exists(KeyValuePair <string, object> parameter, object id)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(parameter);
            return(DbLogic.Exists(DbHelper, this.CurrentTableName, parameters, new KeyValuePair <string, object>(this.PrimaryKey, id)));
        }
        /// <summary>
        /// 获取主键
        /// </summary>
        /// <param name="openId">编号</param>
        /// <returns>主键</returns>
        public string GetIdByOpenId(string openId)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>(BaseUserLogOnEntity.FieldOpenId, openId));
            return(DbLogic.GetProperty(DbHelper, this.CurrentTableName, parameters, BaseUserLogOnEntity.FieldId));
        }
Beispiel #17
0
        /// <summary>
        /// 获得序列
        /// </summary>
        /// <param name="fullName">序列名</param>
        /// <param name="defaultSequence">默认序列</param>
        /// <returns>序列实体</returns>
        protected BaseSequenceEntity GetSequenceByLock(string fullName, int defaultSequence)
        {
            BaseSequenceEntity sequenceEntity = new BaseSequenceEntity();

            // 这里主要是为了判断是否存在
            sequenceEntity = this.GetEntityByName(fullName);
            if (sequenceEntity == null)
            {
                // 这里添加记录时加锁机制。
                // 是否已经被锁住
                this.ReturnStatusCode = StatusCode.CanNotLock.ToString();
                for (int i = 0; i < BaseSystemInfo.LockNoWaitCount; i++)
                {
                    // 被锁定的记录数
                    int lockCount = DbLogic.LockNoWait(DbHelper, BaseSequenceEntity.TableName, new KeyValuePair <string, object>(BaseSequenceEntity.FieldFullName, BaseSequenceEntity.TableName));
                    if (lockCount > 0)
                    {
                        sequenceEntity.FullName  = fullName;
                        sequenceEntity.Reduction = defaultSequence - 1;
                        sequenceEntity.Sequence  = defaultSequence;
                        sequenceEntity.Step      = DefaultStep;
                        this.AddEntity(sequenceEntity);

                        this.ReturnStatusCode = StatusCode.LockOK.ToString();
                        break;
                    }
                    else
                    {
                        System.Threading.Thread.Sleep(BaseRandom.GetRandom(1, BaseSystemInfo.LockNoWaitTickMilliSeconds));
                    }
                }
                if (this.ReturnStatusCode == StatusCode.LockOK.ToString())
                {
                    // JiRiGaLa 这个是否能省略
                    sequenceEntity = this.GetEntityByName(fullName);
                }
            }
            else
            {
                // 若记录已经存在,加锁,然后读取记录。
                // 是否已经被锁住
                this.ReturnStatusCode = StatusCode.CanNotLock.ToString();
                for (int i = 0; i < BaseSystemInfo.LockNoWaitCount; i++)
                {
                    // 被锁定的记录数
                    int lockCount = DbLogic.LockNoWait(DbHelper, BaseSequenceEntity.TableName, new KeyValuePair <string, object>(BaseSequenceEntity.FieldFullName, fullName));
                    if (lockCount > 0)
                    {
                        sequenceEntity        = this.GetEntityByName(fullName);
                        this.ReturnStatusCode = StatusCode.LockOK.ToString();
                        break;
                    }
                    else
                    {
                        System.Threading.Thread.Sleep(BaseRandom.GetRandom(1, BaseSystemInfo.LockNoWaitTickMilliSeconds));
                    }
                }
            }
            return(sequenceEntity);
        }
        /// <summary>
        /// 分页查询
        /// </summary>
        /// <param name="searchValue">查询字段</param>
        /// <param name="companyId">公司主键</param>
        /// <param name="departmentId">部门主键</param>
        /// <param name="roleId">角色主键</param>
        /// <param name="recordCount">记录数</param>
        /// <param name="pageIndex">当前页</param>
        /// <param name="pageSize">每页显示</param>
        /// <param name="order">排序</param>
        /// <returns>数据表</returns>
        public DataTable GetDataTableByPage(string searchValue, string companyId, string departmentId, string roleId, out int recordCount, int pageIndex = 0, int pageSize = 20, string order = null)
        {
            string whereClause = BaseStaffEntity.TableName + "." + BaseStaffEntity.FieldDeletionStateCode + " = 0 "
                                 + " AND " + BaseStaffEntity.TableName + "." + BaseStaffEntity.FieldEnabled + " = 1 ";

            if (!String.IsNullOrEmpty(companyId))
            {
                whereClause += " AND (" + BaseStaffEntity.TableName + "." + BaseStaffEntity.FieldCompanyId + " = " + companyId + ")";
            }
            if (!String.IsNullOrEmpty(departmentId))
            {
                whereClause += " AND (" + BaseStaffEntity.TableName + "." + BaseStaffEntity.FieldDepartmentId + " = " + departmentId + ")";
            }
            if (!string.IsNullOrEmpty(searchValue))
            {
                searchValue  = "'" + StringUtil.GetSearchString(searchValue) + "'";
                whereClause += " AND (" + BaseStaffEntity.FieldRealName + " LIKE " + searchValue;
                whereClause += " OR " + BaseStaffEntity.FieldUserName + " LIKE " + searchValue;
                whereClause += " OR " + BaseStaffEntity.FieldQuickQuery + " LIKE " + searchValue + ")";
                // whereClause += " OR " + BaseStaffEntity.FieldSimpleSpelling + " LIKE " + searchValue + ")";
            }
            recordCount           = DbLogic.GetCount(DbHelper, this.CurrentTableName, whereClause);
            this.CurrentTableName = "BaseStaff";

            return(DbLogic.GetDataTableByPage(DbHelper, this.CurrentTableName, this.SelectFields, pageIndex, pageSize, whereClause, order));
        }
Beispiel #19
0
        /// <summary>
        /// 获取分页数据(防注入功能的)
        /// </summary>
        /// <param name="recordCount">记录条数</param>
        /// <param name="tableName">数据来源表名</param>
        /// <param name="selectField">选择字段</param>
        /// <param name="pageIndex">当前页</param>
        /// <param name="pageSize">每页显示多少条</param>
        /// <param name="conditions">查询条件</param>
        /// <param name="dbParameters">查询参数</param>
        /// <param name="orderBy">排序字段</param>
        /// <returns>数据表</returns>
        public DataTable GetDataTableByPage(BaseUserInfo userInfo, out int recordCount, string tableName, string selectField, int pageIndex, int pageSize, string conditions, List <KeyValuePair <string, object> > dbParameters, string orderBy)
        {
            DataTable result = null;
            // 判断是否已经登录的用户?
            var userManager = new BaseUserManager(userInfo);

            recordCount = 0;
            // 判断是否已经登录的用户?
            if (userManager.UserIsLogOn(userInfo))
            {
                if (SecretUtil.IsSqlSafe(conditions))
                {
                    recordCount = DbLogic.GetCount(DbHelper, tableName, conditions, DbHelper.MakeParameters(dbParameters));
                    result      = DbLogic.GetDataTableByPage(DbHelper, tableName, selectField, pageIndex, pageSize, conditions, DbHelper.MakeParameters(dbParameters), orderBy);
                }
                else
                {
                    if (System.Web.HttpContext.Current != null)
                    {
                        // 记录注入日志
                        DotNet.Utilities.FileUtil.WriteMessage("userInfo:" + userInfo.Serialize() + " " + conditions, System.Web.HttpContext.Current.Server.MapPath("~/Log/") + "SqlSafe" + DateTime.Now.ToString(BaseSystemInfo.DateFormat) + ".txt");
                    }
                }
            }
            return(result);
        }
 /// <summary>
 /// 分页读取数据
 /// </summary>
 /// <param name="recordCount">页面个数</param>
 /// <param name="pageIndex">当前页</param>
 /// <param name="pageSize">每页显示</param>
 /// <param name="tableName">从什么表</param>
 /// <param name="whereConditional">条件</param>
 /// <param name="selectField">选择哪些字段</param>
 /// <returns>数据表</returns>
 public virtual DataTable GetDataTableByPage(out int recordCount, int pageIndex = 1, int pageSize = 20, string sortExpression = null, string sortDire = null, string tableName = null, string whereConditional = null, string selectField = null)
 {
     if (tableName.ToUpper().IndexOf("SELECT") >= 0)
     {
         // 统计总条数
         string commandText = string.Empty;
         if (string.IsNullOrEmpty(tableName))
         {
             tableName = this.CurrentTableName;
         }
         commandText = tableName;
         if (tableName.ToUpper().IndexOf("SELECT") >= 0)
         {
             commandText = "(" + tableName + ") AS T ";
         }
         commandText = string.Format("SELECT COUNT(1) AS recordCount FROM {0}", commandText);
         object returnObject = DbHelper.ExecuteScalar(commandText);
         if (returnObject != null)
         {
             recordCount = int.Parse(returnObject.ToString());
         }
         else
         {
             recordCount = 0;
         }
         return(DbLogic.GetDataTableByPage(DbHelper, recordCount, pageIndex, pageSize, tableName, sortExpression, sortDire));
     }
     // 这个是调用存储过程的方法
     return(DbLogic.GetDataTableByPage(DbHelper, out recordCount, pageIndex, pageSize, sortExpression, sortDire, tableName, whereConditional, selectField));
 }
Beispiel #21
0
        /// <summary>
        /// 按父亲节点获取数据
        /// </summary>
        /// <param name="parentId">父节点主键</param>
        /// <returns>数据表</returns>
        public virtual IDataReader GetDataReaderByParent(string parentId)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldParentId, parentId));
            return(DbLogic.GetDataReader(DbHelper, this.CurrentTableName, parameters, 0, BaseBusinessLogic.FieldSortCode));
        }
        /// <summary>
        ///
        /// </summary>
        /// <param name="userInfo"></param>
        /// <param name="resourceCategory"></param>
        /// <param name="targetId"></param>
        /// <param name="targetResourceCategory"></param>
        /// <param name="permissionItemCode"></param>
        /// <returns></returns>
        public string[] GetPermissionScopeResourceIds(BaseUserInfo userInfo, string resourceCategory, string targetId, string targetResourceCategory, string permissionItemCode)
        {
            // 写入调试信息
            #if (DEBUG)
            int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
            #endif

            // 加强安全验证防止未授权匿名调用
            #if (!DEBUG)
            LogOnService.UserIsLogOn(userInfo);
            #endif

            string[] returnValue = null;
            using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
            {
                try
                {
                    dbHelper.Open(UserCenterDbConnection);
                    string tableName = BasePermissionItemEntity.TableName;
                    if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode))
                    {
                        tableName = BaseSystemInfo.SystemCode + "PermissionItem";
                    }
                    BasePermissionItemManager permissionItemManager = new BasePermissionItemManager(dbHelper, userInfo, tableName);
                    string permissionItemId = permissionItemManager.GetId(new KeyValuePair <string, object>(BasePermissionItemEntity.FieldCode, permissionItemCode));

                    List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();
                    parameters.Add(new KeyValuePair <string, object>(BasePermissionScopeEntity.FieldTargetId, targetId));
                    parameters.Add(new KeyValuePair <string, object>(BasePermissionScopeEntity.FieldResourceCategory, resourceCategory));
                    parameters.Add(new KeyValuePair <string, object>(BasePermissionScopeEntity.FieldPermissionItemId, permissionItemId));
                    parameters.Add(new KeyValuePair <string, object>(BasePermissionScopeEntity.FieldTargetCategory, targetResourceCategory));
                    parameters.Add(new KeyValuePair <string, object>(BasePermissionScopeEntity.FieldEnabled, 1));
                    parameters.Add(new KeyValuePair <string, object>(BasePermissionScopeEntity.FieldDeletionStateCode, 0));

                    tableName = BasePermissionScopeEntity.TableName;
                    if (!string.IsNullOrEmpty(BaseSystemInfo.SystemCode))
                    {
                        tableName = BaseSystemInfo.SystemCode + "PermissionScope";
                    }
                    returnValue = DbLogic.GetProperties(dbHelper, tableName, parameters, 0, BasePermissionScopeEntity.FieldResourceId);
                    BaseLogManager.Instance.Add(dbHelper, userInfo, this.serviceName, MethodBase.GetCurrentMethod());
                }
                catch (Exception ex)
                {
                    BaseExceptionManager.LogException(dbHelper, userInfo, ex);
                    throw ex;
                }
                finally
                {
                    dbHelper.Close();
                }
            }

            // 写入调试信息
            #if (DEBUG)
            BaseBusinessLogic.EndDebug(MethodBase.GetCurrentMethod(), milliStart);
            #endif
            return(returnValue);
        }
Beispiel #23
0
 /// <summary>
 /// 按名称获取主键
 /// </summary>
 /// <param name="realName">名称</param>
 /// <returns>主键</returns>
 public string GetIdByRealName(string realName)
 {
     List<KeyValuePair<string, object>> parameters = new List<KeyValuePair<string, object>>();
     parameters.Add(new KeyValuePair<string, object>(BaseRoleEntity.FieldRealName, realName));
     parameters.Add(new KeyValuePair<string, object>(BaseRoleEntity.FieldDeletionStateCode, 0));
     parameters.Add(new KeyValuePair<string, object>(BaseRoleEntity.FieldEnabled, 1));
     return DbLogic.GetProperty(DbHelper, this.CurrentTableName, parameters, BaseBusinessLogic.FieldId);
 }
Beispiel #24
0
        public virtual bool Exists(KeyValuePair <string, object> parameter1, KeyValuePair <string, object> parameter2, KeyValuePair <string, object> parameter)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(parameter1);
            parameters.Add(parameter2);
            return(DbLogic.Exists(DbHelper, this.CurrentTableName, parameters, parameter));
        }
        /// <summary>
        /// 获取主键
        /// </summary>
        /// <param name="code">编号</param>
        /// <returns>主键</returns>
        public virtual string GetIdByCode(string code)
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldCode, code));
            parameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldDeletionStateCode, 0));
            return(DbLogic.GetProperty(DbHelper, this.CurrentTableName, parameters, BaseBusinessLogic.FieldId));
        }
Beispiel #26
0
        /// <summary>
        /// 获取列表
        /// </summary>
        /// <param name="categoryId">类别主键</param>
        /// <returns>数据表</returns>
        public virtual List <T> GetListByCategory <T>(string categoryId) where T : new()
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(new KeyValuePair <string, object>(BaseBusinessLogic.FieldCategoryId, categoryId));
            IDataReader dr = DbLogic.GetDataReader(DbHelper, this.CurrentTableName, parameters);

            return(GetList <T>(dr));
        }
Beispiel #27
0
        public virtual List <T> GetList <T>(KeyValuePair <string, object> parameter, int topLimit, string order) where T : new()
        {
            List <KeyValuePair <string, object> > parameters = new List <KeyValuePair <string, object> >();

            parameters.Add(parameter);
            IDataReader dr = DbLogic.GetDataReader(DbHelper, this.CurrentTableName, parameters, topLimit, order);

            return(GetList <T>(dr));
        }
        public virtual string GetId(params KeyValuePair <string, object>[] parameters)
        {
            List <KeyValuePair <string, object> > parameterList = new List <KeyValuePair <string, object> >();

            foreach (var parameter in parameters)
            {
                parameterList.Add(parameter);
            }
            return(DbLogic.GetProperty(DbHelper, this.CurrentTableName, parameterList, BaseBusinessLogic.FieldId));
        }
Beispiel #29
0
        public virtual bool Exists(params KeyValuePair <string, object>[] parameters)
        {
            List <KeyValuePair <string, object> > parametersList = new List <KeyValuePair <string, object> >();

            for (int i = 0; i < parameters.Length; i++)
            {
                parametersList.Add(parameters[i]);
            }
            return(DbLogic.Exists(DbHelper, this.CurrentTableName, parametersList));
        }
Beispiel #30
0
        public virtual List<T> GetList<T>(string name, Object[] values, string order = null) where T : BaseEntity, new()
        {
            List<T> result = new List<T>();

            using (IDataReader dr = DbLogic.ExecuteReader(DbHelper, this.CurrentTableName, "*", name, values, order))
            {
                result = GetList<T>(dr);
            }

            return result;
        }