public async Task <ActionResultDto> Execute(ContextDto context) { try { init(); validate(); var count = 0; var repo = new KhoPhieuChiRepository(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) { 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)); } }
public async Task <dynamic> Execute(ContextDto context) { dynamic result = new System.Dynamic.ExpandoObject(); var repo = new KhoPhieuChiRepository(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 KhoPhieuChiRepository(context); await repo.UpdatePartial(this, nameof(SoPhieu), nameof(KhachHangId), nameof(NgayChi), nameof(LyDo), nameof(SoTien), nameof(SoTienBangChu), nameof(HinhThucThanhToan), nameof(NganHang), nameof(TaiKhoanCo), nameof(TaiKhoanNo), nameof(Hinh), nameof(GhiChu), nameof(Hinh), nameof(NguoiNhanTien) ); result.ReturnCode = HttpStatusCode.OK; result.ReturnData = new { data = this }; InsertKhoLuocSuAction ls = new InsertKhoLuocSuAction(); ls.InsertKhoLuocSu(context, "KhoPhieuChi", PhieuChiId, "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 <ActionResultDto> Execute(ContextDto context) { try { validate(); var PhieuChi = new Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuChi(); PhieuChi.SoPhieu = SoPhieu; PhieuChi.KhachHangId = KhachHangId; PhieuChi.LyDo = LyDo; PhieuChi.NgayChi = NgayChi; PhieuChi.SoTien = SoTien; PhieuChi.SoTienBangChu = SoTienBangChu; PhieuChi.HinhThucThanhToan = HinhThucThanhToan; PhieuChi.NganHang = NganHang; PhieuChi.TaiKhoanCo = TaiKhoanCo; PhieuChi.TaiKhoanNo = TaiKhoanNo; PhieuChi.Hinh = Hinh; PhieuChi.GhiChu = GhiChu; PhieuChi.Hinh = Hinh; PhieuChi.NguoiNhanTien = NguoiNhanTien; PhieuChi.NguoiTao = NguoiTao; PhieuChi.NgayTao = DateTime.Now; PhieuChi.XoaYN = "N"; PhieuChi.CtrVersion = 1; KhoPhieuChiRepository repo = new KhoPhieuChiRepository(context); await repo.Insert(PhieuChi); InsertKhoLuocSuAction ls = new InsertKhoLuocSuAction(); ls.InsertKhoLuocSu(context, "KhoPhieuChi", PhieuChi.PhieuChiId, "Insert", int.Parse(PhieuChi.NguoiTao.ToString())); return(returnActionResult(HttpStatusCode.OK, PhieuChi, 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)); } }