public static int PermsUpdate(UserParameter param) { using (var db = new MsSql(DbName.Official)) { return (Convert.ToInt32( db.Value( CommandType.StoredProcedure, "[dbo].[sp_UserFunctionsAndOperations_Upd]", new DbParameter[] { new SqlParameter { Value = param.User.IdentityKey, SqlDbType = SqlDbType.BigInt, ParameterName = "@argIntUserId", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.User.Functions, SqlDbType = SqlDbType.VarChar, Size = -1, ParameterName = "@argStrFunctions", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.User.Operations, SqlDbType = SqlDbType.VarChar, Size = -1, ParameterName = "@argStrOperations", Direction = ParameterDirection.Input } }))); } }
public static int Insert(UserParameter param) { using (var db = new MsSql(DbName.Official)) { return (Convert.ToInt32( db.Value( CommandType.StoredProcedure, "[dbo].[sp_User_Ins]", new DbParameter[] { new SqlParameter { Value = param.User.Account, SqlDbType = SqlDbType.VarChar, Size = 32, ParameterName = "@argStrAccount", Direction = ParameterDirection.Input }, new SqlParameter { Value = AzDG.Encrypt(param.User.Password), SqlDbType = SqlDbType.VarChar, Size = 128, ParameterName = "@argStrPassword", Direction = ParameterDirection.Input }, new SqlParameter { Value = Md5.Encrypt(param.User.Password), SqlDbType = SqlDbType.VarChar, Size = 64, ParameterName = "@argStrEncryptPassword", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.User.FirstName, SqlDbType = SqlDbType.NVarChar, Size = 64, ParameterName = "@argStrFirstName", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.User.LastName, SqlDbType = SqlDbType.NVarChar, Size = 64, ParameterName = "@argStrLastName", Direction = ParameterDirection.Input } }))); } }
public static int Delete(FunctionParameter param) { using (var db = new MsSql(DbName.Official)) { return(Convert.ToInt32( db.Value( CommandType.StoredProcedure, "[dbo].[sp_Function_Del]", new DbParameter[] { new SqlParameter { Value = param.Function.FunctionId, SqlDbType = SqlDbType.Int, ParameterName = "@argIntFunctionId", Direction = ParameterDirection.Input } }))); } }
public static int Insert(FunctionParameter param) { using (var db = new MsSql(DbName.Official)) { return (Convert.ToInt32( db.Value( CommandType.StoredProcedure, "[dbo].[sp_Function_Ins]", new DbParameter[] { new SqlParameter { Value = param.Function.ParentFunctionId, SqlDbType = SqlDbType.Int, ParameterName = "@argIntParentFunctionId", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.Function.Name, SqlDbType = SqlDbType.NVarChar, Size = 128, ParameterName = "@argStrName", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.Function.Icon, SqlDbType = SqlDbType.NVarChar, Size = 128, ParameterName = "@argStrIcon", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.Function.Target, SqlDbType = SqlDbType.VarChar, Size = 1024, ParameterName = "@argStrTarget", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.Function.Area, SqlDbType = SqlDbType.VarChar, Size = 1024, ParameterName = "@argStrArea", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.Function.Controller, SqlDbType = SqlDbType.VarChar, Size = 1024, ParameterName = "@argStrController", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.Function.Action, SqlDbType = SqlDbType.VarChar, Size = 1024, ParameterName = "@argStrAction", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.Function.Parameters, SqlDbType = SqlDbType.VarChar, Size = 128, ParameterName = "@argStrParameters", Direction = ParameterDirection.Input }, new SqlParameter { Value = 0, SqlDbType = SqlDbType.Int, ParameterName = "@argIntOwner", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.Function.Priority, SqlDbType = SqlDbType.Int, ParameterName = "@argIntPriority", Direction = ParameterDirection.Input } }))); } }
public static int Update(UserParameter param) { using (var db = new MsSql(DbName.Official)) { return (Convert.ToInt32( db.Value( CommandType.StoredProcedure, "[dbo].[sp_User_Upd]", new DbParameter[] { new SqlParameter { Value = param.User.IdentityKey, SqlDbType = SqlDbType.BigInt, ParameterName = "@argIntUserId", Direction = ParameterDirection.Input }, new SqlParameter { Value = (IsNullOrEmpty(param.User.Password)) ? Empty : AzDG.Encrypt(param.User.Password), SqlDbType = SqlDbType.VarChar, Size = 128, ParameterName = "@argStrPassword", Direction = ParameterDirection.Input }, new SqlParameter { Value = (IsNullOrEmpty(param.User.Password)) ? Empty : Md5.Encrypt(param.User.Password), SqlDbType = SqlDbType.VarChar, Size = 64, ParameterName = "@argStrEncryptPassword", Direction = ParameterDirection.Input }, new SqlParameter { Value = IsNullOrEmpty(param.User.FirstName) ? "" : param.User.FirstName, SqlDbType = SqlDbType.NVarChar, Size = 64, ParameterName = "@argStrFirstName", Direction = ParameterDirection.Input }, new SqlParameter { Value = IsNullOrEmpty(param.User.LastName) ? "" : param.User.LastName, SqlDbType = SqlDbType.NVarChar, Size = 64, ParameterName = "@argStrLastName", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.User.Status, SqlDbType = SqlDbType.TinyInt, ParameterName = "@argIntStatus", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.User.PrimaryRule, SqlDbType = SqlDbType.BigInt, ParameterName = "@argIntPrimaryRuleId", Direction = ParameterDirection.Input }, new SqlParameter { Value = IsNullOrEmpty(param.User.RuleGroups) ? "" : param.User.RuleGroups, SqlDbType = SqlDbType.VarChar, Size = 8000, ParameterName = "@argStrRuleGroups", Direction = ParameterDirection.Input } }))); } }