예제 #1
0
파일: Form1.cs 프로젝트: M01K0/cibertim-msa
        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();
        }
예제 #2
0
 private void button1_Click_1(object sender, EventArgs e)
 {
     if (price.Text != "")
     {
         MSAConnection.execute("update item set precio = " + price.Text + "  where id = " + pc_id);
         MessageBox.Show("Se ha actualizado extisamente el precio, debe reiniciar el programa para ver el cambio.");
     }
     else
     {
         MessageBox.Show("No puedes dejar el campo de precio en blanco!");
     }
 }
예제 #3
0
 private void btn_stop_Click(object sender, EventArgs e)
 {
     MSAConnection.execute("update item set inicio = NULL where id=" + data.Rows[r_index].Cells[0].Value.ToString());
     data.Rows[r_index].Cells[2].Value = "";
     data.Rows[r_index].Cells[3].Value = "";
     data.Rows[r_index].Cells[4].Value = "";
     for (int i = 0; i < PC.list.Count; i++)
     {
         if (PC.list[i].id.ToString() == data.Rows[r_index].Cells[0].Value.ToString())
         {
             PC.list.RemoveAt(i);
         }
     }
     Dispose();
 }
예제 #4
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();
        }