コード例 #1
0
        private SystemFunctionInfo  FillList(IDataReader dataReader)
        {
            SystemFunctionInfo model = new SystemFunctionInfo();
            object             ojb;

            ojb = dataReader["Id"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.Id = ( int)(ojb);
            }
            ojb = dataReader["FunctionName"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.FunctionName = ( string)(ojb);
            }
            ojb = dataReader["FunctionCode"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.FunctionCode = ( string)(ojb);
            }
            ojb = dataReader["IsBuiltin"];
            if (ojb != null && ojb != DBNull.Value)
            {
                model.IsBuiltin = ( bool)(ojb);
            }

            return(model);
        }
コード例 #2
0
        public bool CheckFunCode(string code)
        {
            SystemFunctionInfo model = this.GetByFunctionCode(code);

            if (model == null)
            {
                return(false);
            }
            return(true);
        }
コード例 #3
0
        public bool Delete(SystemFunctionInfo model)
        {
            Database      db = DBHelper.CreateDataBase();
            StringBuilder sb = new StringBuilder();

            sb.Append("delete from SystemFunction");
            sb.Append(" where Id=@Id");
            DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());

            db.AddInParameter(dbCommand, "@Id", DbType.Int32, model.Id);
            return(db.ExecuteNonQuery(dbCommand) < 1 ? false : true);
        }
コード例 #4
0
        public List <SystemFunctionInfo> GetByCodes(string[] codes)
        {
            List <SystemFunctionInfo> res   = new List <SystemFunctionInfo>();
            SystemFunctionInfo        model = null;

            foreach (string code in codes)
            {
                model = this.GetByFunctionCode(code);
                if (model != null)
                {
                    res.Add(model);
                }
            }
            return(res);
        }
コード例 #5
0
        public bool Update(SystemFunctionInfo model)
        {
            Database      db = DBHelper.CreateDataBase();
            StringBuilder sb = new StringBuilder();

            sb.Append("update SystemFunction set ");
            sb.Append("FunctionName=@FunctionName,FunctionCode=@FunctionCode,IsBuiltin=@IsBuiltin");
            sb.Append(" where Id=@Id");
            DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());

            db.AddInParameter(dbCommand, "@Id", DbType.Int32, model.Id);
            db.AddInParameter(dbCommand, "@FunctionName", DbType.String, model.FunctionName);
            db.AddInParameter(dbCommand, "@FunctionCode", DbType.String, model.FunctionCode);
            db.AddInParameter(dbCommand, "@IsBuiltin", DbType.Boolean, model.IsBuiltin);
            return(db.ExecuteNonQuery(dbCommand) < 1 ? false : true);
        }
コード例 #6
0
        public int Create(SystemFunctionInfo model)
        {
            Database      db = DBHelper.CreateDataBase();
            StringBuilder sb = new StringBuilder();

            sb.Append("insert into SystemFunction(");
            sb.Append("FunctionName,FunctionCode,IsBuiltin");
            sb.Append(") values(");
            sb.Append("@FunctionName,@FunctionCode,@IsBuiltin);SELECT @@IDENTITY;");
            DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());

            db.AddInParameter(dbCommand, "@FunctionName", DbType.String, model.FunctionName);
            db.AddInParameter(dbCommand, "@FunctionCode", DbType.String, model.FunctionCode);
            db.AddInParameter(dbCommand, "@IsBuiltin", DbType.Boolean, model.IsBuiltin);
            int id = Convert.ToInt32(db.ExecuteScalar(dbCommand));

            return(id);
        }
コード例 #7
0
        public SystemFunctionInfo  GetByFunctionCode(string FunctionCode)
        {
            Database      db = DBHelper.CreateDataBase();
            StringBuilder sb = new StringBuilder();

            sb.Append("select * from SystemFunction where FunctionCode=@FunctionCode");
            DbCommand dbCommand = db.GetSqlStringCommand(sb.ToString());

            db.AddInParameter(dbCommand, "@FunctionCode", DbType.String, FunctionCode);
            SystemFunctionInfo model = null;

            using (IDataReader dataReader = db.ExecuteReader(dbCommand))
            {
                if (dataReader.Read())
                {
                    model = FillList(dataReader);
                }
            }
            return(model);
        }
コード例 #8
0
 public bool Delete(SystemFunctionInfo model)
 {
     return(dal.Delete(model));
 }
コード例 #9
0
 public bool Update(SystemFunctionInfo model)
 {
     return(dal.Update(model));
 }
コード例 #10
0
        public int Create(SystemFunctionInfo model)
        {
            int id = dal.Create(model);

            return(id);
        }