Beispiel #1
0
        /// <summary>
        /// 根据角色ID获取主体权限
        /// </summary>
        /// <param name="RID"></param>
        /// <returns></returns>
        public List <MainAuthority> GetAllMainAuthoritiesByRID(string RID)
        {
            string           sql = @"select a.主体权限id AID ,
                                    a.角色id RoleID ,         
                                    a.主体id MID ,
                                    a.主体名称 MainName ,
                                    a.类型 Type ,
                                    a.权限类型 AuthorityType ,
                                    a.关联资源ID RID ,
                                    a.关联资源明细ID DID ,
                                    a.最后修改人 LastModify ,
                                    a.最后修改时间 LastDate 
                                    from 主体权限 a
                                    where a.角色ID = :RID";
            OracleDataAccess oracleDataAccess = new OracleDataAccess(SiteConfig.OracleConn);

            OracleParameter[] oracleParameters =
            {
                new OracleParameter(":RID", OracleDbType.Varchar2, RID, ParameterDirection.Input)
            };
            DataTable            dataTable       = oracleDataAccess.ExecuteDataTable(sql, System.Data.CommandType.Text, oracleParameters);
            List <MainAuthority> mainAuthorities = ModelConvert.DataTableToIList <MainAuthority>(dataTable).ToList();

            return(mainAuthorities);
        }
Beispiel #2
0
        public ResGetUser Get([FromForm] ReqGetUser user)
        {
            ResGetUser retValue = new ResGetUser();

            try
            {
                using (var db = DbContext.GetInstance())
                {
                    var my = db.Queryable <T_USERS>()
                             .Where(s => s.ID == user.ID)
                             .FirstOrDefault();

                    UsersBase users = new UsersBase();
                    //转化成前端友好的数据
                    users = ModelConvert.FromTo <T_USERS, UsersBase>(my, users);
                    retValue.SuccessDefalut(users, 1, "不存在该用户");
                }
            }
            catch (Exception ex)
            {
                retValue.FailDefalut(ex);
            }

            return(retValue);
        }
Beispiel #3
0
        public ResGetUser GetUrl([FromForm] ReqGetUser user)
        {
            ResGetUser retValue   = new ResGetUser();
            string     logContent = string.Empty;

            try
            {
                using (var db = DbContext.GetInstance(ref logContent))
                {
                    var my = db.Queryable <T_USERS>()
                             .Where(s => s.ID == user.ID)
                             .FirstOrDefault();
                    //转化成前端友好的数据
                    UsersBase users = new UsersBase();
                    users = ModelConvert.FromTo <T_USERS, UsersBase>(my, users);
                    retValue.SuccessDefalut(users, 1, "不存在该用户");

                    //记录日志
                    Startup.log.Info(LogHelper.LogDetails(logContent, user, retValue));
                }
            }
            catch (Exception ex)
            {
                retValue.FailDefalut(ex);
                Startup.log.Error(logContent, ex);
            }

            return(retValue);
        }
Beispiel #4
0
        private static IEnumerable <MemberExpression> MapProperty(ModelPropertyInfo argumentProperty, WhereBuilderContext context)
        {
            var info = context.ElementModel;

            List <string>            names = new List <string>(5);
            List <ModelPropertyInfo> chain = new List <ModelPropertyInfo>(5);

            names.AddRange(argumentProperty.Maps.Where(o => o.SourceType == info.ModelType).Select(o => o.PropertyName));
            if (names.Count == 0)
            {
                names.Add(argumentProperty.Name);
            }

            foreach (string name in names.Distinct())
            {
                chain.Clear();

                ModelConvert.FillPropertyChain(info, name, chain);

                Debug.Assert(chain.Count > 0);

                MemberExpression member = null;

                foreach (var mp in chain)
                {
                    member = Expression.MakeMemberAccess((Expression)member ?? context.Parameter, mp.PropertyInfo);
                }

                yield return(member);
            }
        }
