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); }
public bool CheckFunCode(string code) { SystemFunctionInfo model = this.GetByFunctionCode(code); if (model == null) { return(false); } return(true); }
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); }
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); }
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); }
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); }
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); }
public bool Delete(SystemFunctionInfo model) { return(dal.Delete(model)); }
public bool Update(SystemFunctionInfo model) { return(dal.Update(model)); }
public int Create(SystemFunctionInfo model) { int id = dal.Create(model); return(id); }