Exemple #1
0
        protected bool add(DTOBILLNHAP a)
        {
            string day   = a.Ngay.ToString("yyyyMMdd");
            string query = string.Format("INSERT dbo.billnhap (manvnhap, manhasx, ngay, tongtiennhap ) VALUES ( '{0}', '{1}','{2}', {3} )", a.Manv, a.Manhasx, day, a.Tongtien);

            return(executenonquery(query));
        }
Exemple #2
0
        private void buttonthanhtoannhap_Click(object sender, EventArgs e)
        {
            NHASX       sx   = comboBoxnhasxnhap.SelectedItem as NHASX;
            string      s    = sx.Ma;
            string      manv = textBoxmanvnhap.Text;
            DateTime    day  = dateTimePickernhap.Value;
            int         tt   = Convert.ToInt32(textBoxtongtiennhap.Text);
            DTOBILLNHAP bi   = new DTOBILLNHAP(day, tt, manv, s);

            if (billnhap.Add(bi))
            {
                string idbi = billnhap.Getnew().ToString();
                foreach (ListViewItem item in listViewnhap.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);
                    DTOINFORBILLNHAP bif = new DTOINFORBILLNHAP(xe, sl, idbi);
                    if (infbillnhap.Add(bif, tien))
                    {
                        load();
                    }
                    else
                    {
                        MessageBox.Show("them thong tin bill that bai");
                        billnhap.Delete(idbi);
                        load();
                    }
                }
            }
            else
            {
                MessageBox.Show("them bill that bai");
            }
        }
Exemple #3
0
 public bool Add(DTOBILLNHAP a)
 {
     return(add(a));
 }