zoukankan      html  css  js  c++  java
  • C#.NET 大型通用信息化系统集成快速开发平台 4.1 版本

    代码生成器大数据分页

    下面参考代码是简易的数据权限的实现,大多情况下下面的数据权限的功能可以满足很多企业的需要了

            #region public DataTable GetDataTableByPage(BaseUserInfo userInfo, out int recordCount, int pageIndex = 0, int pageSize = 20, string sortExpression = null, string sortDire = null) 分页查询
            /// <summary>
            /// 分页查询
            /// </summary>
            /// <param name="userInfo">用户</param>
            /// <param name="recordCount">记录数</param>
            /// <param name="pageIndex">当前页</param>
            /// <param name="pageSize">每页显示记录条数</param>
            /// <param name="sortExpression">排序字段</param>
            /// <param name="sortDire">排序方向</param>
            /// <returns>数据表</returns>
            public DataTable GetDataTableByPage(BaseUserInfo userInfo, out int recordCount, int pageIndex = 0, int pageSize = 20, string sortExpression = null, string sortDire = null)
            {
                // 写入调试信息
                #if (DEBUG)
                    int milliStart = BaseBusinessLogic.StartDebug(userInfo, MethodBase.GetCurrentMethod());
                #endif
    
                // 加強安全验证防止未登录用户调用
                #if (!DEBUG)
                    LogOnService.UserIsLogOn(userInfo);
                #endif
    
                var dt = new DataTable(LanNiaoKeJiEntity.TableName);
                
                using (IDbHelper ucDbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.UserCenterDbType))
                {
                    try
                    {
                        ucDbHelper.Open(UserCenterDbConnection);
                        BaseLogManager.Instance.Add(userInfo, this.serviceName, "取得列表", MethodBase.GetCurrentMethod());
    
                        using (IDbHelper dbHelper = DbHelperFactory.GetHelper(BaseSystemInfo.BusinessDbType))
                        {
                            try
                            {
                                dbHelper.Open(BusinessDbConnection);
                                // 取得列表
                                LanNiaoKeJiManager manager = new LanNiaoKeJiManager(dbHelper, userInfo);
                                string order = sortExpression + " " + sortDire;
                                string whereConditional = string.Empty;
                                List<IDbDataParameter> dbParameters = new List<IDbDataParameter>();
                                BaseUserManager userManager = new BaseUserManager();
                                if (userManager.IsInRoleByCode(userInfo, "User"))
                                {
                                    // 普通用户,只能看自己的
                                    whereConditional = BaseBusinessLogic.FieldUserId + "=" + dbHelper.GetParameter(BaseBusinessLogic.FieldUserId);
                                    dbParameters.Add(dbHelper.MakeParameter(BaseBusinessLogic.FieldUserId, userInfo.Id));
                                }
                                else if (userManager.IsInRoleByCode(userInfo, "DepartmentManager"))
                                {
                                    // 部门主管,只能看自己部门的
                                    whereConditional = BaseBusinessLogic.FieldDepartmentId + "=" + dbHelper.GetParameter(BaseBusinessLogic.FieldDepartmentId);
                                    dbParameters.Add(dbHelper.MakeParameter(BaseBusinessLogic.FieldDepartmentId, userInfo.DepartmentId));
                                }
                                else if (userManager.IsInRoleByCode(userInfo, "CompanyManager"))
                                {
                                    // 公司主管,只能看自己公司的
                                    whereConditional = BaseBusinessLogic.FieldCompanyId + "=" + dbHelper.GetParameter(BaseBusinessLogic.FieldCompanyId);
                                    dbParameters.Add(dbHelper.MakeParameter(BaseBusinessLogic.FieldCompanyId, userInfo.CompanyId));
                                }
                                else if (userManager.IsInRoleByCode(userInfo, "Manager"))
                                {
                                    // 管理者,可以看所有的,不限制条件
                                }
                                dt.TableName = LanNiaoKeJiEntity.TableName;
                            }
                            catch (Exception ex)
                            {
                                BaseExceptionManager.LogException(ucDbHelper, userInfo, ex);
                                throw;
                            }
                            finally
                            {
                                dbHelper.Close();
                            }
                        }
                    }
                    catch (Exception ex)
                    {
                        BaseExceptionManager.LogException(ucDbHelper, userInfo, ex);
                        throw;
                    }
                    finally
                    {
                        ucDbHelper.Close();
                    }
                }
    
                // 写入调试信息
                #if (DEBUG)
                    BaseBusinessLogic.EndDebug(userInfo, MethodBase.GetCurrentMethod(), milliStart);
                #endif
    
                return dt;
            }
            #endregion
  • 相关阅读:
    httprunner 3.x学习12
    httprunner 3.x学习11
    PyTorch中.view()与.reshape()方法以及.resize_()方法的对比
    算术编码简介
    量化参数QP:quantization parameter 以及 HEVC
    H.265/HEVC编码结构
    H.265 视频编码中的 CTU, CU, PU, TU
    I帧、P帧、B帧、GOP、IDR 和PTS, DTS之间的关系
    视频编码 率失真性能评价指标:PSNR SSIM BD-rate BD-PSNR
    矢量量化(VQ,Vector Quantization)
  • 原文地址:https://www.cnblogs.com/jirigala/p/3718181.html
Copyright © 2011-2022 走看看