public Model_SysModuleFunction GetSysModuleFunctionModel(string ModuleID, string FunctionId) { StringBuilder builder = new StringBuilder(); builder.Append("select top 1 ModuleID,FunctionId,IsDefault from SysModuleFunction "); builder.Append(" where ModuleID=@ModuleID and FunctionId=@FunctionId "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ModuleID", SqlDbType.VarChar, 20), new SqlParameter("@FunctionId", SqlDbType.VarChar, 20) }; cmdParms[0].Value = ModuleID; cmdParms[1].Value = FunctionId; Model_SysModuleFunction function = new Model_SysModuleFunction(); DataSet set = DbHelperSQL.Query(builder.ToString(), cmdParms); if (set.Tables[0].Rows.Count <= 0) { return(null); } if ((set.Tables[0].Rows[0]["ModuleID"] != null) && (set.Tables[0].Rows[0]["ModuleID"].ToString() != "")) { function.ModuleID = set.Tables[0].Rows[0]["ModuleID"].ToString(); } if ((set.Tables[0].Rows[0]["FunctionId"] != null) && (set.Tables[0].Rows[0]["FunctionId"].ToString() != "")) { function.FunctionId = set.Tables[0].Rows[0]["FunctionId"].ToString(); } if ((set.Tables[0].Rows[0]["IsDefault"] != null) && (set.Tables[0].Rows[0]["IsDefault"].ToString() != "")) { function.IsDefault = new int?(int.Parse(set.Tables[0].Rows[0]["IsDefault"].ToString())); } return(function); }
public List <Model_SysModuleFunction> DataTableToList(DataTable dt) { List <Model_SysModuleFunction> list = new List <Model_SysModuleFunction>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Model_SysModuleFunction item = new Model_SysModuleFunction(); if ((dt.Rows[i]["ModuleID"] != null) && (dt.Rows[i]["ModuleID"].ToString() != "")) { item.ModuleID = dt.Rows[i]["ModuleID"].ToString(); } if ((dt.Rows[i]["FunctionId"] != null) && (dt.Rows[i]["FunctionId"].ToString() != "")) { item.FunctionId = dt.Rows[i]["FunctionId"].ToString(); } if ((dt.Rows[i]["IsDefault"] != null) && (dt.Rows[i]["IsDefault"].ToString() != "")) { item.IsDefault = new int?(int.Parse(dt.Rows[i]["IsDefault"].ToString())); } list.Add(item); } } return(list); }
public Model_SysModuleFunction DataRowToModel(DataRow row) { Model_SysModuleFunction function = new Model_SysModuleFunction(); if (row != null) { if (row["ModuleID"] != null) { function.ModuleID = row["ModuleID"].ToString(); } if (row["FunctionId"] != null) { function.FunctionId = row["FunctionId"].ToString(); } if ((row["IsDefault"] != null) && (row["IsDefault"].ToString() != "")) { function.IsDefault = new int?(int.Parse(row["IsDefault"].ToString())); } if (row["syscode"] != null) { function.syscode = row["syscode"].ToString(); } } return(function); }
public bool UpdateSysModuleFunction(Model_SysModuleFunction model) { StringBuilder builder = new StringBuilder(); builder.Append("update SysModuleFunction set "); builder.Append("IsDefault=@IsDefault"); builder.Append(" where ModuleID=@ModuleID and FunctionId=@FunctionId "); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@IsDefault", SqlDbType.Int, 4), new SqlParameter("@ModuleID", SqlDbType.VarChar, 20), new SqlParameter("@FunctionId", SqlDbType.VarChar, 20) }; cmdParms[0].Value = model.IsDefault; cmdParms[1].Value = model.ModuleID; cmdParms[2].Value = model.FunctionId; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public bool AddSysModuleFunction(Model_SysModuleFunction model) { StringBuilder builder = new StringBuilder(); builder.Append("insert into SysModuleFunction("); builder.Append("ModuleID,FunctionId,IsDefault)"); builder.Append(" values ("); builder.Append("@ModuleID,@FunctionId,@IsDefault)"); SqlParameter[] cmdParms = new SqlParameter[] { new SqlParameter("@ModuleID", SqlDbType.VarChar, 20), new SqlParameter("@FunctionId", SqlDbType.VarChar, 20), new SqlParameter("@IsDefault", SqlDbType.Int, 4) }; cmdParms[0].Value = model.ModuleID; cmdParms[1].Value = model.FunctionId; cmdParms[2].Value = model.IsDefault; return(DbHelperSQL.ExecuteSql(builder.ToString(), cmdParms) > 0); }
public List <Model_SysModuleFunction> DataTableToList(DataTable dt) { List <Model_SysModuleFunction> list = new List <Model_SysModuleFunction>(); int count = dt.Rows.Count; if (count > 0) { for (int i = 0; i < count; i++) { Model_SysModuleFunction item = this.dal.DataRowToModel(dt.Rows[i]); if (item != null) { list.Add(item); } } } return(list); }
public bool Add(Model_SysModuleFunction model) { return(this.dal.Add(model)); }
public bool Update(Model_SysModuleFunction model) { return(this.dal.Update(model)); }