Beispiel #1
0
        private Nhasanxuat Laythongtinncc()
        {
            Nhasanxuat ncc = new Nhasanxuat();

            ncc.TenNSX  = txttebnsx.Text;
            ncc.Quocgia = txtquocgia.Text;
            ncc.Website = txtwebsite.Text;
            return(ncc);
        }
Beispiel #2
0
 public themsuanhasanxxuat(Nhasanxuat nhasanxuat)
 {
     InitializeComponent();
     Id = nhasanxuat.Id;
     txtquocgia.Text = nhasanxuat.Quocgia;
     txttebnsx.Text  = nhasanxuat.TenNSX;
     txtwebsite.Text = nhasanxuat.Website;
     btnluu.Text     = "Thêm";
     this.Text       = "Cập nhật nhà sản xuất";
 }
Beispiel #3
0
        public int themsuansx(int Id, Nhasanxuat nhasanxuat)
        {
            string sql = "";

            if (Id != 0)
            {
                sql = string.Format("Update Thuonghieu Set TenNSX=N'{0}',Quocgia= N'{1}',Website=N'{2}' Where Id='{3}'", nhasanxuat.TenNSX, nhasanxuat.Quocgia, nhasanxuat.Website, Id);
            }
            else
            {
                sql = string.Format("Insert into Thuonghieu(TenNSX,Quocgia,Website) Values(N'{0}',N'{1}','{2}')", nhasanxuat.TenNSX, nhasanxuat.Quocgia, nhasanxuat.Website);
            }
            var rs = db.thesuadulieu(sql);

            return(rs);
        }
Beispiel #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, "TenNSX");
            Object     diaChi     = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Quocgia");
            Object     website    = gridView1.GetRowCellValue(gridView1.FocusedRowHandle, "Website");
            Nhasanxuat nhasanxuat = new Nhasanxuat()
            {
                Id      = int.Parse(id.ToString()),
                TenNSX  = tenNCC.ToString(),
                Quocgia = diaChi.ToString(),
                Website = website.ToString(),
            };
            themsuanhasanxxuat themsuansx = new themsuanhasanxxuat(nhasanxuat);

            themsuansx.Show();
            themsuansx.khicapnhat += Themsuansx_khicapnhat;
        }
Beispiel #5
0
        private void Btnluu_Click(object sender, EventArgs e)
        {
            Nhasanxuat ncc = Laythongtinncc();
            var        row = nhasanxautBUS.themsuansx(Id, ncc);

            if (row > 0)
            {
                khicapnhat();
                if (Id != 0)
                {
                    MessageBox.Show("Cập nhật thành công!");
                }
                else
                {
                    MessageBox.Show("Thêm nhà sản xuất thành công!");
                }
                this.Close();
            }
            else
            {
                MessageBox.Show("Cập nhật thất bại!");
            }
        }
 public int themsuansx(int Id, Nhasanxuat nhasanxuat)
 {
     return(nhacungcapDAO.themsuansx(Id, nhasanxuat));
 }