Esempio n. 1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string appPath2 = Path.GetDirectoryName(Application.ExecutablePath);
            ///create the connection string
            string connString = @"Data Source= " + appPath2 + @"\DBpinc.s3db ;Version=3;";

            //create the database query
            string query = "SELECT * FROM Ventas";

            //create an OleDbDataAdapter to execute the query
            System.Data.SQLite.SQLiteDataAdapter dAdapter = new System.Data.SQLite.SQLiteDataAdapter(query, connString);

            //create a command builder
            System.Data.SQLite.SQLiteCommandBuilder cBuilder = new System.Data.SQLite.SQLiteCommandBuilder(dAdapter);

            //create a DataTable to hold the query results
            DataTable dTable = new DataTable();

            //fill the DataTable
            dAdapter.Fill(dTable);
            dAdapter.Update(dTable);


            if (dTable.Rows.Count != 0)
            {
                DataRow Row     = dTable.Rows[dTable.Rows.Count - 1];
                string  num     = Row["NVenta"].ToString();
                int     autonum = Int32.Parse(num);
                textBox1.Text = (autonum + 1).ToString();
            }
            else
            {
                textBox1.Text = "1";
            }

            try
            {
                Sistema_Caritas.ConvertidorMonetario.CurrencyConvertor CC = new Sistema_Caritas.ConvertidorMonetario.CurrencyConvertor();
                label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.USD, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
            }
            catch
            {
                comboBox1.Visible = false;
                label20.Visible   = false;
                label21.Visible   = false;
                button5.Visible   = false;
            }
            timer1.Enabled = true;
        }
Esempio n. 2
0
 private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
 {
     try
     {
         Sistema_Caritas.ConvertidorMonetario.CurrencyConvertor CC = new Sistema_Caritas.ConvertidorMonetario.CurrencyConvertor();
         if (comboBox1.SelectedIndex == 0)
         {
             label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.USD, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
         }
         else if (comboBox1.SelectedIndex == 1)
         {
             label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.EUR, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
         }
         else if (comboBox1.SelectedIndex == 2)
         {
             label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.GBP, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
         }
         else if (comboBox1.SelectedIndex == 3)
         {
             label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.ARS, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
         }
         else if (comboBox1.SelectedIndex == 4)
         {
             label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.PEN, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
         }
         else if (comboBox1.SelectedIndex == 5)
         {
             label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.CAD, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
         }
         else if (comboBox1.SelectedIndex == 6)
         {
             label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.COP, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
         }
         else if (comboBox1.SelectedIndex == 7)
         {
             label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.CUP, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
         }
     }
     catch
     {
     }
 }
Esempio n. 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            string appPath2 = Path.GetDirectoryName(Application.ExecutablePath);
            ///create the connection string
            string connString = @"Data Source= " + appPath2 + @"\DBpinc.s3db ;Version=3;";

            //create the database query
            string query = "SELECT * FROM Ventas";

            //create an OleDbDataAdapter to execute the query
            System.Data.SQLite.SQLiteDataAdapter dAdapter = new System.Data.SQLite.SQLiteDataAdapter(query, connString);

            //create a command builder
            System.Data.SQLite.SQLiteCommandBuilder cBuilder = new System.Data.SQLite.SQLiteCommandBuilder(dAdapter);

            //create a DataTable to hold the query results
            DataTable dTable = new DataTable();
            //fill the DataTable
            dAdapter.Fill(dTable);
            dAdapter.Update(dTable);

            if (dTable.Rows.Count != 0)
            {
                DataRow Row = dTable.Rows[dTable.Rows.Count-1];
                string num = Row["NVenta"].ToString();
                int autonum = Int32.Parse(num);
                textBox1.Text = (autonum + 1).ToString();
            }
            else
            {
                textBox1.Text = "1";
            }

            try
            {

                Sistema_Caritas.ConvertidorMonetario.CurrencyConvertor CC = new Sistema_Caritas.ConvertidorMonetario.CurrencyConvertor();
                label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.USD, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();

            }
            catch
            {
                comboBox1.Visible = false;
                label20.Visible = false;
                label21.Visible = false;
                button5.Visible = false;
            }
            timer1.Enabled = true;
        }
Esempio n. 4
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                Sistema_Caritas.ConvertidorMonetario.CurrencyConvertor CC = new Sistema_Caritas.ConvertidorMonetario.CurrencyConvertor();
                if (comboBox1.SelectedIndex == 0)
                {
                    label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.USD, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();

                }
                else if (comboBox1.SelectedIndex == 1)
                {
                    label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.EUR, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();

                }
                else if (comboBox1.SelectedIndex == 2)
                {
                    label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.GBP, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
                }
                else if (comboBox1.SelectedIndex == 3)
                {
                    label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.ARS, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
                }
                else if (comboBox1.SelectedIndex == 4)
                {
                    label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.PEN, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
                }
                else if (comboBox1.SelectedIndex == 5)
                {
                    label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.CAD, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
                }
                else if (comboBox1.SelectedIndex == 6)
                {
                    label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.COP, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
                }
                else if (comboBox1.SelectedIndex == 7)
                {
                    label21.Text = CC.ConversionRate(Sistema_Caritas.ConvertidorMonetario.Currency.CUP, Sistema_Caritas.ConvertidorMonetario.Currency.MXN).ToString();
                }
            }
            catch
            {
            }
        }