Beispiel #5
0
        /// <summary>
        /// 获取 要素目录/资源目录/资源分类/统计指标定义/计算要素条件 联合查询
        /// </summary>
        /// <param name="RID"></param>
        /// <returns></returns>
        public List <Element> GetAllElementByResourceID(string RID)
        {
            string sql = @"select   a.要素id EID,
                                    a.资源id RID,
                                    a.要素名称 Name,
                                    a.要素类型 Type,
                                    a.单位 Unit,
                                    a.备注 Note,
                                    a.最后修改人 LastModify,
                                    a.最后修改时间 LastDate,
                                    a.默认值 Defaulta,
                                    a.选项类型 OptionType,
                                    a.序号 Numbera,
                                    a.长度 Length,
                                    a.精度 Precision,
                                    a.是否必填 IFRequired,
                                    a.是否展示主目录 IFZSZML,
                                    a.名称是否展示 IFZSMC,
                                    a.要素分类 ElementClassify,
                                    b.资源名称 ResourceName,                                
                                    c.分类名称 ClassifyName,                                                       
                                    count(d.指标定义id) DYZBGS,
                                    e.表达式文本 Text FROM 要素目录 a,资源目录 b,资源分类 c,统计指标定义 d,计算要素条件 e 
                                    where a.资源id= '{0}' and a.资源id=b.资源id(+)
                                    and a.分类id=c.资源分类id(+)
                                    and a.要素id=d.关联id(+) 
                                    and a.要素id=e.要素id(+)
                                    group by a.要素id,
                                    a.资源id,
                                    a.要素名称,
                                    a.要素类型,
                                    a.单位,
                                    a.备注,
                                    a.最后修改人,
                                    a.最后修改时间,
                                    a.默认值,
                                    a.选项类型,
                                    a.序号,
                                    a.长度,
                                    a.精度,
                                    a.是否必填,
                                    a.是否展示主目录,
                                    a.名称是否展示,
                                    a.要素分类,
                                    b.资源名称,                                
                                    c.分类名称,                                                       
                                    e.表达式文本
                                    order by a.序号";

            sql = string.Format(sql, RID);
            //数据库连接
            OracleDataAccess oracleDataAccess = new OracleDataAccess(SiteConfig.OracleConn);

            DataTable      dataTable = oracleDataAccess.ExecuteDataTable(sql, System.Data.CommandType.Text, null);
            List <Element> elements  = ModelConvert.DataTableToIList <Element>(dataTable).ToList();

            return(elements);
        }
Beispiel #6
0
        /// <summary>
        /// 获取v_要素资源值域
        /// </summary>
        /// <returns></returns>
        public List <DR> GetAllDR()
        {
            string           sql = @"select 资源名称 Name,资源ID RID,类型 Type from V_要素资源值域 ";
            OracleDataAccess oracleDataAccess = new OracleDataAccess(SiteConfig.OracleConn);
            DataTable        dataTable        = oracleDataAccess.ExecuteDataTable(sql, System.Data.CommandType.Text, null);
            List <DR>        dr = ModelConvert.DataTableToIList <DR>(dataTable).ToList();

            return(dr);
        }
Beispiel #7
0
        /// <summary>
        /// 获取角色信息
        /// </summary>
        /// <returns></returns>
        public List <MainAuthority> GetAllRoleInfo()
        {
            string               sql = @"Select distinct a.角色ID RoleID,a.角色名称 RoleName
                            From 角色信息 a ,角色用户信息 b
                            Where a.角色ID = b.角色ID";
            OracleDataAccess     oracleDataAccess = new OracleDataAccess(SiteConfig.OracleConn);
            DataTable            dataTable        = oracleDataAccess.ExecuteDataTable(sql, System.Data.CommandType.Text, null);
            List <MainAuthority> mainAuthority    = ModelConvert.DataTableToIList <MainAuthority>(dataTable).ToList();

            return(mainAuthority);
        }
Beispiel #8
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public Account GetModel_StudentID(int StudentID)
        {
            var strSql = new StringBuilder();

            strSql.Append(@"REPOS:Ticket.Account.GetModel_StudentID");
            var parameters = new List <QfParameter>();

            parameters.Add(new QfParameter("@StudentID", StudentID));
            var model = new Account();
            var ds    = Query(strSql.ToString(), parameters.ToArray());

            return(ModelConvert.ToModel <Account>(ds));
        }
