예제 #1
0
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();
                var repo = new CongViecRepository(context);
                if (_CongViec != null)
                {
                    var congviecEntity = new Entity.MSSQL_QLDN_QLNS.Entity.CongViec();
                    congviecEntity.CongViecId = _CongViec.CongViecId;
                    congviecEntity.CtrVersion = _CongViec.CtrVersion;

                    congviecEntity.XoaYN = "Y";

                    congviecEntity = await repo.UpdatePartial(congviecEntity,
                                                              nameof(Entity.MSSQL_QLDN_QLNS.Entity.CongViec.XoaYN)
                                                              );

                    _CongViec.XoaYN = congviecEntity.XoaYN;
                }
                else
                {
                    if (_listCongViec != null && _listCongViec.Count > 0)
                    {
                        foreach (var congviecModel in _listCongViec)
                        {
                            if (congviecModel.CongViecId > 0)
                            {
                                var congviecEntity = new Entity.MSSQL_QLDN_QLNS.Entity.CongViec();
                                congviecEntity.CongViecId = congviecModel.CongViecId;
                                congviecEntity.CtrVersion = congviecModel.CtrVersion;

                                congviecEntity.XoaYN = "Y";

                                congviecEntity = await repo.UpdatePartial(congviecEntity,
                                                                          nameof(Entity.MSSQL_QLDN_QLNS.Entity.CongViec.XoaYN)
                                                                          );

                                congviecModel.XoaYN = congviecEntity.XoaYN;
                            }
                        }
                    }
                }

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, _listCongViec, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
예제 #2
0
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                dynamic result = new System.Dynamic.ExpandoObject();
                var     repo   = new CongViecRepository(context);
                await repo.UpdatePartial(this,
                                         nameof(DuAnId),
                                         nameof(TieuDe),
                                         nameof(MoTa),
                                         nameof(NgayBatDau),
                                         nameof(NgayKetThuc),
                                         nameof(NgayThatSuBatDau),
                                         nameof(NgayThatSuKetThuc),
                                         nameof(SoNgay),
                                         nameof(TienDo),
                                         nameof(NoiDungCongViec),
                                         nameof(ThuanLoiKhoKhan),
                                         nameof(GiaiPhapKienNghi),
                                         nameof(MaTrangThai),
                                         nameof(NguoiXuLy)
                                         );

                result.data = this;
                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "CongViec", CongViecId, "Update", NguoiTao);
                return(returnActionResult(this, null));
            }
            catch (FormatException ex)
            {
                return(returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }