Example #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            try
            {
                cr   c      = new cr();
                bool sucess = false;

                for (int i = 0; i < dataGridView1.Rows.Count; i++)
                {
                    c.no     = Convert.ToInt32(dataGridView1[0, i].Value);
                    c.name   = dataGridView1[1, i].Value.ToString();
                    c.descri = dataGridView1[2, i].Value.ToString();
                    c.date   = dateTimePicker1.Text;
                    c.amt    = Convert.ToInt32(dataGridView1[3, i].Value);
                    sucess   = c.update();
                }
                if (sucess)
                {
                    MessageBox.Show("UPDATED SUCESSFULY", "DELETE");
                }
                else
                {
                    MessageBox.Show("UPDATION UNSUCESSFULL", "DELETE");
                }
                clear();
            }catch (Exception x)
            {
                MessageBox.Show(x.ToString(), "Error");
            }
        }
Example #2
0
        public void clear()
        {
            cr s = new cr();

            textBox1.Text         = s.getsaleid().ToString();
            comboBox1.Text        = "";
            textBox2.Text         = "";
            textBox3.Text         = "";
            dateTimePicker1.Value = DateTime.Now;
            dataGridView1.Rows.Clear();
            dataGridView1.Refresh();
            label8.Text = "0";
            counter     = 0;
            upd         = false;
            loadname();
            button1.Enabled = true;
            button2.Enabled = false;
            button3.Enabled = false;
        }
Example #3
0
        public void loadrecord(int id)
        {
            upd = true;
            dataGridView1.Rows.Clear();
            button1.Enabled = false;
            button2.Enabled = true;
            button3.Enabled = true;
            dataGridView1.Refresh();
            int key = id;
            cr  s   = new cr();

            point p = s.getpoint(key);

            for (int i = p.start; i <= p.end; i++)
            {
                if (s.search(i))
                {
                    dateTimePicker1.Text = s.date;
                    dataGridView1.Rows.Add(i.ToString(), s.name, s.descri, s.amt.ToString());
                }
            }
        }