Beispiel #9
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ApplyAssessment GetModel(int ApplyAssessmentID)
        {
            var strSql = new StringBuilder();

            strSql.Append(@"REPOS:ApplyAssessment.ApplyAssessment.GetModel");
            var parameters = new List <QfParameter>();

            parameters.Add(new QfParameter("@ApplyAssessmentID", ApplyAssessmentID));

            var model = new ApplyAssessment();
            var ds    = Query(strSql.ToString(), parameters.ToArray());

            return(ModelConvert.ToModel <ApplyAssessment>(ds));
        }
Beispiel #10
0
        /// <summary>
        /// 根据资源ID获取资源类型
        /// </summary>
        /// <param name="RID"></param>
        /// <returns></returns>
        public List <Resource> GetTypeByRID(string RID)
        {
            string           sql = @"select 类型 Type from 资源目录 where 资源ID = :RID";
            OracleDataAccess oracleDataAccess = new OracleDataAccess(SiteConfig.OracleConn);

            OracleParameter[] oracleParameters =
            {
                new OracleParameter(":RID", OracleDbType.Varchar2, RID, ParameterDirection.Input)
            };
            DataTable       dataTable     = oracleDataAccess.ExecuteDataTable(sql, System.Data.CommandType.Text, oracleParameters);
            List <Resource> resourcesType = ModelConvert.DataTableToIList <Resource>(dataTable).ToList();

            return(resourcesType);
        }
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public ProcessDefinition GetModel(int DefinitionID)
        {
            var strSql = new StringBuilder();

            strSql.Append(@"REPOS:Process.ProcessDefinition.GetModel");
            var parameters = new List <QfParameter>();

            parameters.Add(new QfParameter("@DefinitionID", DefinitionID));

            var model = new ProcessDefinition();
            var ds    = Query(strSql.ToString(), parameters.ToArray());

            return(ModelConvert.ToModel <ProcessDefinition>(ds));
        }
Beispiel #12
0
        /// <summary>
        /// 获取全部角色信息
        /// </summary>
        /// <returns></returns>
        public List <RoleInformation> GetAllRoleInformation()
        {
            string                 sql = @"select 角色ID ID,
                                    角色名称 Name,
                                    备注 Note,
                                    最后修改人 LastModify,
                                    最后修改时间 LastDate
                                    from 角色信息";
            OracleDataAccess       oracleDataAccess = new OracleDataAccess(SiteConfig.OracleConn);
            DataTable              dataTable        = oracleDataAccess.ExecuteDataTable(sql, System.Data.CommandType.Text, null);
            List <RoleInformation> roleInformation  = ModelConvert.DataTableToIList <RoleInformation>(dataTable).ToList();

            return(roleInformation);
        }
Beispiel #13
0
        /// <summary>
        /// 获取设计页面信息
        /// </summary>
        /// <returns></returns>
        public List <Designpage> GetAllDesignpage()
        {
            string            sql = @"select 编码 Code,
                                    名称 Name,
                                    描述 Description,
                                    最后修改人 LastModify,
                                    最后修改时间 LastDate
                                    from 设计页面";
            OracleDataAccess  oracleDataAccess = new OracleDataAccess(SiteConfig.OracleConn);
            DataTable         dataTable        = oracleDataAccess.ExecuteDataTable(sql, System.Data.CommandType.Text, null);
            List <Designpage> designpages      = ModelConvert.DataTableToIList <Designpage>(dataTable).ToList();

            return(designpages);
        }
Beispiel #14
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TicketEq GetModel(string SN)
        {
            var strSql = new StringBuilder();

            strSql.Append(@"REPOS:Ticket.TicketEq.GetModel");
            var parameters = new List <QfParameter>();

            parameters.Add(new QfParameter("@SN", SN));

            var model = new TicketEq();
            var ds    = Query(strSql.ToString(), parameters.ToArray());

            return(ModelConvert.ToModel <TicketEq>(ds));
        }
