private void Form1_Load(object sender, EventArgs e) { MySqlConnectionStringBuilder sb = new MySqlConnectionStringBuilder(); sb.Server = "secure199.inmotionhosting.com"; sb.UserID = "abdsto5_felipe"; sb.Password = "******"; sb.Database = "abdsto5_cotizaciones"; //PRUEBAS EN LOCALHOST /* * sb.Server = "localhost"; * sb.UserID = "felipe"; * sb.Password = "******"; * sb.Database = "ejemplo"; */ bdMysql = new DataBase(); bdMysql.DataBaseProvider = TypeOfDataBase.MySqlServer; bdMysql.ConnectionString = sb.ToString(); // bdMysql.ConnectionString = "Server = localhost; Database = descobi; Uid = felipe; Pwd = 1945Inadescobi"; bdMysql.CreateConnection(); DbObject.DefaultDataBaseObject = bdMysql; dataGridView1.CellClick += new DataGridViewCellEventHandler(dataGridView1_CellClick); /* * String mac = "00:12:3F:43:98:52"; * String mac2 = ""; * String tarjeta = "Controladora Gigabit Broadcom NetXtreme 57xx"; * ManagementObjectSearcher mos = new ManagementObjectSearcher("select * from Win32_NetworkAdapter where Name='" + tarjeta + "'"); * ManagementObjectCollection moc = mos.Get(); * if (moc.Count > 0) * { * foreach (ManagementObject mo in moc) * { * mac2 = (string)mo["MACAddress"]; * // MessageBox.Show(mac); * } * } * else * { * MessageBox.Show("Esta Aplicacion no coincide con el equipo, Favor de actualizarla"); * this.Close(); * } * * if (mac != mac2) * { * MessageBox.Show("Esta Aplicacion no coincide con el equipo, Favor de actualizarla"); * this.Close(); * } */ DbObject db = new DbObject(); string cambio = db.añoinflacion(); if (cambio != DateTime.Now.Year.ToString()) { bdMysql.editarinflacion("Update inflacion SET fecha=CURDATE(), cambio='0' WHERE Id=1"); } lista = clientes.GetExistentes(); DgieWS TCambio = new DgieWS(); string strTDCambio = TCambio.tiposDeCambioBanxico(); XElement root = XElement.Parse(@strTDCambio); XNamespace bm = "http://www.banxico.org.mx/structure/key_families/dgie/sie/series/compact"; IEnumerable <XElement> address = from el in root.Descendants(bm + "DataSet").Elements(bm + "Series") where (string)el.Attribute("IDSERIE") == "SF43718" select el; foreach (XElement el in address) { tc = "" + el.Element(bm + "Obs").Attribute("OBS_VALUE").Value; } try { Convert.ToDouble(tc); } catch { tc = "0"; } }
public virtual void actualizarinflacion(string consulta2) { SelectDataBase(); DataBaseObject.editarinflacion(consulta2); }