Example #1
0
        public static bool updateHDN(EC_HDN cthd)
        {
            conn = GetData.KetNoi();
            string sTruyVan = "HoaDonNhap_Update";

            cmd             = new SqlCommand(sTruyVan, conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MAHDN", SqlDbType.NVarChar).Value = cthd.MaHDN;
            cmd.Parameters.Add("@NGAYNHAP", SqlDbType.Date).Value  = cthd.NgayNhap;
            cmd.Parameters.Add("@MANV", SqlDbType.NVarChar).Value  = cthd.MaNV;
            cmd.Parameters.Add("@MANCC", SqlDbType.NVarChar).Value = cthd.MaNCC;
            cmd.Parameters.Add("@TONGTIEN", SqlDbType.Float).Value = cthd.TongTien;


            cmd.ExecuteNonQuery();
            cmd.Dispose();
            try
            {
                GetData.ThucThiTruyVanNonQuery(sTruyVan, conn);
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(true);
            }
            catch (Exception ex)
            {
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(false);
            }
        }
Example #2
0
        public static bool deleteHDN(EC_HDN cthd)
        {
            conn = GetData.KetNoi();
            string sTruyVan = "HoaDonNhap_Delete";

            cmd             = new SqlCommand(sTruyVan, conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MAHDN", SqlDbType.NVarChar).Value = cthd.MaHDN;
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            conn.Close();
            try
            {
                GetData.ThucThiTruyVanNonQuery(sTruyVan, conn);
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(true);
            }
            catch (Exception ex)
            {
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(false);
            }
        }
Example #3
0
        public static bool updateBaoHanh(EC_BaoHanh bh)
        {
            conn = GetData.KetNoi();
            string truyvan = "BaoHanh_Update";

            cmd             = new SqlCommand(truyvan, conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MABH", SqlDbType.NVarChar).Value   = bh.MaBH;
            cmd.Parameters.Add("@MAKH", SqlDbType.NVarChar).Value   = bh.MaKH;
            cmd.Parameters.Add("@MASP", SqlDbType.NVarChar).Value   = bh.MaSP;
            cmd.Parameters.Add("@IMEI", SqlDbType.NVarChar).Value   = bh.IMEI;
            cmd.Parameters.Add("@NGAYBD", SqlDbType.NVarChar).Value = bh.NgayBD;
            cmd.Parameters.Add("@NGAYKT", SqlDbType.NVarChar).Value = bh.NgayKT;
            cmd.Parameters.Add("@LOI", SqlDbType.NVarChar).Value    = bh.Loi;
            cmd.Parameters.Add("@GHICHU", SqlDbType.NVarChar).Value = bh.GhiChu;

            cmd.ExecuteNonQuery();
            cmd.Dispose();

            try
            {
                GetData.ThucThiTruyVanNonQuery(truyvan, conn);
                GetData.DongKetNoi(conn);
                return(true);
            }
            catch (Exception ex)
            {
                GetData.DongKetNoi(conn);
                return(false);
            }
        }
        public static bool updateNV(EC_NhanVien nv)
        {
            conn = GetData.KetNoi();
            string sTruyVan = "NhanVien_Update";

            cmd             = new SqlCommand(sTruyVan, conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MANV", SqlDbType.NVarChar).Value      = nv.MaNV;
            cmd.Parameters.Add("@TENNV", SqlDbType.NVarChar).Value     = nv.TenNV;
            cmd.Parameters.Add("@NGAYSINH", SqlDbType.NVarChar).Value  = nv.NgaySinh;
            cmd.Parameters.Add("@GIOITINH", SqlDbType.NVarChar).Value  = nv.GioiTinh;
            cmd.Parameters.Add("@DIENTHOAI", SqlDbType.NVarChar).Value = nv.DienThoai;
            cmd.Parameters.Add("@DIACHI", SqlDbType.NVarChar).Value    = nv.DiaChi;
            cmd.Parameters.Add("@EMAIL", SqlDbType.NVarChar).Value     = nv.Email;
            cmd.Parameters.Add("@CHUCVU", SqlDbType.NVarChar).Value    = nv.ChucVu;
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            try
            {
                GetData.ThucThiTruyVanNonQuery(sTruyVan, conn);
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(true);
            }
            catch (Exception ex)
            {
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(false);
            }
        }
        public static bool deleteTK(EC_TaiKhoan tk)
        {
            conn = GetData.KetNoi();
            string sTruyVan = "TaiKhoan_Delete";

            cmd             = new SqlCommand(sTruyVan, conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@TaiKhoan", SqlDbType.NVarChar).Value = tk.TaiKhoan;
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            conn.Close();
            try
            {
                GetData.ThucThiTruyVanNonQuery(sTruyVan, conn);
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(true);
            }
            catch (Exception ex)
            {
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(false);
            }
        }
        public static bool updateNCC(EC_NhaCungCap ncc)
        {
            conn = GetData.KetNoi();
            string sTruyVan = "NhaCungCap_Update";

            cmd             = new SqlCommand(sTruyVan, conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MANCC", SqlDbType.NVarChar).Value     = ncc.MaNCC;
            cmd.Parameters.Add("@TENNCC", SqlDbType.NVarChar).Value    = ncc.TenNCC;
            cmd.Parameters.Add("@DIENTHOAI", SqlDbType.NVarChar).Value = ncc.DienThoai;
            cmd.Parameters.Add("@DIACHI", SqlDbType.NVarChar).Value    = ncc.DiaChi;
            cmd.Parameters.Add("@EMAIL", SqlDbType.NVarChar).Value     = ncc.Email;
            cmd.ExecuteNonQuery();
            cmd.Dispose();
            try
            {
                GetData.ThucThiTruyVanNonQuery(sTruyVan, conn);
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(true);
            }
            catch (Exception ex)
            {
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(false);
            }
        }
        public static bool updateCTHDN(EC_CTHDN cthd)
        {
            conn = GetData.KetNoi();
            string sTruyVan = "CTHDN_Update";

            cmd             = new SqlCommand(sTruyVan, conn);
            cmd.CommandType = CommandType.StoredProcedure;

            cmd.Parameters.Add("@MAHDN", SqlDbType.NVarChar).Value  = cthd.MaHDN;
            cmd.Parameters.Add("@MASP", SqlDbType.NVarChar).Value   = cthd.MaSP;
            cmd.Parameters.Add("@SOLUONG", SqlDbType.Int).Value     = cthd.SoLuong;
            cmd.Parameters.Add("@DONGIA", SqlDbType.Float).Value    = cthd.DonGia;
            cmd.Parameters.Add("@THANHTIEN", SqlDbType.Float).Value = cthd.ThanhTien;

            cmd.ExecuteNonQuery();
            cmd.Dispose();
            try
            {
                GetData.ThucThiTruyVanNonQuery(sTruyVan, conn);
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(true);
            }
            catch (Exception ex)
            {
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(false);
            }
        }
        public static bool insertSanPham(EC_SanPham sp)
        {
            conn = GetData.KetNoi();
            string sTruyVan = "SanPham_Insert";

            cmd             = new SqlCommand(sTruyVan, conn);
            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@MASP", SqlDbType.NVarChar).Value      = sp.MaSP;
            cmd.Parameters.Add("@TENSP", SqlDbType.NVarChar).Value     = sp.TenSP;
            cmd.Parameters.Add("@SOLUONG", SqlDbType.Int).Value        = sp.SoLuong;
            cmd.Parameters.Add("@DONGIABAN", SqlDbType.Float).Value    = sp.DonGiaBan;
            cmd.Parameters.Add("@DONVITINH", SqlDbType.NVarChar).Value = sp.DonViTinh;
            //cmd.Parameters.Add("@HINHANH", SqlDbType.NVarChar).Value = sp.HinhAnh;
            cmd.Parameters.Add("@MANSX", SqlDbType.NVarChar).Value      = sp.MaNSX;
            cmd.Parameters.Add("@HEDIEUHANH", SqlDbType.NVarChar).Value = sp.HeDieuHanh;
            cmd.Parameters.Add("@CPU", SqlDbType.NVarChar).Value        = sp.Cpu;
            cmd.Parameters.Add("@RAM", SqlDbType.NVarChar).Value        = sp.Ram;
            cmd.Parameters.Add("@PIN", SqlDbType.NVarChar).Value        = sp.Pin;
            cmd.Parameters.Add("@KETNOI", SqlDbType.NVarChar).Value     = sp.KetNoi;
            cmd.Parameters.Add("@BONHO", SqlDbType.NVarChar).Value      = sp.BoNho;
            cmd.Parameters.Add("@CAMERA", SqlDbType.NVarChar).Value     = sp.Camera;
            cmd.ExecuteNonQuery();
            cmd.Dispose();

            try
            {
                GetData.ThucThiTruyVanNonQuery(sTruyVan, conn);
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(true);
            }
            catch (Exception ex)
            {
                //Đóng kết nối
                GetData.DongKetNoi(conn);
                return(false);
            }
        }