Exemple #1
0
        private void buttonsuakh_Click(object sender, EventArgs e)
        {
            string a   = textBoxmakh.Text;
            string b   = textBoxtenkh.Text;
            string c   = textBoxdiachikh.Text;
            string d   = textBoxemailkh.Text;
            bool   sdt = Int32.TryParse(textBoxsdtkh.Text, out int dt);
            DTOKH  k   = new DTOKH(b, c, dt, d);

            if (a != "" && b != "" && c != "" && d != "" && sdt != false)
            {
                if (kh.Update(k))
                {
                    load();
                }
                else
                {
                    MessageBox.Show("sua that bai");
                }
            }
            else
            {
                MessageBox.Show("sua that bai");
            }
        }
Exemple #2
0
        private void buttonthanhtoan_Click(object sender, EventArgs e)
        {
            string   manv = textBoxmanvban.Text;
            DateTime day  = dateTimePickerban.Value;
            string   a    = textBoxthongtinkh.Lines[0];
            string   b    = textBoxthongtinkh.Lines[1];
            bool     ch   = Int32.TryParse(textBoxthongtinkh.Lines[2], out int c);
            string   d    = textBoxthongtinkh.Lines[3];
            int      tt   = Convert.ToInt32(textBoxtongtienban.Text);
            DTOKH    k    = new DTOKH(a, b, c, d);

            if (a != "" && b != "" && d != "" && ch != false)
            {
                if (kh.Add(k))
                {
                    string     makh = kh.Getmax().ToString();
                    DTOBILLBAN bi   = new DTOBILLBAN(day, tt, makh, manv);
                    if (billban.Add(bi))
                    {
                        string idbi = billban.Getmax().ToString();
                        foreach (ListViewItem item in listViewBAN.Items)
                        {
                            string nhasx   = item.SubItems[2].Text;
                            string xe      = item.SubItems[0].Text;
                            bool   soluong = Int32.TryParse(item.SubItems[3].Text, out int sl);
                            Int32.TryParse(item.SubItems[4].Text, out int tien);
                            DTOINFORBILLBAN bif = new DTOINFORBILLBAN(xe, sl, nhasx, idbi);
                            if (infbillban.Add(bif, tien))
                            {
                                load();
                            }
                            else
                            {
                                MessageBox.Show("them thong tin bill that bai");
                                billban.Delete(idbi);
                                kh.Delete(makh);
                                load();
                            }
                        }
                    }
                    else
                    {
                        kh.Delete(makh);
                        MessageBox.Show("them bill that bai");
                    }
                }
                else
                {
                    MessageBox.Show("them khach hang that bai");
                }
            }
            else
            {
                MessageBox.Show("them that bai");
            }
        }
Exemple #3
0
        protected bool add(DTOKH a)
        {
            string query = string.Format("INSERT dbo.KHACHHANG (tenkh,diachi,sdt,email) VALUES ( N'{0},', N'{1}',{2},'{3}')", a.Tenkh, a.Diachi, a.Sdt, a.Email);

            return(executenonquery(query));
        }
Exemple #4
0
        protected bool update(DTOKH a)
        {
            string query = string.Format("UPDATE dbo.KHACHHANG SET tenkh='{0} ',diachi='{1} ',sdt={2},email='{3}' WHERE MAKH='{4}'", a.Tenkh, a.Diachi, a.Sdt, a.Email, a.Makh);

            return(executenonquery(query));
        }
Exemple #5
0
 public bool Add(DTOKH a)
 {
     return(add(a));
 }
Exemple #6
0
 public bool Update(DTOKH a)
 {
     return(update(a));
 }