private void boton_opciones_guardar_Click(object sender, EventArgs e) { if (!IPAddress.TryParse(textBox_ip_servidor.Text, out IPAddress ip)) { textBox_ip_servidor.BackColor = Color.Red; return; } if (!short.TryParse(textBox_puerto_servidor.Text, out short puerto)) { textBox_puerto_servidor.BackColor = Color.Red; return; } if (!int.TryParse(textBox_peso_core.Text, out int peso_core)) { textBox_peso_core.BackColor = Color.Red; return; } if (!int.TryParse(textBox_peso_loader.Text, out int peso_loader)) { textBox_peso_loader.BackColor = Color.Red; return; } GlobalConf.mostrar_mensajes_debug = checkBox_mensajes_debug.Checked; GlobalConf.ip_conexion = ip.ToString(); GlobalConf.puerto_conexion = puerto; GlobalConf.peso_core = peso_core; GlobalConf.peso_loader = peso_loader; GlobalConf.password_encriptacion = textBox_encriptacion.Text; GlobalConf.guardar(); Close(); }
public DataTable FillDataAdmins(DataTable data) { using (SqlConnection c = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { string query1 = "DROP FUNCTION IF EXISTS fillDataAdmins "; string query2 = "CREATE FUNCTION fillDataAdmins(@Type nvarchar(10)) " + "RETURNS TABLE AS RETURN(SELECT fname +' ' + lname AS FullName, email " + "from tblPerson " + "where type = @Type) "; string query3 = "SELECT* from fillDataAdmins('Admin')"; c.Open(); using (SqlCommand cmd1 = new SqlCommand(query1, c)) { cmd1.ExecuteNonQuery(); } using (SqlCommand cmd2 = new SqlCommand(query2, c)) { cmd2.ExecuteNonQuery(); } using (SqlCommand cmd3 = new SqlCommand(query3, c)) { DataTable dt = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter(cmd3); adapter.Fill(dt); return(dt); } } }
public DataTable FillDataPerson(DataTable data) { using (SqlConnection c = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { string query1 = "DROP VIEW IF EXISTS FnameLnameASFullname; "; string query2 = "CREATE VIEW FnameLnameASFullname " + "AS SELECT fname + ' ' + lname AS FullName, email FROM tblPerson "; string query3 = "SELECT* from FnameLnameASFullname "; c.Open(); using (SqlCommand cmd1 = new SqlCommand(query1, c)) { cmd1.ExecuteNonQuery(); } using (SqlCommand cmd2 = new SqlCommand(query2, c)) { cmd2.ExecuteNonQuery(); } using (SqlCommand cmd3 = new SqlCommand(query3, c)) { DataTable dt = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter(cmd3); adapter.Fill(dt); return(dt); } } }
// Token: 0x060004F2 RID: 1266 RVA: 0x00020E00 File Offset: 0x0001F200 private void boton_opciones_guardar_Click(object sender, EventArgs e) { IPAddress ipaddress; bool flag = !IPAddress.TryParse(this.textBox_ip_servidor.Text, out ipaddress); if (flag) { this.textBox_ip_servidor.BackColor = Color.Red; } else { short num; bool flag2 = !short.TryParse(this.textBox_puerto_servidor.Text, out num); if (flag2) { this.textBox_puerto_servidor.BackColor = Color.Red; } else { GlobalConf.mostrar_mensajes_debug = this.checkBox_mensajes_debug.Checked; GlobalConf.ip_conexion = this.textBox_ip_servidor.Text; GlobalConf.puerto_conexion = short.Parse(this.textBox_puerto_servidor.Text); GlobalConf.guardar_Configuracion(); base.Close(); } } }
public DataTable FillDataForMemberSearchByName(DataTable data, string name) { using (SqlConnection c = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { string query1 = "DROP INDEX IF EXISTS tblPerson.IX_tblPerson_Name "; string query2 = "Create NonClustered Index IX_tblPerson_Name " + "ON tblPerson(fName) "; string query3 = "SELECT fname + ' ' + lname AS FullName, email FROM tblPerson " + "WITH(INDEX(IX_tblPerson_Name)) WHERE (fname LIKE '%" + name + "' or lname LIKE '%" + name + "' or email LIKE '%" + name + "%') " + " and (type='Member') "; c.Open(); using (SqlCommand cmd1 = new SqlCommand(query1, c)) { cmd1.ExecuteNonQuery(); } using (SqlCommand cmd2 = new SqlCommand(query2, c)) { cmd2.ExecuteNonQuery(); } using (SqlCommand cmd3 = new SqlCommand(query3, c)) { DataTable dt = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter(cmd3); adapter.Fill(dt); return(dt); } } }
private void fill_combobox() { string query = "SELECT city FROM tblCity"; using (SqlConnection c = new SqlConnection(GlobalConf.CnnString("MyDatabaseCity"))) { c.Open(); using (SqlCommand com = new SqlCommand(query, c)) { using (DataTable dt = new DataTable()) { using (SqlDataAdapter adapter = new SqlDataAdapter(com)) { adapter.Fill(dt); // fetching the names of cities from database file to combobox foreach (DataRow dr in dt.Rows) { cbCity.Items.Add(dr["city"].ToString()); } } } } } }
/// <summary> /// Filling the DatagridViews with the proper info /// </summary> /// public void CheckDatabase() { using (SqlConnection c = new SqlConnection(GlobalConf.CnnString("CheckDB"))) { var database = File.ReadAllText(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SQL", "Create_Database.sql")); var CreateDB = "CREATE DATABASE THEVENT;"; c.Open(); try { using (SqlCommand cmd1 = new SqlCommand(database, c)) { cmd1.ExecuteNonQuery(); } } catch (Exception e) { using (SqlCommand cmd1 = new SqlCommand(CreateDB, c)) { cmd1.ExecuteNonQuery(); } } using (SqlCommand cmd1 = new SqlCommand(database, c)) { cmd1.ExecuteNonQuery(); } } }
public DataTable FillDataMessage(DataTable data, string email) { //string query = "Select A.fname + ' ' + A.lname AS Fullname, B.message, B.messagedate From tblPerson A JOIN tblMessage B ON A.id = B.senderid Where B.recieverid = (select id from tblPerson where email = '" + email+ "') ORDER BY B.messagedate ASC"; string query = "DECLARE @LOCAL_TABLEVARIABLE TABLE (Fullname nvarchar(50), " + "message nvarchar(max), " + "messagedate datetime," + " recieverid int) " + "INSERT INTO @LOCAL_TABLEVARIABLE(Fullname, message, messagedate,recieverid) " + "Select A.fname + ' ' + A.lname AS Fullname, B.message, B.messagedate , B.recieverid " + "From tblPerson A " + "JOIN tblMessage B " + "ON A.id = B.senderid " + "Where B.recieverid = (select id from tblPerson where email = '" + email + "') or " + "B.senderid = (select id from tblPerson where email = '" + email + "') ORDER BY B.messagedate ASC " + "Update @LOCAL_TABLEVARIABLE " + "Set Fullname = 'Me to '+(select fname+' '+lname from tblPerson where id=recieverid) " + "where Fullname = (select fname + ' ' + lname from tblPerson where email = '" + email + "' ) " + "Select Fullname, message, messagedate From @LOCAL_TABLEVARIABLE "; using (SqlConnection c = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { c.Open(); using (SqlCommand cmd = new SqlCommand(query, c)) { DataTable dt = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter(cmd); adapter.Fill(dt); return(dt); } } }
private void boton_Agregar_Cuenta_Click(object sender, EventArgs e) { if (textBox_Nombre_Cuenta.TextLength != 0 && textBox_Password.TextLength != 0) { if (GlobalConf.get_Cuenta(textBox_Nombre_Cuenta.Text) != null) { MessageBox.Show("Ya existe una cuenta con el nombre de cuenta", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } GlobalConf.agregar_Cuenta(textBox_Nombre_Cuenta.Text, textBox_Password.Text, comboBox_Servidor.SelectedItem.ToString(), Convert.ToInt32(seleccion_id_personaje.Value)); cargar_Cuentas_Lista(); textBox_Nombre_Cuenta.Clear(); textBox_Password.Clear(); seleccion_id_personaje.Value = 1; if (checkBox_Agregar_Retroceder.Checked) { tabControlPrincipalCuentas.SelectedIndex = 0; } GlobalConf.guardar_Configuracion(); } else { tableLayoutPanel6.Controls.OfType <TableLayoutPanel>().ToList().ForEach(panel => { panel.Controls.OfType <TextBox>().ToList().ForEach(textbox => { textbox.BackColor = string.IsNullOrEmpty(textbox.Text) ? Color.Red : Color.White; }); }); } }
public static void LoadGlobalConf() { var db = Resources.Load <GlobalConf>("GlobalConf"); db.hideFlags = HideFlags.DontSaveInBuild; Conf = db; }
// Token: 0x060004E1 RID: 1249 RVA: 0x0001E674 File Offset: 0x0001CA74 private void boton_Agregar_Cuenta_Click(object sender, EventArgs e) { bool flag = GlobalConf.get_Cuenta(this.textBox_Nombre_Cuenta.Text) != null && GlobalConf.mostrar_mensajes_debug; if (flag) { MessageBox.Show("Il existe déjà un compte avec ce nom de compte", "Error", MessageBoxButtons.OK, MessageBoxIcon.Hand); } else { bool tiene_errores = false; Action <TextBox> < > 9__1; this.tableLayoutPanel6.Controls.OfType <TableLayoutPanel>().ToList <TableLayoutPanel>().ForEach(delegate(TableLayoutPanel panel) { List <TextBox> list = panel.Controls.OfType <TextBox>().ToList <TextBox>(); Action <TextBox> action; if ((action = < > 9__1) == null) { action = (< > 9__1 = delegate(TextBox textbox) { Console.WriteLine("TextBox: " + textbox.Name); bool flag3 = textbox.Name != "textBox_nombre_personaje"; if (flag3) { bool flag4 = string.IsNullOrEmpty(textbox.Text) || textbox.Text.Split(new char[0]).Length > 1; if (flag4) { textbox.BackColor = Color.Red; tiene_errores = true; } else { textbox.BackColor = Color.White; } } }); } list.ForEach(action); }); bool flag2 = !tiene_errores; if (flag2) { GlobalConf.agregar_Cuenta(this.textBox_Nombre_Cuenta.Text, this.textBox_Password.Text, this.comboBox_Servidor.SelectedItem.ToString(), this.textBox_nombre_personaje.Text); this.cargar_Cuentas_Lista(); this.textBox_Nombre_Cuenta.Clear(); this.textBox_Password.Clear(); this.textBox_nombre_personaje.Clear(); bool @checked = this.checkBox_Agregar_Retroceder.Checked; if (@checked) { this.tabControlPrincipalCuentas.SelectedIndex = 0; } GlobalConf.guardar_Configuracion(); } } }
private void cargar_Cuentas_Lista() { listViewCuentas.Items.Clear(); GlobalConf.get_Lista_Cuentas().ForEach(x => { if (!Principal.get_Paginas_Cuentas_Cargadas().ContainsKey(x.nombre_cuenta)) { listViewCuentas.Items.Add(x.nombre_cuenta).SubItems.AddRange(new string[] { x.servidor, x.id_personaje.ToString() }); } }); }
public PersonModel DeletePerson(PersonModel Model) { using (SqlConnection connection = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { connection.Open(); string query = "DELETE FROM tblPerson WHERE email='" + Model.Email + "'"; using (SqlCommand cmd = new SqlCommand(query, connection)) { cmd.ExecuteNonQuery(); } } return(Model); }
public postEvent UpdateEventFeedBack(postEvent Model, string email) { using (SqlConnection connection3 = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { connection3.Open(); string query = "INSERT INTO tblReview(reviewerId, review, reviewedEventId)values((select id from tblPerson where email = '" + email + "'),'" + Model.Review + "', " + Model.EventID + ")"; using (SqlCommand cmd = new SqlCommand(query, connection3)) { cmd.ExecuteNonQuery(); } } return(Model); }
public EventModel DeleteEvent(EventModel Model) { using (SqlConnection connection = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { connection.Open(); string query = "DELETE FROM tblEvent WHERE eventid='" + Model.EventID + "'"; using (SqlCommand cmd = new SqlCommand(query, connection)) { cmd.ExecuteNonQuery(); } } return(Model); }
private void conectarToolStripMenuItem_Click(object sender, EventArgs e) { if (listViewCuentas.SelectedItems.Count > 0 && listViewCuentas.FocusedItem != null) { foreach (ListViewItem cuenta in listViewCuentas.SelectedItems) { cuentas_cargadas.Add(GlobalConf.get_Lista_Cuentas().FirstOrDefault(f => f.nombre_cuenta == cuenta.Text)); } DialogResult = DialogResult.OK; Close(); } }
private void eliminarToolStripMenuItem_Click(object sender, EventArgs e) { if (listViewCuentas.SelectedItems.Count > 0 && listViewCuentas.FocusedItem != null) { foreach (ListViewItem cuenta in listViewCuentas.SelectedItems) { GlobalConf.eliminar_Cuenta(cuenta.Index); cuenta.Remove(); } GlobalConf.guardar_Configuracion(); cargar_Cuentas_Lista(); } }
private void cargar_Accounts_Lista() { listViewAccounts.Items.Clear(); GlobalConf.get_Lista_Accounts().ForEach(x => { if (!Principal.cuentas_cargadas.ContainsKey(x.nombre_cuenta)) { listViewAccounts.Items.Add(x.nombre_cuenta).SubItems.AddRange(new string[2] { x.servidor, x.nombre_personaje }); } }); }
// UPDATE AN EVENT public EventModel UpdateEvent(EventModel Model, string makerEmail) { using (SqlConnection connection = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { connection.Open(); string query = "UPDATE tblEvent SET eventName = '" + Model.EventName + "', eventLocation='" + Model.EventLocation + "', invitedMembers= '" + Model.InvitedMembers + "', eventType= '" + Model.EventType + "', eventNote='" + Model.EventNote + "', eventDate= '" + Model.EventDate + "'WHERE eventid= '" + Model.EventID + "'"; using (SqlCommand cmd = new SqlCommand(query, connection)) { cmd.ExecuteNonQuery(); } } return(Model); }
public PersonModel UpdatePerson(PersonModel Model) { using (SqlConnection connection = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { connection.Open(); string query = "UPDATE tblPerson SET location='" + Model.Location + "', fname= '" + Model.FirstName + "', lname= '" + Model.LastName + "', birthdate='" + Model.BirthDate + "', password= '******'WHERE email= '" + Model.Email + "'"; using (SqlCommand cmd = new SqlCommand(query, connection)) { cmd.ExecuteNonQuery(); } } return(Model); }
/// <summary> /// PERSON METHODS : CREATE-UPDATE-DELETE /// </summary> public PersonModel CreatePerson(PersonModel Model) { using (SqlConnection connection = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { connection.Open(); string query = "INSERT INTO tblPerson(type, fname, lname, location, email, password, birthdate, registration)values('" + Model.Type + "',TRIM('" + Model.FirstName + "')," + " UPPER(TRIM('" + Model.LastName + "')), '" + Model.Location + "', TRIM('" + Model.Email + "'), TRIM('" + Model.Password + "'), '" + Model.BirthDate + "', GETDATE())"; using (SqlCommand cmd = new SqlCommand(query, connection)) { cmd.ExecuteNonQuery(); } } return(Model); }
static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Task.Run(() => { GlobalConf.cargar_Todas_Cuentas(); XElement.Parse(Properties.Resources.interactivos).Descendants("SKILL").ToList().ForEach(i => new ObjetoInteractivoModelo(i.Element("nombre").Value, i.Element("gfx").Value, bool.Parse(i.Element("caminable").Value), i.Element("habilidades").Value, bool.Parse(i.Element("recolectable").Value))); paquete_recibido = new PaqueteRecibido(); paquete_recibido.Inicializar(); }); Application.Run(new Principal()); }
public int FillAdminCount() { string query = "SELECT COUNT(*) " + "AS TotalAdminNumber " + "FROM tblPerson WHERE type = 'Admin' GROUP BY type"; using (SqlConnection c = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { c.Open(); using (SqlCommand cmd = new SqlCommand(query, c)) { return(Convert.ToInt32(cmd.ExecuteScalar())); } } }
public DataTable FillDataForMemberDelete(DataTable data, string name) { string query = "SELECT fname, lname, email FROM tblPerson WHERE (fname LIKE '%" + name + "%' or lname LIKE '%" + name + "%' or email LIKE '%" + name + "%') and (type='Member')"; using (SqlConnection c = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { c.Open(); using (SqlCommand cmd = new SqlCommand(query, c)) { DataTable dt = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter(cmd); adapter.Fill(dt); return(dt); } } }
// Token: 0x060004E3 RID: 1251 RVA: 0x0001E7B0 File Offset: 0x0001CBB0 private void eliminarToolStripMenuItem_Click(object sender, EventArgs e) { bool flag = this.listViewCuentas.SelectedItems.Count > 0 && this.listViewCuentas.FocusedItem != null; if (flag) { foreach (object obj in this.listViewCuentas.SelectedItems) { ListViewItem listViewItem = (ListViewItem)obj; GlobalConf.eliminar_Cuenta(listViewItem.Index); listViewItem.Remove(); } GlobalConf.guardar_Configuracion(); this.cargar_Cuentas_Lista(); } }
// Token: 0x060004E0 RID: 1248 RVA: 0x0001E648 File Offset: 0x0001CA48 private void cargar_Cuentas_Lista() { this.listViewCuentas.Items.Clear(); GlobalConf.get_Lista_Cuentas().ForEach(delegate(CuentaConf x) { bool flag = !Principal.cuentas_cargadas.ContainsKey(x.nombre_cuenta); if (flag) { this.listViewCuentas.Items.Add(x.nombre_cuenta).SubItems.AddRange(new string[] { x.servidor, x.nombre_personaje }); } }); }
public DataTable FillDataForEventSearchByLocation(DataTable data, string location) { string query = "SELECT eventName, eventDate, eventLocation, eventType FROM tblEvent WHERE eventLocation LIKE '%" + location + "%'"; using (SqlConnection c = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { c.Open(); using (SqlCommand cmd = new SqlCommand(query, c)) { DataTable dt = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter(cmd); adapter.Fill(dt); return(dt); } } }
public DataTable FillDataForMemberSearchByLocation(DataTable data, string location) { string query = "SELECT fname + ' ' + lname AS FullName, location FROM tblPerson WHERE location LIKE '" + location + "%' and type='Member'"; using (SqlConnection c = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { c.Open(); using (SqlCommand cmd = new SqlCommand(query, c)) { DataTable dt = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter(cmd); adapter.Fill(dt); return(dt); } } }
public DataTable FillDataForEventUpdate(DataTable data, string name, string email) { string query = "SELECT eventid,eventName, eventType, eventLocation, EventDate, eventNote, invitedMembers FROM tblEvent WHERE eventName LIKE '%" + name + "%' and makerEmail='" + email + "'"; using (SqlConnection c = new SqlConnection(GlobalConf.CnnString("MyDatabaseDeneme"))) { c.Open(); using (SqlCommand cmd = new SqlCommand(query, c)) { DataTable dt = new DataTable(); SqlDataAdapter adapter = new SqlDataAdapter(cmd); adapter.Fill(dt); return(dt); } } }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Task.Run(() => { GlobalConf.cargar_Todas_Cuentas(); XElement.Parse(Properties.Resources.interactivos).Descendants("SKILL").ToList().ForEach(i => new ObjetoInteractivoModelo(i.Element("nombre").Value, i.Element("gfx").Value, bool.Parse(i.Element("caminable").Value), i.Element("habilidades").Value, bool.Parse(i.Element("recolectable").Value))); paquete_recibido = new PaqueteRecibido(); paquete_recibido.Inicializar(); }).ContinueWith(t => { XElement.Parse(Properties.Resources.hechizos).Descendants("HECHIZO").ToList().ForEach(mapa => { Hechizo hechizo = new Hechizo(short.Parse(mapa.Attribute("ID").Value), mapa.Element("NOMBRE").Value); HechizoStats hechizo_stats = new HechizoStats(); mapa.Descendants("NIVEL").ToList().ForEach(stats => { hechizo_stats.coste_pa = byte.Parse(stats.Attribute("COSTE_PA").Value); hechizo_stats.alcanze_minimo = byte.Parse(stats.Attribute("RANGO_MINIMO").Value); hechizo_stats.alcanze_maximo = byte.Parse(stats.Attribute("RANGO_MAXIMO").Value); hechizo_stats.es_lanzado_linea = bool.Parse(stats.Attribute("LANZ_EN_LINEA").Value); hechizo_stats.es_lanzado_con_vision = bool.Parse(stats.Attribute("NECESITA_VISION").Value); hechizo_stats.es_celda_vacia = bool.Parse(stats.Attribute("NECESITA_CELDA_LIBRE").Value); hechizo_stats.es_alcanze_modificable = bool.Parse(stats.Attribute("RANGO_MODIFICABLE").Value); hechizo_stats.lanzamientos_por_turno = byte.Parse(stats.Attribute("MAX_LANZ_POR_TURNO").Value); hechizo_stats.lanzamientos_por_objetivo = byte.Parse(stats.Attribute("MAX_LANZ_POR_OBJETIVO").Value); hechizo_stats.intervalo = byte.Parse(stats.Attribute("COOLDOWN").Value); stats.Descendants("EFECTO").ToList().ForEach(efecto => { hechizo_stats.agregar_efecto(new HechizoEfecto(int.Parse(efecto.Attribute("TIPO").Value), Zonas.Parse(efecto.Attribute("ZONA").Value)), bool.Parse(efecto.Attribute("ES_CRITICO").Value)); }); hechizo.get_Agregar_Hechizo_Stats(byte.Parse(stats.Attribute("ID").Value), hechizo_stats); }); }); }).Wait(); Application.Run(new Principal()); }