public async Task <dynamic> Execute(ContextDto context) { try { init(); validate(); var repo = new KhoPhieuThuRepository(context); if (_KhoPhieuThu != null) { var congviecEntity = new Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuThu(); congviecEntity.PhieuThuId = _KhoPhieuThu.PhieuThuId; congviecEntity.XoaYN = "Y"; congviecEntity.SoPhieu = ""; congviecEntity = await repo.UpdatePartial(congviecEntity, nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuThu.XoaYN), nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuThu.SoPhieu) ); InsertKhoLuocSuAction ls = new InsertKhoLuocSuAction(); ls.InsertKhoLuocSu(context, "KhoPhieuThu", congviecEntity.PhieuThuId, "Delete", 0); _KhoPhieuThu.XoaYN = congviecEntity.XoaYN; } else { if (_listKhoPhieuThu != null && _listKhoPhieuThu.Count > 0) { foreach (var congviecModel in _listKhoPhieuThu) { if (congviecModel.PhieuThuId > 0) { var congviecEntity = new Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuThu(); congviecEntity.PhieuThuId = congviecModel.PhieuThuId; congviecEntity.XoaYN = "Y"; congviecEntity.SoPhieu = null; congviecEntity = await repo.UpdatePartial(congviecEntity, nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuThu.XoaYN), nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuThu.SoPhieu) ); InsertKhoLuocSuAction ls = new InsertKhoLuocSuAction(); ls.InsertKhoLuocSu(context, "KhoPhieuThu", congviecEntity.PhieuThuId, "Delete", 0); congviecModel.XoaYN = congviecEntity.XoaYN; } } } } return(ActionHelper.returnActionResult(HttpStatusCode.OK, _listKhoPhieuThu, null)); } catch (FormatException ex) { return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message)); } catch (Exception ex) { return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.Message)); } }
public async Task <ActionResultDto> Execute(ContextDto context) { try { init(); validate(); var count = 0; var repo = new KhoPhieuThuRepository(context); for (int i = 0; i < _listId.Count; i++) { if (_listId[i] > 0 && await repo.Delete(_listId[i])) { count++; } } 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)); } }
public async Task <dynamic> Execute(ContextDto context) { dynamic result = new System.Dynamic.ExpandoObject(); var repo = new KhoPhieuThuRepository(context); await repo.Delete(Id); result.data = await repo.Delete(Id); return(result); }
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)); } }
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)); } }