Beispiel #15
0
        /// <summary>
        /// 得到一个对象实体
        /// </summary>
        public TicketRule GetModel(int TicketRuleID)
        {
            var strSql = new StringBuilder();

            strSql.Append(@"REPOS:Ticket.TicketRule.GetModel");
            var parameters = new List <QfParameter>();

            parameters.Add(new QfParameter("@TicketRuleID", TicketRuleID));

            var model = new TicketRule();
            var ds    = Query(strSql.ToString(), parameters.ToArray());

            return(ModelConvert.ToModel <TicketRule>(ds));
        }
Beispiel #16
0
        /// <summary>
        /// 根据角色ID获取主体权限ID
        /// </summary>
        /// <param name="RoleID">角色ID</param>
        /// <returns></returns>
        public List <MainAuthority> GetAllAIDByRoleID(string RoleID)
        {
            string           sql = @"select 主体权限ID AID from 主体权限 where 角色ID = :RoleID";
            OracleDataAccess oracleDataAccess = new OracleDataAccess(SiteConfig.OracleConn);

            OracleParameter[] oracleParameters =
            {
                new OracleParameter(":RoleID", OracleDbType.Varchar2, RoleID, ParameterDirection.Input),
            };
            DataTable            dataTable     = oracleDataAccess.ExecuteDataTable(sql, System.Data.CommandType.Text, oracleParameters);
            List <MainAuthority> mainAuthority = ModelConvert.DataTableToIList <MainAuthority>(dataTable).ToList();

            return(mainAuthority);
        }
 /// <summary>
 /// 简单查询
 /// </summary>
 /// <param name="sql"></param>
 public List <CarDispatch> QueryGetList(string sql)
 {
     try
     {
         DataTable          dt    = MysqlHelper.ExecuteDataTable(sql);
         List <CarDispatch> _list = ModelConvert.ToList <CarDispatch>(dt);
         return(_list);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(null);
     }
 }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 /// <param name="sql"></param>
 public CarDispatch GetModel(int DispatchID)
 {
     try
     {
         string      sql   = string.Format("select * from t_car_dispatch where DispatchID = {0} limit 1", DispatchID);
         DataTable   dt    = MysqlHelper.ExecuteDataTable(sql);
         CarDispatch model = ModelConvert.ToModel <CarDispatch>(dt);
         return(model);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(null);
     }
 }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 /// <param name="sql"></param>
 public CarApplySocialpeople GetModel(int SocialPeopleID)
 {
     try
     {
         string               sql   = string.Format("select * from t_car_apply_socialpeople where SocialPeopleID = {0} limit 1", SocialPeopleID);
         DataTable            dt    = MysqlHelper.ExecuteDataTable(sql);
         CarApplySocialpeople model = ModelConvert.ToModel <CarApplySocialpeople>(dt);
         return(model);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(null);
     }
 }
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <param name="sql"></param>
 public List <CarDispatch> GetList()
 {
     try
     {
         string             sql   = string.Format("select * from t_car_dispatch");
         DataTable          dt    = MysqlHelper.ExecuteDataTable(sql);
         List <CarDispatch> _list = ModelConvert.ToList <CarDispatch>(dt);
         return(_list);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(null);
     }
 }
Beispiel #21
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 /// <param name="sql"></param>
 public CarRepairItem GetModel(int ItemID)
 {
     try
     {
         string        sql   = string.Format("select * from t_car_repair_item where ItemID = {0} limit 1", ItemID);
         DataTable     dt    = MysqlHelper.ExecuteDataTable(sql);
         CarRepairItem model = ModelConvert.ToModel <CarRepairItem>(dt);
         return(model);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(null);
     }
 }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 /// <param name="sql"></param>
 public Duty GetModel(int DutyID)
 {
     try
     {
         string    sql   = string.Format("select * from t_duty where DutyID = {0} limit 1", DutyID);
         DataTable dt    = MysqlHelper.ExecuteDataTable(sql);
         Duty      model = ModelConvert.ToModel <Duty>(dt);
         return(model);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(null);
     }
 }
