Exemplo n.º 1
0
        private Khohang Laythongtinncc()
        {
            Khohang ncc = new Khohang();

            ncc.Tenkhohang = txtkhohang.Text;
            ncc.Diachikho  = txtdiachi.Text;
            return(ncc);
        }
Exemplo n.º 2
0
 public themsuakhohang(Khohang khohang)
 {
     InitializeComponent();
     Id              = khohang.Id;
     txtdiachi.Text  = khohang.Diachikho;
     txtkhohang.Text = khohang.Tenkhohang;
     btnluu.Text     = "Cập nhật";
     this.Text       = "Cập nhật kho hàng";
 }
Exemplo n.º 3
0
        public int themsuankh(int Id, Khohang khohang)
        {
            string sql = "";

            if (Id != 0)
            {
                sql = string.Format("Update Khohang Set Tenkhohang=N'{0}',Diachikho= N'{1}' Where Id='{2}'", khohang.Tenkhohang, khohang.Diachikho, Id);
            }
            else
            {
                sql = string.Format("Insert into Khohang(Tenkhohang,Diachikho) Values(N'{0}',N'{1}')", khohang.Tenkhohang, khohang.Diachikho);
            }
            var rs = db.thesuadulieu(sql);

            return(rs);
        }
Exemplo n.º 4
0
        private void Btnsua_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e)
        {
            Object id     = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Id");
            Object tenNCC = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Tenkhohang");
            Object diaChi = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Diachikho");

            Khohang khohang = new Khohang()
            {
                Id         = int.Parse(id.ToString()),
                Tenkhohang = tenNCC.ToString(),
                Diachikho  = diaChi.ToString(),
            };
            themsuakhohang themsuansx = new themsuakhohang(khohang);

            themsuansx.Show();
            themsuansx.khicapnhat += Themsuansx_khicapnhat;
        }
Exemplo n.º 5
0
        private void Btnluu_Click(object sender, EventArgs e)
        {
            Khohang ncc = Laythongtinncc();
            var     row = khohangBUS.themsuankh(Id, ncc);

            if (row > 0)
            {
                khicapnhat();
                if (Id != 0)
                {
                    MessageBox.Show("Cập nhật thành công!");
                }
                else
                {
                    MessageBox.Show("Thêm kho hàng thành công!");
                }
                this.Close();
            }
            else
            {
                MessageBox.Show("Cập nhật thất bại!");
            }
        }
Exemplo n.º 6
0
 public int themsuankh(int Id, Khohang khohang)
 {
     return(khohangDAO.themsuankh(Id, khohang));
 }