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 Create(UserCommentParameter param) { using (var db = new MsSql(DbName.Official)) { return(db.Write( CommandType.Text, "INSERT INTO [dbo].[UserComment]([Name],[Title],[Comment],[ImgPath],[CreateTime])VALUES(@Name,@Title,@Comment,@ImgPath,GETUTCDATE());", new DbParameter[] { new SqlParameter { Value = param.Entity.Name, SqlDbType = SqlDbType.NVarChar, ParameterName = "@Name", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.Entity.Title, SqlDbType = SqlDbType.NVarChar, ParameterName = "@Title", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.Entity.Comment, SqlDbType = SqlDbType.NVarChar, ParameterName = "@Comment", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.Entity.ImgPath, SqlDbType = SqlDbType.NVarChar, ParameterName = "@ImgPath", Direction = ParameterDirection.Input } })); } }
public String ReturnLogin(MsSql mssql) { String ReturnString = "00000000"; try { if ((Boolean)e.Client.ID.VarPool["CheckPassword"]) { mssql.CommandString = String.Format("SELECT id, Mail, Photo FROM Account WHERE Mail='{0}' AND Password='******';", e.Client.ID.VarPool["account"].ToString(), e.Client.ID.VarPool["password"].ToString()); } else { mssql.CommandString = String.Format("SELECT id, Mail, Photo FROM Account WHERE Mail='{0}';", e.Client.ID.VarPool["account"].ToString()); } if (!mssql.MsSelect(new string[] { "id", "Mail", "Photo" }, e.Client.ID.VarPool)) { ReturnString = mssql.ErrorCode; } //String id = MsSql.VarPool["id"].ToString(); //String Mail = MsSql.VarPool["Mail"].ToString(); //String Photo = Game.Network.Coder.BytesToHex((Byte[])MsSql.VarPool["Photo"]); } catch (Exception ex) { ReturnString = Convert.ToString(ex.GetHashCode()); } return(ReturnString); }
public static int Update(OurGoal param) { using (var db = new MsSql(DbName.Official)) { return(db.Write( CommandType.Text, "UPDATE [dbo].[OurGoal] SET [LeftImg] = @LeftImg,[RightImg] = @RightImg WHERE [OurGoalId] = @OurGoalId;", new DbParameter[] { new SqlParameter { Value = param.LeftImg, SqlDbType = SqlDbType.NVarChar, ParameterName = "@LeftImg", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.RightImg, SqlDbType = SqlDbType.NVarChar, ParameterName = "@RightImg", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.OurGoalId, SqlDbType = SqlDbType.Int, ParameterName = "@OurGoalId", Direction = ParameterDirection.Input } })); } }
public static int Create(OurGoal param) { using (var db = new MsSql(DbName.Official)) { return(db.One <int>( CommandType.Text, "INSERT INTO [dbo].[OurGoal]([LeftImg],[RightImg])VALUES(@LeftImg,@RightImg);SELECT @@IDENTITY;", new DbParameter[] { new SqlParameter { Value = param.LeftImg ?? "", SqlDbType = SqlDbType.NVarChar, ParameterName = "@LeftImg", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.RightImg ?? "", SqlDbType = SqlDbType.NVarChar, ParameterName = "@RightImg", Direction = ParameterDirection.Input }, new SqlParameter { Value = param.OurGoalId, SqlDbType = SqlDbType.Int, ParameterName = "@OurGoalId", Direction = ParameterDirection.Input } })); } }
public frmCatArticulos(MsSql Odat, string perfil, int op = 1, String Key = "") { InitializeComponent(); _Opcion = op; _KeyCampo = Key; db = Odat; Perfil = perfil; switch (op) { case 1: this.Text = "Agregando nuevo Articulo..."; cmdAceptar.Text = "Guardar"; break; case 2: this.Text = "Modificando el Articulo con Clave: " + _KeyCampo; cmdAceptar.Text = "Actualizar"; break; default: this.Text = "Datos del Articulo con Clave: " + _KeyCampo; cmdAceptar.Text = "Aceptar"; break; } }
//private SqlParameter[] ArrParametros; public clsCfgDocSeries(string CveAlm, string _CveDoc, string Ser, MsSql Odat) { CveAlmacen = CveAlm; CveDoc = _CveDoc; Serie = Ser; db = Odat; }
public frmRegArticulos(MsSql Odat, DatCfgParamSystem ParamS, DatCfgUsuario DatUsr, clsStiloTemas NewColor, int op = 1, String Key = "") { InitializeComponent(); _Opcion = op; _KeyCampo = Key; db = Odat; user = DatUsr; StiloColor = NewColor; ParamSystem = ParamS; Util = new ClsUtilerias(ParamSystem.NumDec); MessageBoxAdv.Office2016Theme = Office2016Theme.Colorful; MessageBoxAdv.MessageBoxStyle = MessageBoxAdv.Style.Office2016; switch (op) { case 1: this.Text = "Agregando nuevo Articulo..."; cmdAceptar.Text = "Guardar"; break; case 2: this.Text = "Modificando el Articulo con Clave: " + _KeyCampo; cmdAceptar.Text = "Actualizar"; cmdLstPrecio.Visible = true; break; default: this.Text = "Datos del Articulo con Clave: " + _KeyCampo; cmdAceptar.Text = "Aceptar"; //LleGridLstPrecio(); break; } dtFechaAlta.Value = user.FecServer; }
public frmCatProveedores(MsSql Odat, DatCfgParamSystem ParamS, clsStiloTemas NewColor, string perfil, int op = 1, String Key = "") { InitializeComponent(); _Opcion = op; _KeyCampo = Key; db = Odat; Perfil = perfil; StiloColor = NewColor; ParamSystem = ParamS; Util = new ClsUtilerias(ParamSystem.NumDec); MessageBoxAdv.Office2016Theme = Office2016Theme.Colorful; MessageBoxAdv.MessageBoxStyle = MessageBoxAdv.Style.Office2016; switch (op) { case 1: this.Text = "Agregando nuevo Proveedor..."; cmdAceptar.Text = "Guardar"; break; case 2: this.Text = "Modificando el Proveedor con Clave: " + _KeyCampo; cmdAceptar.Text = "Actualizar"; break; default: this.Text = "Datos del Proveedor con Clave: " + _KeyCampo; cmdAceptar.Text = "Aceptar"; break; } }
public static DataTable GetActions() { const string sql = "SELECT * FROM [dbo].[Actions] ORDER BY [Area], [Controller], [Action]"; using (var db = new MsSql(DbName.Official)) { return(db.Table(CommandType.Text, sql)); } }
public static int DeleteActions(long id) { string sql = $"DELETE FROM [dbo].[Actions] WHERE ID={id}"; using (var db = new MsSql(DbName.Official)) { return(db.Write(CommandType.Text, sql)); } }
public frmSegAccesos(MsSql Odat) { InitializeComponent(); db = Odat; MessageBoxAdv.Office2016Theme = Office2016Theme.Colorful; MessageBoxAdv.MessageBoxStyle = MessageBoxAdv.Style.Office2016; }
public void ConnectTest() { var server = Utility.LoadServers("TestData/servers.yml")["mssql"]; var sql = new MsSql(server, false); var res = sql.Connect(); Assert.True(res); }
public void Run() { if (!_commandLine.Check()) { OutPut?.Error(_commandLine.ErrorMessage); return; } foreach (var server in _commandLine.Servers) { IDb db = null; switch (server.Type) { case Define.DatabaseType.Mysql: db = new Db.MySql(server, _commandLine.DryRun); break; case Define.DatabaseType.Postgres: db = new PgSql(server, _commandLine.DryRun); break; case Define.DatabaseType.MsSql: db = new MsSql(server, _commandLine.DryRun); break; } switch (_commandLine.Command) { case Define.Command.Create: Create(db); break; case Define.Command.Diff: Diff(db); break; case Define.Command.Drop: Drop(db); break; case Define.Command.Extract: Extract(server.Name, db); break; case Define.Command.Query: Query(db); break; case Define.Command.Update: Update(db); break; case Define.Command.ReCreate: ReCreate(db); break; } } }
static void Main(string[] args) { Log.writeLine("######################################"); Stopwatch sw = new Stopwatch(); sw.Start(); // Liest die Config ein Log.write("Config wird eingelesen...", true, false); Config config; try { config = new Config(); } catch (Exception ex) { Log.writeLine("CONFIG: " + ex.Message); throw; } Log.write("fertig", false, true); MsSql.DeleteTempTables(); MsSql.CreateTempTables(); Log.writeLine("Temp Datenbanken wurden erstellt"); // Arbeitet das AD ab. Liest User, Gruppen und Computer ein Log.write("AD wird eingelesen...", true, true); ADWorker.ReadCompleteAD(); // Läuft über jeden Server der Config foreach (var server in config.Servers) { Log.writeLine(server.Name + " wird gescannt..."); // Switch über den Type um jeden Type anders zu behandeln switch (server.Type) { // Type = FileServer case ConfigType.FileServer: WorkOnFileServer(server); break; // Default default: break; } Log.writeLine(server.Name + " wurde eingetragen"); } MsSql.WriteTempToLive(); sw.Stop(); Log.writeLine("Deamon wird beendet"); Log.writeLine("Laufzeit: " + (int)sw.Elapsed.TotalMinutes); }
public frmEmpleados(MsSql Odat, string perfil) { InitializeComponent(); db = Odat; // Perfil = perfil; MessageBoxAdv.Office2016Theme = Office2016Theme.Colorful; MessageBoxAdv.MessageBoxStyle = MessageBoxAdv.Style.Office2016; }