예제 #1
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                var count = 0;

                var repo = new KhachHangRepository(context);

                for (int i = 0; i < _listId.Count; i++)
                {
                    if (_listId[i] > 0 && await repo.Delete(_listId[i]))
                    {
                        count++;
                        InsertLuocSuAction ls = new InsertLuocSuAction();
                        ls.InsertLuocSu(context, "ListKhachHang", _listId[i], "Delete", 0);
                    }
                }

                return(returnActionResult(HttpStatusCode.OK, count, null));
            }
            catch (FormatException ex)
            {
                return(returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #2
0
 public AuthController(KhachHangRepository khachHangRepository, JWTService jWTService, IOptions <AuthSettings> authSettings, AccountRepository accountRepository) : base()
 {
     this.khachHangRepository = khachHangRepository;
     this.jWTService          = jWTService;
     this.authSettings        = authSettings.Value;
     this.accountRepository   = accountRepository;
 }
예제 #3
0
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                dynamic result = new System.Dynamic.ExpandoObject();
                var     repo   = new KhachHangRepository(context);
                await repo.UpdatePartial(this,
                                         nameof(Ma),
                                         nameof(Ten),
                                         nameof(Loai),
                                         nameof(DienThoai),
                                         nameof(DiDong),
                                         nameof(Email),
                                         nameof(DiaChi),
                                         nameof(TinhThanhPhoId),
                                         nameof(QuanHuyenId),
                                         nameof(PhuongXaId),
                                         nameof(AnyDesk)
                                         );

                result.data = this;
                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "KhachHang", KhachHangId, "Update", 0);
                return(returnActionResult(this, null));
            }
            catch (FormatException ex)
            {
                return(returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
예제 #4
0
 public DoanhNghiepController(DoanhNghiepRepository doanhNghiepRepository, DoanhNghiepService doanhNghiepService, AccountRepository accountRepository, KhachHangRepository khachHangRepository, ThanhPhoService thanhPhoService, DiaChiRepository diaChiRepository)
 {
     this.doanhNghiepRepository = doanhNghiepRepository;
     this.doanhNghiepService    = doanhNghiepService;
     this.accountRepository     = accountRepository;
     this.khachHangRepository   = khachHangRepository;
     this.thanhPhoService       = thanhPhoService;
     this.diaChiRepository      = diaChiRepository;
 }
예제 #5
0
 public UnitOfWork(QLNHContext context)
 {
     this.context = context;
     ThucDons     = new ThucDonRepository(context);
     BanAns       = new BanAnRepository(context);
     HoaDons      = new HoaDonRepository(context);
     LoaiMonAns   = new LoaiMonAnRepository(context);
     KhachHangs   = new KhachHangRepository(context);
     PhieuDatBans = new PhieuDatBanRepository(context);
     NguoiDungs   = new NguoiDungRepository(context);
 }
예제 #6
0
 public UnitOfWork(IDbContextFactory <DoAnDbContext> dbContextFactory, Microsoft.AspNetCore.Http.IHttpContextAccessor httpContextAccessor)
 {//2
     _dbContext = dbContextFactory.GetContext();
     DanhSachPhongRepository   = new DanhSachPhongRepository(_dbContext);
     DuThuyenRepository        = new DuThuyenRepository(_dbContext);
     HangPhongRepository       = new HangPhongRepository(_dbContext);
     KhachHangRepository       = new KhachHangRepository(_dbContext);
     KieuGiuongRepository      = new KieuGiuongRepository(_dbContext);
     NhomPhongRepository       = new NhomPhongRepository(_dbContext);
     PhieuDatChiTietRepository = new PhieuDatChiTietRepository(_dbContext);
     PhieuDatPhongRepository   = new PhieuDatPhongRepository(_dbContext);
 }
예제 #7
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                var khachhang = new Entity.MSSQL_QLDN_QLNS.Entity.KhachHang();
                khachhang.Ma             = Ma;
                khachhang.Ten            = Ten;
                khachhang.Loai           = Protector.Short(Loai);
                khachhang.DienThoai      = DienThoai;
                khachhang.DiDong         = DiDong;
                khachhang.Email          = Email;
                khachhang.DiaChi         = DiaChi;
                khachhang.TinhThanhPhoId = Protector.Short(Tinh);
                khachhang.QuanHuyenId    = Protector.Short(Huyen);
                khachhang.PhuongXaId     = Protector.Short(Xa);
                khachhang.AnyDesk        = AnyDesk;
                khachhang.NgayTao        = DateTime.Now;
                khachhang.NguoiTao       = 1;
                khachhang.XoaYN          = "N";
                khachhang.CtrVersion     = 1;

                KhachHangRepository repo = new KhachHangRepository(context);
                await repo.Insert(khachhang);

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "KhachHang", khachhang.KhachHangId, "Insert", 0);
                return(returnActionResult(HttpStatusCode.OK, khachhang, null));
            }
            catch (FormatException ex)
            {
                return(returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #8
0
 public KhachHangController(KhachHangRepository khachHangRepository)
 {
     this.khachHangRepository = khachHangRepository;
 }
예제 #9
0
 public KhachHangBUL()
 {
     khdal = new KhachHangRepository();
 }