Example #1
0
        public static bool SuaDonHangTam(DTO.DonHangTamDTO dhtDTO)
        {
            bool result = false;


            try
            {
                var parameters = new List <SQLiteParameter>
                {
                    new SQLiteParameter("@MaDonHangTam", dhtDTO.MaDonHangTam),
                    new SQLiteParameter("@NgayDatHang", dhtDTO.NgayDatHang.Date),
                    new SQLiteParameter("@TenNguoiBan", dhtDTO.TenNguoiBan),
                    new SQLiteParameter("@LienHeNguoiBan", dhtDTO.LienHeNguoiBan),
                    new SQLiteParameter("@SDTNguoiBan", dhtDTO.SDTNguoiBan),
                    new SQLiteParameter("@DiaDiemNhanHang", dhtDTO.DiaDiemNhan),
                    new SQLiteParameter("@TenNguoiMua", dhtDTO.TenNguoiMua),
                    new SQLiteParameter("@SDTNguoiMua", dhtDTO.SDTNguoiMua),
                    new SQLiteParameter("@DiaDiemGiaoHang", dhtDTO.DiaDiemGiao),
                    new SQLiteParameter("@TienThuHo", dhtDTO.TienThuHo),
                    new SQLiteParameter("@GhiChu", dhtDTO.GhiChu),
                };
                var n = DataAccessHelper.ExecuteNonQuery(
                    "UPDATE DONHANGTAM SET " +
                    "NgayDatHang=@NgayDatHang," +
                    "TenNguoiBan=@TenNguoiBan," +
                    "LienHeNguoiBan=@LienHeNguoiBan," +
                    "SDTNguoiBan=@SDTNguoiBan" +
                    "DiaDiemNhanHang=@DiaDiemNhanHang," +
                    "TenNguoiMua=@TenNguoiMua," +
                    "SDTNguoiMua=@SDTNguoiMua," +
                    "DiaDiemGiaoHang=@DiaDiemGiaoHang," +
                    "TienThuHo=@TienThuHo," +
                    "GhiChu=@GhiChu " +
                    "WHERE MaDonHangTam=@MaDonHangTam",
                    parameters
                    );
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }
Example #2
0
        public static bool SuaDonHang(DTO.DonHangDTO dhDTO)
        {
            bool result = false;


            try
            {
                var parameters = new List <SQLiteParameter>
                {
                    new SQLiteParameter("@MaDonHang", dhDTO.MaDonHang),
                    new SQLiteParameter("@LoaiDonHang", dhDTO.LoaiDonHang),
                    new SQLiteParameter("@KhuVuc", dhDTO.KhuVuc),
                    new SQLiteParameter("@NgayDatHang", dhDTO.NgayDatHang.Date),
                    new SQLiteParameter("@NgayNhanHang", dhDTO.NgayNhanHang.Date),
                    new SQLiteParameter("@NgayGiaoHang", dhDTO.NgayGiaoHang.Date),
                    new SQLiteParameter("@TrangThai", dhDTO.TrangThai),
                    new SQLiteParameter("@MaNhanVienNhan", dhDTO.MaNhanVienNhan),
                    new SQLiteParameter("@MaNhanVienGiao", dhDTO.MaNhanVienGiao),
                    new SQLiteParameter("@TenNguoiBan", dhDTO.TenNguoiBan),
                    new SQLiteParameter("@SDTNguoiBan", dhDTO.SDTNguoiBan),
                    new SQLiteParameter("@LienHeNguoiBan", dhDTO.LienHeNguoiBan),
                    new SQLiteParameter("@DiaDiemNhanHang", dhDTO.DiaDiemNhan),
                    new SQLiteParameter("@TenNguoiMua", dhDTO.TenNguoiMua),
                    new SQLiteParameter("@SDTNguoiMua", dhDTO.SDTNguoiMua),
                    new SQLiteParameter("@DiaDiemGiaoHang", dhDTO.DiaDiemGiao),
                    new SQLiteParameter("@TienThuHo", dhDTO.TienThuHo),
                    new SQLiteParameter("@PhiVanChuyen", dhDTO.PhiVanChuyen),
                    new SQLiteParameter("@PhiPhatSinh", dhDTO.PhiPhatSinh),
                    new SQLiteParameter("@TongThanhTien", dhDTO.TongThanhTien),
                    new SQLiteParameter("@GhiChu", dhDTO.GhiChu),
                };
                var n = DataAccessHelper.ExecuteNonQuery(
                    "UPDATE DONHANG SET LoaiDonHang=@LoaiDonHang, KhuVuc=@KhuVuc, NgayDatHang=@NgayDatHang, NgayNhanHang=@NgayNhanHang, NgayGiaoHang=@NgayGiaoHang, TrangThai=@TrangThai, MaNhanVienNhan=@MaNhanVienNhan, MaNhanVienGiao=@MaNhanVienGiao, TenNguoiBan=@TenNguoiBan, LienHeNguoiBan=@LienHeNguoiBan, SDTNguoiBan=@SDTNguoiBan, DiaDiemNhanHang=@DiaDiemNhanHang, TenNguoiMua=@TenNguoiMua, SDTNguoiMua=@SDTNguoiMua, DiaDiemGiaoHang=@DiaDiemGiaoHang, TienThuHo=@TienThuHo, PhiVanChuyen=@PhiVanChuyen, PhiPhatSinh=@PhiPhatSinh, TongThanhTien=@TongThanhTien, GhiChu=@GhiChu WHERE MaDonHang=@MaDonHang",
                    parameters
                    );
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }
Example #3
0
        public static bool XoaMoiNhanVien()
        {
            var result = false;

            try
            {
                var n = DataAccessHelper.ExecuteNonQuery("DELETE FROM NHANVIEN");
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Example #4
0
        public static bool ThemDonHang(DTO.DonHangDTO dhDTO)
        {
            var result = false;

            try
            {
                var parameters = new List <SQLiteParameter>
                {
                    new SQLiteParameter("@MaDonHang", dhDTO.MaDonHang),
                    new SQLiteParameter("@LoaiDonHang", dhDTO.LoaiDonHang),
                    new SQLiteParameter("@KhuVuc", dhDTO.KhuVuc),
                    new SQLiteParameter("@NgayDatHang", dhDTO.NgayDatHang.Date),
                    new SQLiteParameter("@NgayNhanHang", dhDTO.NgayNhanHang.Date),
                    new SQLiteParameter("@NgayGiaoHang", dhDTO.NgayGiaoHang.Date),
                    new SQLiteParameter("@TrangThai", dhDTO.TrangThai),
                    new SQLiteParameter("@MaNhanVienNhan", dhDTO.MaNhanVienNhan),
                    new SQLiteParameter("@MaNhanVienGiao", dhDTO.MaNhanVienGiao),
                    new SQLiteParameter("@TenNguoiBan", dhDTO.TenNguoiBan),
                    new SQLiteParameter("@LienHeNguoiBan", dhDTO.LienHeNguoiBan),
                    new SQLiteParameter("@SDTNguoiBan", dhDTO.SDTNguoiBan),
                    new SQLiteParameter("@DiaDiemNhanHang", dhDTO.DiaDiemNhan),
                    new SQLiteParameter("@TenNguoiMua", dhDTO.TenNguoiMua),
                    new SQLiteParameter("@SDTNguoiMua", dhDTO.SDTNguoiMua),
                    new SQLiteParameter("@DiaDiemGiaoHang", dhDTO.DiaDiemGiao),
                    new SQLiteParameter("@TienThuHo", dhDTO.TienThuHo),
                    new SQLiteParameter("@PhiVanChuyen", dhDTO.PhiVanChuyen),
                    new SQLiteParameter("@PhiPhatSinh", dhDTO.PhiPhatSinh),
                    new SQLiteParameter("@TongThanhTien", dhDTO.TongThanhTien),
                    new SQLiteParameter("@GhiChu", dhDTO.GhiChu),
                };
                var n = DataAccessHelper.ExecuteNonQuery
                            ("Insert into DONHANG values(@MaDonHang, @LoaiDonHang, @KhuVuc, @NgayDatHang, @NgayNhanHang, @NgayGiaoHang, @TrangThai, @MaNhanVienNhan, @MaNhanVienGiao, @TenNguoiBan, @LienHeNguoiBan, @SDTNguoiBan, @DiaDiemNhanHang, @TenNguoiMua, @SDTNguoiMua, @DiaDiemGiaoHang, @TienThuHo, @PhiVanChuyen, @PhiPhatSinh, @TongThanhTien, @GhiChu)",
                            parameters);
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Example #5
0
        public static bool XoaNhanVien(DTO.NhanVienDTO nvDTO)
        {
            var result = false;

            try
            {
                var parameters = new List <SQLiteParameter>
                {
                    new SQLiteParameter("@MaNhanVien", nvDTO.MaNhanVien)
                };
                var n = DataAccessHelper.ExecuteNonQuery(
                    "DELETE FROM NHANVIEN  WHERE MaNhanVien=@MaNhanVien", parameters);
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Example #6
0
        public static bool ThemNhanVien(DTO.NhanVienDTO nvDTO)
        {
            var result = false;

            try
            {
                var parameters = new List <SQLiteParameter>
                {
                    new SQLiteParameter("@MaNhanVien", nvDTO.MaNhanVien),
                    new SQLiteParameter("@TenNhanVien", nvDTO.TenNhanVien)
                };
                var n = DataAccessHelper.ExecuteNonQuery("INSERT INTO NHANVIEN VALUES(@MaNhanVien, @TenNhanVien)", parameters);
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Example #7
0
        public static bool XoaDonHangTam(string maDonHangTam)
        {
            var result = false;

            try
            {
                var parameters = new List <SQLiteParameter>
                {
                    new SQLiteParameter("@MaDonHangTam", maDonHangTam)
                };
                var n = DataAccessHelper.ExecuteNonQuery(
                    "DELETE FROM DONHANGTAM  WHERE MaDonHangTam=@MaDonHangTam", parameters);
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Example #8
0
        public static bool ThemDonHangTam(DTO.DonHangTamDTO dhtDTO)
        {
            var result = false;

            try
            {
                var parameters = new List <SQLiteParameter>
                {
                    new SQLiteParameter("@MaDonHangTam", dhtDTO.MaDonHangTam),
                    new SQLiteParameter("@NgayDatHang", dhtDTO.NgayDatHang.Date),
                    new SQLiteParameter("@TenNguoiBan", dhtDTO.TenNguoiBan),
                    new SQLiteParameter("@LienHeNguoiBan", dhtDTO.LienHeNguoiBan),
                    new SQLiteParameter("@SDTNguoiBan", dhtDTO.SDTNguoiBan),
                    new SQLiteParameter("@DiaDiemNhanHang", dhtDTO.DiaDiemNhan),
                    new SQLiteParameter("@TenNguoiMua", dhtDTO.TenNguoiMua),
                    new SQLiteParameter("@SDTNguoiMua", dhtDTO.SDTNguoiMua),
                    new SQLiteParameter("@DiaDiemGiaoHang", dhtDTO.DiaDiemGiao),
                    new SQLiteParameter("@TienThuHo", dhtDTO.TienThuHo),
                    new SQLiteParameter("@GhiChu", dhtDTO.GhiChu),
                };
                var n = DataAccessHelper.ExecuteNonQuery
                        (
                    "INSERT INTO DONHANGTAM VALUES(@MaDonHangTam,@NgayDatHang,@TenNguoiBan,@LienHeNguoiBan,@SDTNguoiBan,@DiaDiemNhanHang, @TenNguoiMua,@SDTNguoiMua,@DiaDiemGiaoHang,@TienThuHo,@GhiChu)",
                    parameters
                        );
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(result);
        }
Example #9
0
        public static bool UpdatePhiThuHo(double phithuho)
        {
            var result = false;

            try
            {
                var parameters = new List <SQLiteParameter>
                {
                    new SQLiteParameter("@PhiThuHo", phithuho)
                };
                var n = DataAccessHelper.ExecuteNonQuery(
                    "Update THAMSO Set PhiThuHo = @PhiThuHo", parameters);
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }
Example #10
0
        public static bool UpdateSoTienTrenKm(double sotientrenkm)
        {
            var result = false;

            try
            {
                var parameters = new List <SQLiteParameter>
                {
                    new SQLiteParameter("@SoTienTrenKm", sotientrenkm)
                };
                var n = DataAccessHelper.ExecuteNonQuery(
                    "Update THAMSO Set SoTienTrenKm = @SoTienTrenKm", parameters);
                if (n == 1)
                {
                    result = true;
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(result);
        }