Beispiel #23
0
        private static Tuple <Sort, LambdaExpression> ParseSort(Sort sort, ModelInfo model)
        {
            List <ModelPropertyInfo> chain = new List <ModelPropertyInfo>(3);

            ModelConvert.FillPropertyChain(model, sort.PropertyName, chain);
            ParameterExpression parameter = Expression.Parameter(model.ModelType, "obj");
            MemberExpression    member    = null;

            foreach (var mp in chain)
            {
                member = Expression.MakeMemberAccess((Expression)member ?? parameter, mp.PropertyInfo);
            }

            return(Tuple.Create(sort, Expression.Lambda(typeof(Func <,>).MakeGenericType(model.ModelType, member.Type), member, parameter)));
        }
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <param name="sql"></param>
 public CarApplySocialpeople GetModelByID(int id)
 {
     try
     {
         string    sql = string.Format("select * from t_car_apply_socialpeople where ApplyID = {0}", id);
         DataTable dt  = MysqlHelper.ExecuteDataTable(sql);
         List <CarApplySocialpeople> _list = ModelConvert.ToList <CarApplySocialpeople>(dt);
         return(_list.Count == 0 ? null : _list[0]);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(null);
     }
 }
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 /// <param name="sql"></param>
 public CarriageReturn GetModel(int ReturnID)
 {
     try
     {
         string         sql   = string.Format("select * from t_carriage_return where ReturnID = {0} limit 1", ReturnID);
         DataTable      dt    = MysqlHelper.ExecuteDataTable(sql);
         CarriageReturn model = ModelConvert.ToModel <CarriageReturn>(dt);
         return(model);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(null);
     }
 }
Beispiel #26
0
 /// <summary>
 /// 得到一个对象实体
 /// </summary>
 /// <param name="sql"></param>
 public Employee GetModel(int EmployeeID)
 {
     try
     {
         string    sql   = string.Format("select * from t_employee where EmployeeID = {0} limit 1", EmployeeID);
         DataTable dt    = MysqlHelper.ExecuteDataTable(sql);
         Employee  model = ModelConvert.ToModel <Employee>(dt);
         return(model);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(null);
     }
 }
Beispiel #27
0
        /// <summary>
        /// 获取通用编码目录
        /// </summary>
        /// <returns></returns>
        public List <GCodedir> GetAllGCodedir()
        {
            string           sql = @"select 目录ID ID,
                                    目录名称 Name,
                                    备注 Note,
                                    最后修改人 LastModify,
                                    最后修改时间 LastDate,
                                    是否树形 TreeForm
                                    from 通用编码目录";
            OracleDataAccess oracleDataAccess = new OracleDataAccess(SiteConfig.OracleConn);
            DataTable        dataTable        = oracleDataAccess.ExecuteDataTable(sql, System.Data.CommandType.Text, null);
            List <GCodedir>  gCodedir         = ModelConvert.DataTableToIList <GCodedir>(dataTable).ToList();

            return(gCodedir);
        }
Beispiel #28
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <param name="sql"></param>
 public List <CarRepairItem> GetList()
 {
     try
     {
         string               sql   = string.Format(@"select a.*, b.EmployeeName from t_car_repair_item a 
                                         left join t_employee b on a.OperateID = b.EmployeeID ");
         DataTable            dt    = MysqlHelper.ExecuteDataTable(sql);
         List <CarRepairItem> _list = ModelConvert.ToList <CarRepairItem>(dt);
         return(_list);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
         return(null);
     }
 }
Beispiel #29
0
        public object ConvertTo(object source, Type type)
        {
            if (source == null)
            {
                throw new ArgumentNullException(nameof(source));
            }

            Type st = source.GetType();

            if (st != ModelType && !st.IsSubclassOf(ModelType))
            {
                throw new ArgumentException("Source type mismatch.");
            }

            return(ModelConvert.Convert(source, type, Options));
        }
Beispiel #30
0
 /// <summary>
 /// 获得数据列表
 /// </summary>
 /// <param name="sql"></param>
 public List <Department> GetList()
 {
     try
     {
         string            sql   = string.Format(@"select a.*, b.DepartmentName ParentName, c.EmployeeName InChargeName
                                          from t_department a 
                                         left join t_department b on a.ParentID = b.DepartmentID
                                         left join t_employee c on a.InChargeID = c.EmployeeID");
         DataTable         dt    = MysqlHelper.ExecuteDataTable(sql);
         List <Department> _list = ModelConvert.ToList <Department>(dt);
         return(_list);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }