Exemplo n.º 1
0
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();
                var repo = new KhoPhieuChiRepository(context);
                if (_KhoPhieuChi != null)
                {
                    var congviecEntity = new Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuChi();
                    congviecEntity.PhieuChiId = _KhoPhieuChi.PhieuChiId;

                    congviecEntity.XoaYN   = "Y";
                    congviecEntity.SoPhieu = null;
                    congviecEntity         = await repo.UpdatePartial(congviecEntity,
                                                                      nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuChi.XoaYN),
                                                                      nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuChi.SoPhieu)
                                                                      );

                    _KhoPhieuChi.XoaYN = congviecEntity.XoaYN;
                    InsertKhoLuocSuAction ls = new InsertKhoLuocSuAction();
                    ls.InsertKhoLuocSu(context, "KhoPhieuChi", congviecEntity.PhieuChiId, "Delete", 0);
                }
                else
                {
                    if (_listKhoPhieuChi != null && _listKhoPhieuChi.Count > 0)
                    {
                        foreach (var congviecModel in _listKhoPhieuChi)
                        {
                            if (congviecModel.PhieuChiId > 0)
                            {
                                var congviecEntity = new Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuChi();
                                congviecEntity.PhieuChiId = congviecModel.PhieuChiId;

                                congviecEntity.XoaYN   = "Y";
                                congviecEntity.SoPhieu = "";
                                congviecEntity         = await repo.UpdatePartial(congviecEntity,
                                                                                  nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuChi.XoaYN),
                                                                                  nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuChi.SoPhieu)
                                                                                  );

                                congviecModel.XoaYN = congviecEntity.XoaYN;
                                InsertKhoLuocSuAction ls = new InsertKhoLuocSuAction();
                                ls.InsertKhoLuocSu(context, "KhoPhieuChi", congviecEntity.PhieuChiId, "Delete", 0);
                            }
                        }
                    }
                }

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, _listKhoPhieuChi, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Exemplo n.º 2
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                // TODO load chi tiêt
                var bizGetListChiTiet = new GetListChiTietByPhieuNhapIdBiz(context);
                bizGetListChiTiet.PHIEU_NHAP_ID = _phieuNhapId;
                bizGetListChiTiet.LOGIN_ID      = _LoginId;

                var listChiTiet = await bizGetListChiTiet.Execute();

                if (listChiTiet.Count() < 1)
                {
                    throw new BaseException("Không tìm thấy thông tin chi tết");
                }

                var affected = 0;
                var biz      = new LuuSoCaiBiz(context);
                foreach (var chitiet in listChiTiet)
                {
                    biz.PHIEU_NHAP_CHI_TIET_ID = chitiet.PhieuNhapChiTietId;
                    var result = await biz.Execute();

                    if (result.Count() > 0 && string.IsNullOrEmpty(biz.MESSAGE))
                    {
                        affected = affected + 1;
                    }
                    else
                    {
                        throw new BaseException(biz.MESSAGE.Split('|')[2]);
                    }
                }

                // TODO đổi trang thai phiếu nhập
                var repoPhieuNhap = new KhoPhieuNhapRepository(context);
                var phieunhap     = new Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuNhap();
                phieunhap.PhieuNhapId = _phieuNhapId;
                phieunhap.MaTrangThai = "KPN_LSC";
                var resultUpdatePhieuNhap = await repoPhieuNhap.UpdatePartial(phieunhap
                                                                              , nameof(phieunhap.MaTrangThai));

                var ls = new InsertKhoLuocSuAction();
                ls.InsertKhoLuocSu(context, "KhoPhieuNhap", _phieuNhapId, "Update", _LoginId);

                dynamic _metaData = new System.Dynamic.ExpandoObject();

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, resultUpdatePhieuNhap, _metaData));
            }
            catch (BaseException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
Exemplo n.º 3
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                // TODO load chi tiêt
                var biz = new LuuSoCaiBiz(context);
                biz.PHIEU_NHAP_ID = _phieuNhapId;
                biz.LOGIN_ID      = _LoginId;
                biz.KHOA_MO       = KhoaMo;
                var result = await biz.Execute();

                if (string.IsNullOrEmpty(biz.MESSAGE) == false)
                {
                    throw new BaseException(biz.MESSAGE.Split('|')[2]);
                }

                var ls = new InsertKhoLuocSuAction();
                ls.InsertKhoLuocSu(context, "KhoPhieuNhap", _phieuNhapId, "Update", _LoginId);

                dynamic _metaData = new System.Dynamic.ExpandoObject();

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, result, _metaData));
            }
            catch (BaseException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
Exemplo n.º 4
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                _PhieuNhap.NguoiTao = _LoginId;

                var biz = new InsertKhoPhieuNhapBiz(context);
                biz.PhieuNhap   = _PhieuNhap;
                biz.ListChiTiet = _listChiTiet;
                var result = await biz.Execute();

                var ls = new InsertKhoLuocSuAction();
                ls.InsertKhoLuocSu(context, "KhoPhieuNhap", result.PhieuNhapId, "Insert", _LoginId);

                dynamic _metaData = new System.Dynamic.ExpandoObject();

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, result, _metaData));
            }
            catch (BaseException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
Exemplo n.º 5
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                _PhieuNhap.NguoiTao = _LoginId;

                var biz = new InsertKhoPhieuNhapBiz(context);
                biz.PhieuNhapId   = _PhieuNhap.PhieuNhapId;
                biz.LoaiPhieu     = _PhieuNhap.LoaiPhieu;
                biz.ChiPhi        = _PhieuNhap.ChiPhi ?? 0;
                biz.KhachHangId   = _PhieuNhap.KhachHangId;
                biz.KhoNhap       = _PhieuNhap.KhoNhap;
                biz.NgayChungTu   = _PhieuNhap.NgayChungTu;
                biz.NgayThanhToan = _PhieuNhap.NgayThanhToan;
                biz.NgayNhap      = _PhieuNhap.NgayNhap;
                biz.NguoiGiaoHang = _PhieuNhap.NguoiGiaoHang;
                biz.NguoiNhanHang = _PhieuNhap.NguoiNhanHang;
                biz.NoiDung       = _PhieuNhap.NoiDung;
                biz.Seri          = _PhieuNhap.Seri;
                biz.SoHoaDon      = _PhieuNhap.SoHoaDon;
                biz.SoPhieu       = _PhieuNhap.SoPhieu;
                biz.TaiKhoanCo    = _PhieuNhap.TaiKhoanCo;
                biz.TaiKhoanNo    = _PhieuNhap.TaiKhoanNo;
                biz.ThueVAT       = _PhieuNhap.ThueVAT;
                biz.TienThue      = _PhieuNhap.TienThue;
                biz.ThuKho        = _PhieuNhap.ThuKho;
                biz.Hinh          = _PhieuNhap.Hinh;
                biz.CtrVersion    = _PhieuNhap.CtrVersion;

                biz.CHI_TIET = strListChiTiet();
                biz.LOGIN_ID = _LoginId;
                var result = await biz.Execute();

                if (String.IsNullOrEmpty(biz.MESSAGE))
                {
                    var ls = new InsertKhoLuocSuAction();
                    ls.InsertKhoLuocSu(context, "KhoPhieuNhap", result.FirstOrDefault().PhieuNhapId, "Insert", _LoginId);
                }
                else
                {
                    throw new BaseException(biz.MESSAGE.Split('|')[2]);
                }

                dynamic _metaData = new System.Dynamic.ExpandoObject();

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, result.FirstOrDefault(), _metaData));
            }
            catch (BaseException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
Exemplo n.º 6
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                _PhieuChuyen.NguoiTao = _LoginId;

                var biz = new UpdateKhoPhieuChuyenBiz(context);
                biz.PhieuChuyenId = _PhieuChuyen.PhieuChuyenId;
                biz.SoPhieu       = _PhieuChuyen.SoPhieu;
                biz.NoiDung       = _PhieuChuyen.NoiDung;
                biz.TaiKhoanNhap  = _PhieuChuyen.TaiKhoanNhap;
                biz.TaiKhoanXuat  = _PhieuChuyen.TaiKhoanXuat;
                biz.NgayXuat      = _PhieuChuyen.NgayXuat;
                biz.NgayNhap      = _PhieuChuyen.NgayNhap;
                biz.KhoNhap       = _PhieuChuyen.KhoNhap;
                biz.KhoXuat       = _PhieuChuyen.KhoXuat;
                biz.NguoiGiaoHang = _PhieuChuyen.NguoiGiaoHang;
                biz.NguoiNhanHang = _PhieuChuyen.NguoiNhanHang;
                biz.GhiChu        = _PhieuChuyen.GhiChu;
                biz.Hinh          = _PhieuChuyen.Hinh;
                biz.MaTrangThai   = _PhieuChuyen.MaTrangThai;
                biz.ChiPhi        = _PhieuChuyen.ChiPhi;
                biz.ThueVAT       = _PhieuChuyen.ThueVAT;
                biz.NguoiTao      = _PhieuChuyen.NguoiTao;
                biz.NgayTao       = _PhieuChuyen.NgayTao;
                biz.XoaYN         = _PhieuChuyen.XoaYN;
                biz.CtrVersion    = _PhieuChuyen.CtrVersion;

                biz.CHI_TIET = strListChiTiet();
                biz.LOGIN_ID = _LoginId;
                var result = await biz.Execute();

                if (String.IsNullOrEmpty(biz.MESSAGE))
                {
                    var ls = new InsertKhoLuocSuAction();
                    ls.InsertKhoLuocSu(context, "KhoPhieuChuyen", result.FirstOrDefault().PhieuChuyenId, "Update", _LoginId);
                }
                else
                {
                    throw new BaseException(biz.MESSAGE.Split('|')[2]);
                }

                dynamic _metaData = new System.Dynamic.ExpandoObject();

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, result.FirstOrDefault(), _metaData));
            }
            catch (BaseException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
Exemplo n.º 7
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                var biz = new UpdateKhoPhieuBaoHanhBiz(context);
                biz.PhieuBaoHanhId    = PhieuBaoHanhId;
                biz.SeriesNo          = SeriesNo;
                biz.TenKhachHang      = TenKhachHang;
                biz.DienThoai         = DienThoai;
                biz.SoPhieu           = SoPhieu;
                biz.TenThietBi        = TenThietBi;
                biz.HangSanXuat       = HangSanXuat;
                biz.NgayHen           = NgayHen;
                biz.ChuanDoan         = ChuanDoan;
                biz.YeuCauKhachHang   = YeuCauKhachHang;
                biz.PhuKienKemTheo    = PhuKienKemTheo;
                biz.TrangThaiTiepNhan = TrangThaiTiepNhan;
                biz.SanPhamCty        = SanPhamCty;
                biz.CtrVersion        = CtrVersion;
                biz.LOGIN_ID          = _LoginId;
                biz.Email             = Email;
                biz.LoaiBaoHanh       = LoaiBaoHanh;

                var result = await biz.Execute();

                if (String.IsNullOrEmpty(biz.MESSAGE))
                {
                    var ls = new InsertKhoLuocSuAction();
                    ls.InsertKhoLuocSu(context, "KhoPhieuBaoHanh", result.FirstOrDefault().PhieuBaoHanhId, "Update", _LoginId);
                }
                else
                {
                    throw new BaseException(biz.MESSAGE.Split('|')[2]);
                }

                dynamic _metaData = new System.Dynamic.ExpandoObject();

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, result, _metaData));
            }
            catch (BaseException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
Exemplo n.º 8
0
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                dynamic result = new ActionResultDto();

                var repo = new KhoHangHoaRepository(context);
                await repo.UpdatePartial(this,
                                         nameof(MaHangHoa),
                                         nameof(TenHangHoa),
                                         nameof(TuKhoa),
                                         nameof(DonViTinh),
                                         nameof(GiaMua),
                                         nameof(GiaBan),
                                         nameof(ThueMua),
                                         nameof(ThueBan),
                                         nameof(CauHinh),
                                         nameof(Hinh),
                                         nameof(ThoiGianBaoHanh),
                                         nameof(NhomHangHoaId),
                                         nameof(LoaiHangHoaId),
                                         nameof(NhaCungCapId),
                                         nameof(HangSanXuatId),
                                         nameof(NuocSanXuatId),
                                         nameof(MoTa),
                                         nameof(GhiChu)
                                         );

                result.ReturnCode = HttpStatusCode.OK;
                result.ReturnData = new
                {
                    data = this
                };
                InsertKhoLuocSuAction ls = new InsertKhoLuocSuAction();
                ls.InsertKhoLuocSu(context, "KhoHangHoa", HangHoaId, "Update", NguoiTao);
                return(result);
            }
            catch (FormatException ex)
            {
                return(returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Exemplo n.º 9
0
        /*public string MaKhoHangHoa { get; set; }
         * public string TenKhoHangHoa { get; set; }
         * public string GhiChu { get; set; } */
        #endregion

        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                validate();

                var hanghoa = new Entity.MSSQL_QLDN_QLNS.Entity.KhoHangHoa();
                hanghoa.MaHangHoa       = MaHangHoa;
                hanghoa.TenHangHoa      = TenHangHoa;
                hanghoa.TuKhoa          = TuKhoa;
                hanghoa.DonViTinh       = DonViTinh;
                hanghoa.GiaMua          = GiaMua;
                hanghoa.GiaBan          = GiaBan;
                hanghoa.ThueMua         = ThueMua;
                hanghoa.ThueBan         = ThueBan;
                hanghoa.CauHinh         = CauHinh;
                hanghoa.Hinh            = Hinh;
                hanghoa.ThoiGianBaoHanh = ThoiGianBaoHanh;
                hanghoa.NhomHangHoaId   = NhomHangHoaId;
                hanghoa.LoaiHangHoaId   = LoaiHangHoaId;
                hanghoa.NhaCungCapId    = NhaCungCapId;
                hanghoa.HangSanXuatId   = HangSanXuatId;
                hanghoa.NuocSanXuatId   = NuocSanXuatId;
                hanghoa.MoTa            = MoTa;
                hanghoa.GhiChu          = GhiChu;
                hanghoa.NguoiTao        = NguoiTao;
                hanghoa.NgayTao         = DateTime.Now;
                hanghoa.XoaYN           = "N";
                KhoHangHoaRepository repo = new KhoHangHoaRepository(context);
                await repo.Insert(hanghoa);

                InsertKhoLuocSuAction ls = new InsertKhoLuocSuAction();
                ls.InsertKhoLuocSu(context, "KhoHangHoa", hanghoa.HangHoaId, "Insert", hanghoa.NguoiTao);
                return(returnActionResult(HttpStatusCode.OK, hanghoa, 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));
            }
        }
Exemplo n.º 10
0
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                dynamic result = new ActionResultDto();

                var repo = new KhoPhieuThuRepository(context);
                await repo.UpdatePartial(this,
                                         nameof(SoPhieu),
                                         nameof(KhachHangId),
                                         nameof(NgayThu),
                                         nameof(LyDo),
                                         nameof(SoTien),
                                         nameof(SoTienBangChu),
                                         nameof(HinhThucThanhToan),
                                         nameof(NganHang),
                                         nameof(TaiKhoanCo),
                                         nameof(TaiKhoanNo),
                                         nameof(Hinh),
                                         nameof(GhiChu),
                                         nameof(Hinh),
                                         nameof(NguoiNopTien)
                                         );

                result.ReturnCode = HttpStatusCode.OK;
                result.ReturnData = new
                {
                    data = this
                };
                InsertKhoLuocSuAction ls = new InsertKhoLuocSuAction();
                ls.InsertKhoLuocSu(context, "KhoPhieuThu", PhieuThuId, "Update", Protector.Int(NguoiTao));
                return(result);
            }
            catch (FormatException ex)
            {
                return(returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Exemplo n.º 11
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                validate();

                var KiemKe = new Entity.MSSQL_QLDN_QLNS.Entity.KhoKiemKe();
                KiemKe.TieuDe           = TieuDe;
                KiemKe.KhoHangId        = KhoHangId;
                KiemKe.Hinh             = Hinh;
                KiemKe.TrangThai        = TrangThai;
                KiemKe.NguoiTao         = NguoiTao;
                KiemKe.NgayTao          = NgayTao;
                KiemKe.XoaYN            = "N";
                KiemKe.CtrlVersion      = 1;
                KiemKe.TruongBanTen     = TruongBanTen;
                KiemKe.TruongBanChucVu  = TruongBanChucVu;
                KiemKe.TruongBanDaiDien = TruongBanDaiDien;
                KiemKe.UyVienTen        = UyVienTen;
                KiemKe.UyVienChucVu     = UyVienChucVu;
                KiemKe.UyVienDaiDien    = UyVienDaiDien;
                KiemKe.UyVienTen2       = UyVienTen2;
                KiemKe.UyVienChucVu2    = UyVienChucVu2;
                KiemKe.UyVienDaiDien2   = UyVienDaiDien2;

                KhoKiemKeRepository repo = new KhoKiemKeRepository(context);
                await repo.Insert(KiemKe);

                InsertKhoLuocSuAction ls = new InsertKhoLuocSuAction();
                ls.InsertKhoLuocSu(context, "KhoKiemKe", KiemKe.KiemKeId, "Insert", int.Parse(KiemKe.NguoiTao.ToString()));
                return(returnActionResult(HttpStatusCode.OK, KiemKe, 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));
            }
        }
Exemplo n.º 12
0
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                dynamic result = new ActionResultDto();

                var repo = new KhoKiemKeRepository(context);
                await repo.UpdatePartial(this,
                                         nameof(NgayTao),
                                         nameof(TieuDe),
                                         nameof(KhoHangId),
                                         nameof(Hinh),
                                         nameof(TruongBanTen),
                                         nameof(TruongBanChucVu),
                                         nameof(TruongBanDaiDien),
                                         nameof(UyVienTen),
                                         nameof(UyVienChucVu),
                                         nameof(UyVienDaiDien),
                                         nameof(UyVienTen2),
                                         nameof(UyVienChucVu2),
                                         nameof(UyVienDaiDien2),
                                         nameof(TrangThai));

                result.ReturnCode = HttpStatusCode.OK;
                result.ReturnData = new
                {
                    data = this
                };
                InsertKhoLuocSuAction ls = new InsertKhoLuocSuAction();
                ls.InsertKhoLuocSu(context, "KhoKiemKe", KiemKeId, "Update", int.Parse(NguoiTao.ToString()));
                return(result);
            }
            catch (FormatException ex)
            {
                return(returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                var _ids = new List <int>();
                foreach (var loai in _list)
                {
                    _ids.Add(loai.LoaiHangHoaId);
                }

                var biz = new UpdateXoaListKhoLoaiHangHoaBiz(context);

                biz.LOAI_HANG_HOA_IDS = String.Join("|", _ids);
                biz.LOGIN_ID          = _LoginId;

                var result = await biz.Execute();

                if (string.IsNullOrEmpty(biz.MESSAGE) == false)
                {
                    throw new BaseException(biz.MESSAGE.Split('|')[2]);
                }

                var ls = new InsertKhoLuocSuAction();
                ls.InsertKhoLuocSu(context, "LoaiHangHoa", 0, "Delete", _LoginId);

                dynamic metaData = new System.Dynamic.ExpandoObject();

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, result, metaData));
            }
            catch (BaseException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Exemplo n.º 14
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                validate();

                var PhieuThu = new Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuThu();
                PhieuThu.SoPhieu           = SoPhieu;
                PhieuThu.KhachHangId       = KhachHangId;
                PhieuThu.LyDo              = LyDo;
                PhieuThu.NgayThu           = NgayThu;
                PhieuThu.SoTien            = SoTien;
                PhieuThu.SoTienBangChu     = SoTienBangChu;
                PhieuThu.HinhThucThanhToan = HinhThucThanhToan;
                PhieuThu.NganHang          = NganHang;
                PhieuThu.TaiKhoanCo        = TaiKhoanCo;
                PhieuThu.TaiKhoanNo        = TaiKhoanNo;
                PhieuThu.Hinh              = Hinh;
                PhieuThu.GhiChu            = GhiChu;
                PhieuThu.Hinh              = Hinh;
                PhieuThu.NguoiNopTien      = NguoiNopTien;
                PhieuThu.NguoiTao          = NguoiTao;
                PhieuThu.NgayTao           = DateTime.Now;
                PhieuThu.XoaYN             = "N";
                PhieuThu.CtrVersion        = 1;
                KhoPhieuThuRepository repo = new KhoPhieuThuRepository(context);
                await repo.Insert(PhieuThu);

                InsertKhoLuocSuAction ls = new InsertKhoLuocSuAction();
                ls.InsertKhoLuocSu(context, "KhoPhieuThu", PhieuThu.PhieuThuId, "Insert", Protector.Int(NguoiTao));
                return(returnActionResult(HttpStatusCode.OK, PhieuThu, 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));
            }
        }
