示例#1
0
 public bool UpdateData(clsSanPham sanPham)
 {
     _conn.CMD.CommandText = String.Format("Update  tbSanPham set CodeSanPham = N'{0}',TenSanPham = N'{1}' ,DonVi = N'{2}'," +
                                           " MoTa = N'{3}',idLoaiSanPham = N'{4}',idNhaSanXuat = '{5}' where id = '{6}'"
                                           , sanPham.CodeSanPham, sanPham.TenSanPham, sanPham.DonVi, sanPham.MoTa, sanPham.IdLoaiSanPham, sanPham.IdNhaSanXuat, sanPham.Id);
     return(_conn.ExecuteCMD());
 }
示例#2
0
        /// <summary>
        ///
        /// </summary>
        public bool AddData(clsSanPham sanPham)
        {
            DialogResult result = MessageBox.Show("Xác nhận thêm sản phẩm " + sanPham.CodeSanPham + " ?", "Xác nhận",
                                                  MessageBoxButtons.YesNo, MessageBoxIcon.Question);

            if (result == DialogResult.No)
            {
                return(false);
            }
            ///them hoa don

            if (_mdlSanPham.AddData(sanPham))
            {
                MessageBox.Show("Thêm thành công", "Thêm sản phẩm", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //them chi tiet hoa don
                _viewSanPham.UpdateView();
                if (!this.AddCuaHangTheoSanPham())
                {
                    MessageBox.Show("Thêm cửa hàng theo sản phẩm thất bại", "Thêm sản phẩm cửa hàng", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                return(true);
            }
            else
            {
                MessageBox.Show("Thêm thất bại", "Thêm sản phẩm", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(false);
        }
示例#3
0
        /// <summary>
        ///
        /// </summary>
        public bool UpdateData(clsSanPham sanPham)
        {
            if (_mdlSanPham.UpdateData(sanPham))
            {
                //MessageBox.Show("Sửa thành công", "Sửa khách hàng", MessageBoxButtons.OK, MessageBoxIcon.Information);
                //them chi tiet hoa don
                //_viewSanPham.UpdateView();
                return(true);
            }
            else
            {
                MessageBox.Show("Sửa thất bại", "Sửa sản phẩm", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }

            return(false);
        }
示例#4
0
        private void loadTreeView()
        {
            clsSanPham    lstSP = new clsSanPham();
            List <LoaiSP> dsSP  = lstSP.GetAllSP2Grid();

            treeView1.Nodes.Clear();
            TreeNode nodecha = new TreeNode("DANH SÁCH SẢN PHẨM");

            foreach (LoaiSP c in dsSP)
            {
                TreeNode nodecon = new TreeNode(c.tenLoai);
                nodecon.Tag = c.maLoai;
                foreach (SanPham s in c.SanPhams)
                {
                    nodecon.Nodes.Add(s.tenSP);
                }
                nodecha.Nodes.Add(nodecon);
            }
            treeView1.Nodes.Add(nodecha);
            treeView1.ExpandAll();
        }
示例#5
0
 public bool AddData(clsSanPham sanPham)
 {
     _conn.CMD.CommandText = String.Format("INSERT [dbo].[tbSanPham] (CodeSanPham,TenSanPham,DonVi,MoTa,idLoaiSanPham,idNhaSanXuat) VALUES (N'{0}',N'{1}',N'{2}',N'{3}',N'{4}',N'{5}')"
                                           , sanPham.CodeSanPham, sanPham.TenSanPham, sanPham.DonVi, sanPham.MoTa, sanPham.IdLoaiSanPham, sanPham.IdNhaSanXuat);
     return(_conn.ExecuteCMD());
 }