Exemplo n.º 1
0
        public Form1()
        {
            InitializeComponent();
            PC.list = new List<PC>();
            PC.total = new List<PC>();
            data.Columns.Add("Id", "Id");
            data.Columns.Add("PC", "PC");
            data.Columns.Add("Inicio", "Inicio");
            data.Columns.Add("Tiempo", "Tiempo");
            data.Columns.Add("Total", "Total");
            data.Columns[3].Width = 130;
            data.Columns[3].Width = 130;
            r = MSAConnection.read("select * from item");
            while (r.Read())
            {
                String d = "";
                PC p = new PC();
                p.id = r.GetInt32(0);
                p.precio = r.GetInt32(2);
                if (!r.IsDBNull(3))
                {
                    //d = r.GetDateTime(3).ToString();
                    DateTime x = r.GetDateTime(3);
                    d = x.Hour + ":" + x.Minute + ":" + x.Second;
                    p.inicio = r.GetDateTime(3);
                    PC.list.Add(p);
                }
                PC.total.Add(p);
                data.Rows.Add(r.GetInt32(0), r.GetString(1), d);
            }
            //            MessageBox.Show(PC.total.Count + "");

            thetimer.Start();
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            MSAConnection.execute("update item set inicio = \"" + DateTime.Now + "\" where id=" + data.Rows[r_index].Cells[0].Value.ToString());
            DateTime n = DateTime.Now;

            data.Rows[r_index].Cells[2].Value = n.Hour + ":" + n.Minute + ":" + n.Second;
            double price = 0;

            foreach (PC px in PC.total)
            {
                if (px.id.ToString() == data.Rows[r_index].Cells[0].Value.ToString())
                {
                    price = px.precio;
                }
            }
            PC p = new PC();

            p.id     = int.Parse(data.Rows[r_index].Cells[0].Value.ToString());
            p.precio = price;

            p.inicio = DateTime.Now;
            PC.list.Add(p);
            Dispose();
        }
Exemplo n.º 3
0
        private void button1_Click(object sender, EventArgs e)
        {
            MSAConnection.execute("update item set inicio = \"" + DateTime.Now + "\" where id=" + data.Rows[r_index].Cells[0].Value.ToString());
            DateTime n = DateTime.Now;
            data.Rows[r_index].Cells[2].Value = n.Hour + ":" + n.Minute + ":" + n.Second;
            double price = 0;
            foreach (PC px in PC.total)
            {
                if (px.id.ToString() == data.Rows[r_index].Cells[0].Value.ToString())
                {
                    price = px.precio;
                }
            }
            PC p = new PC();
            p.id = int.Parse(data.Rows[r_index].Cells[0].Value.ToString());
            p.precio = price;

            p.inicio = DateTime.Now;
            PC.list.Add(p);
            Dispose();
        }