Exemplo n.º 15
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                var biz = new UpdateKhoPhieuXuatSauKhiLuuSoCaiBiz(context);
                biz.PHIEU_XUAT_ID = _PhieuXuat.PhieuXuatId;
                biz.KHO_XUAT      = Protector.String(_PhieuXuat.KhoXuat);
                biz.NGAY_XUAT     = _PhieuXuat.NgayXuat;
                biz.SO_PHIEU      = _PhieuXuat.SoPhieu;
                biz.CTRL_VERSION  = _PhieuXuat.CtrVersion;
                biz.CHI_TIET      = strListChiTiet();
                biz.LOGIN_ID      = _LoginId.ToString();
                var result = await biz.Execute();

                if (String.IsNullOrEmpty(biz.MESSAGE))
                {
                    var ls = new InsertKhoLuocSuAction();
                    ls.InsertKhoLuocSu(context, "KhoPhieuXuat", result.FirstOrDefault().PhieuXuatId, "Update", _LoginId);
                }
                else
                {
                    throw new BaseException(biz.MESSAGE.Split('|')[2]);
                }

                dynamic _metaData = new System.Dynamic.ExpandoObject();

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, result.FirstOrDefault(), _metaData));
            }
            catch (BaseException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
Exemplo n.º 16
0
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                var biz = new UpdateXoaListKhoPhieuXuatBiz(context);
                var ls  = new InsertKhoLuocSuAction();
                foreach (var item in _list)
                {
                    biz.PHIEU_XUAT_ID = item.KPX_ID;
                    biz.CTRVERSION    = Protector.Int(item.KPX_CTRVERSION, -1);
                    biz.XOA           = "Y";
                    var result = await biz.Execute();

                    if (string.IsNullOrEmpty(biz.MESSAGE) == false)
                    {
                        throw new BaseException(biz.MESSAGE.Split('|')[2]);
                    }

                    item.XoaYN = "Y";
                    ls.InsertKhoLuocSu(context, "KhoPhieuXuat", biz.PHIEU_XUAT_ID, "Delete", _LoginId);
                }

                dynamic metaData = new System.Dynamic.ExpandoObject();

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, _list, metaData));
            }
            catch (BaseException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                var biz = new UpdateXoaListKhoNhomHangHoaBiz(context);
                var ls  = new InsertKhoLuocSuAction();
                foreach (var loai in _list)
                {
                    biz.NHOMHANGHOA_IDS = loai.NhomHangHoaId.ToString();
                    biz.LOGIN_ID        = _LoginId;
                    var result = await biz.Execute();

                    if (string.IsNullOrEmpty(biz.MESSAGE) == false)
                    {
                        throw new BaseException(biz.MESSAGE.Split('|')[2]);
                    }

                    loai.XoaYN = "Y";
                    ls.InsertKhoLuocSu(context, "KhoNhomHangHoa", loai.NhomHangHoaId, "Delete", _LoginId);
                }

                dynamic metaData = new System.Dynamic.ExpandoObject();

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, _list, metaData));
            }
            catch (BaseException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Exemplo n.º 18
0
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                var biz = new UpdateXoaListKhoPhieuNhapBiz(context);
                var ls  = new InsertKhoLuocSuAction();
                foreach (var item in _list)
                {
                    biz.PHIEU_NHAP_ID = item.KPN_ID;
                    biz.CTRVERSION    = Protector.Int(item.KPN_CTRVERSION, -1);
                    biz.XOA           = "Y";
                    var result = await biz.Execute();

                    if (biz.RESULT != null && biz.RESULT.Value > 0)
                    {
                        item.XoaYN = "Y";
                        ls.InsertKhoLuocSu(context, "KhoPhieuNhap", biz.PHIEU_NHAP_ID, "Delete", _LoginId);
                    }
                }

                dynamic metaData = new System.Dynamic.ExpandoObject();

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, _list, metaData));
            }
            catch (BaseException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }