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

                if (_list != null && _list.Count > 0)
                {
                    var biz = new UpdateXoaPhieuCongTacBiz(context);
                    biz.listPhieuCongTac = _list;

                    var result = await biz.Execute();
                }

                foreach (var item in _list)
                {
                    InsertLuocSuAction ls = new InsertLuocSuAction();
                    ls.InsertLuocSu(context, "PhieuCongTac", item.PhieuCongTacId, "Delete", _LoginId);
                }

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, _list, 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 <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                var biz = new UpdateXoaListChucVuBiz(context);
                biz.ChucVuId = getListIdString(_listChucVu);

                var result = (await biz.Execute()).ToList();

                InsertLuocSuAction ls = new InsertLuocSuAction();
                for (int i = 0; i < result.Count(); i++)
                {
                    if (result[i].XoaYN == "Y")
                    {
                        ls.InsertLuocSu(context, "ChucVu", result[i].ChucVuId, "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.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #3
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                var khenthuong = new Entity.MSSQL_QLDN_QLNS.Entity.KhenThuong();
                khenthuong.Ngay       = DateTime.ParseExact(ngay, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                khenthuong.Tien       = Protector.Int(Tien);
                khenthuong.BangChu    = BangChu;
                khenthuong.LyDo       = LyDo;
                khenthuong.HinhThuc   = Protector.Short(HinhThuc);
                khenthuong.VanBanSo   = Protector.Int(VanBanSo);
                khenthuong.NgayTao    = DateTime.Now;
                khenthuong.NguoiTao   = Protector.Int(NguoiTao);
                khenthuong.XoaYN      = "N";
                khenthuong.CtrVersion = 1;

                KhenThuongRepository repo = new KhenThuongRepository(context);
                await repo.Insert(khenthuong);

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "KhenThuong", khenthuong.KhenThuongId, "Insert", 0);
                return(returnActionResult(HttpStatusCode.OK, khenthuong, 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));
            }
        }
예제 #4
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();


                var biz = new InsertPhieuCongTacBiz(context);
                biz.NoiDung      = NoiDung;
                biz.NgayDi       = _NgayDi.Value;
                biz.NgayVe       = _NgayVe.Value;
                biz.nhanVienId   = _NhanVienId;
                biz.NguoiDuyetId = _NguoiDuyetId;
                biz.SoNgay       = _SoNgay;
                biz.NguoiTao     = _LoginId;

                var result = await biz.Execute();

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "PhieuCongTac", result.PhieuCongTacId, "Insert", _LoginId);

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, result, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #5
0
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                dynamic result = new System.Dynamic.ExpandoObject();
                var     repo   = new KhenThuongRepository(context);
                await repo.UpdatePartial(this,
                                         nameof(Ngay),
                                         nameof(Tien),
                                         nameof(BangChu),
                                         nameof(LyDo),
                                         nameof(HinhThuc),
                                         nameof(VanBanSo)
                                         );

                result.data = this;
                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "KhenThuong", KhenThuongId, "Update", NguoiTao);
                return(returnActionResult(this, null));
            }
            catch (FormatException ex)
            {
                return(returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
예제 #6
0
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();


                var biz = new DeleteKhoHangSanXuatBiz(context);

                biz.HANG_SAN_XUAT_ID = _HangSanXuatId;

                var result = await biz.Execute();

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "KhoHangSanXuat", _HangSanXuatId, "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));
            }
        }
예제 #7
0
        /// <summary>
        /// Ham xu ly chinh, chi nhan 1 bien moi truong
        /// </summary>
        /// <param name="context">Bien moi truong</param>
        /// <returns></returns>
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                Init();
                Validate();

                var repo = new BangLuongRepository(context);

                var entity = new Entity.MSSQL_QLDN_QLNS.Entity.BangLuong();
                entity.BangLuongId = this.BangLuongId;

                entity.MaTrangThai = this.MaTrangThai;

                entity.CtrVersion = _CtrVersion;
                entity            = await repo.UpdatePartial(entity,
                                                             nameof(Entity.MSSQL_QLDN_QLNS.Entity.BangLuong.MaTrangThai),
                                                             nameof(Entity.MSSQL_QLDN_QLNS.Entity.BangLuong.CtrVersion)
                                                             );

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "BangLuong", _Id, "Update", entity.NguoiTao);

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, entity, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #8
0
        /// <summary>
        /// Ham xu ly chinh, chi nhan 1 bien moi truong
        /// </summary>
        /// <param name="context">Bien moi truong</param>
        /// <returns></returns>
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                Init();
                Validate();

                var count = 0;

                var repo = new NghiPhepRepository(context);

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

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, count, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #9
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));
            }
        }
예제 #10
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                var duan = new Entity.MSSQL_QLDN_QLNS.Entity.DuAn();
                duan.TenDuAn     = TenDuAn;
                duan.MoTa        = MoTa;
                duan.MaTrangThai = MaTrangThai;
                duan.PhongBan    = Protector.Int(PhongBan);
                duan.QuanLy      = Protector.Int(QuanLy);
                if (NgayBatDau != "" && NgayBatDau != null)
                {
                    duan.NgayBatDau = DateTime.ParseExact(NgayBatDau, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                }
                if (NgayThatSuBatDau != null && NgayThatSuBatDau != "")
                {
                    duan.NgayThatSuBatDau = DateTime.ParseExact(NgayThatSuBatDau, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                }
                if (NgayKetThuc != null && NgayKetThuc != "")
                {
                    duan.NgayKetThuc = DateTime.ParseExact(NgayKetThuc, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                }
                if (NgayThatSuKetThuc != null && NgayThatSuKetThuc != "")
                {
                    duan.NgayThatSuKetThuc = DateTime.ParseExact(NgayThatSuKetThuc, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                }
                duan.NguoiTao   = Protector.Int(NguoiTao);
                duan.NgayTao    = DateTime.Now;
                duan.XoaYN      = "N";
                duan.CtrVersion = 1;
                DuAnRepository repo = new DuAnRepository(context);
                await repo.Insert(duan);

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "DuAn", duan.DuAnId, "Insert", duan.NguoiTao);
                if (NhanVien != "" && NhanVien != null)
                {
                    var nvda  = new Entity.MSSQL_QLDN_QLNS.Entity.NhanVienDuAn();
                    var nvids = NhanVien.Split('|');
                    foreach (var nv in nvids)
                    {
                        nvda.DuAnId     = duan.DuAnId;
                        nvda.XoaYN      = "N";
                        nvda.NhanVienId = Protector.Int(nv);
                        await repo.InsertNV(nvda);
                    }
                }
                return(returnActionResult(HttpStatusCode.OK, duan, 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));
            }
        }
예제 #11
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                var congviec = new Entity.MSSQL_QLDN_QLNS.Entity.CongViec();
                congviec.DuAnId = Protector.Int(DuAnId);
                congviec.TieuDe = TieuDe;
                congviec.MoTa   = MoTa;
                if (NgayBatDau != "" && NgayBatDau != null)
                {
                    congviec.NgayBatDau = DateTime.ParseExact(NgayBatDau, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                }
                if (NgayThatSuBatDau != null && NgayThatSuBatDau != "")
                {
                    congviec.NgayThatSuBatDau = DateTime.ParseExact(NgayThatSuBatDau, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                }
                if (NgayKetThuc != null && NgayKetThuc != "")
                {
                    congviec.NgayKetThuc = DateTime.ParseExact(NgayKetThuc, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                }
                if (NgayThatSuKetThuc != null && NgayThatSuKetThuc != "")
                {
                    congviec.NgayThatSuKetThuc = DateTime.ParseExact(NgayThatSuKetThuc, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                }
                congviec.SoNgay           = Protector.Decimal(SoNgay);
                congviec.TienDo           = Protector.Int(TienDo);
                congviec.NoiDungCongViec  = NoiDungCongViec;
                congviec.ThuanLoiKhoKhan  = ThuanLoiKhoKhan;
                congviec.GiaiPhapKienNghi = GiaiPhapKienNghi;
                congviec.MaTrangThai      = MaTrangThai;
                congviec.NguoiXuLy        = Protector.Int(NguoiXuLy);
                congviec.NguoiTao         = Protector.Int(NguoiTao);
                congviec.GhiChu           = GhiChu;
                congviec.XoaYN            = "N";
                congviec.CtrVersion       = 1;
                CongViecRepository repo = new CongViecRepository(context);
                await repo.Insert(congviec);

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "CongViec", congviec.CongViecId, "Insert", congviec.NguoiTao);

                return(returnActionResult(HttpStatusCode.OK, congviec, 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));
            }
        }
예제 #12
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                /*
                 * var orderClause = sortName + " " + sortDir;
                 * var total = 0;
                 */
                var biz = new UpdateChucVuBiz(context);
                biz.ChucVuId   = _ChucVuId;
                biz.LoginId    = _LoginId;
                biz.MaChucVu   = MaChucVu;
                biz.TenChucVu  = TenChucVu;
                biz.GhiChu     = GhiChu;
                biz.CtrVersion = CtrVersion;

                var result = await biz.Execute();

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "ChucVu", _ChucVuId, "Update", _LoginId);

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, result, null));

                /*
                 * IEnumerable<dynamic> list = await biz.Execute();
                 *
                 * if (list.Count() > 0)
                 * {
                 *  var obj = list.FirstOrDefault();
                 *
                 *  total = Protector.Int(obj.MAXCNT);
                 * }
                 *
                 * dynamic _metaData = new System.Dynamic.ExpandoObject();
                 * _metaData.draw = _draw;
                 * _metaData.total = total;
                 * return ActionHelper.returnActionResult(HttpStatusCode.OK, list, _metaData);
                 */
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #13
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                var issuae = new Entity.MSSQL_QLDN_QLNS.Entity.Issue();
                issuae.KhachHangId = Protector.Int(KhachHangId);
                if (NgayTao != null)
                {
                    issuae.NgayTao = DateTime.ParseExact(NgayTao, "dd/MM/yyyy HH:mm", CultureInfo.GetCultureInfo("fr-FR"));
                }
                issuae.NguoiLienHe = NguoiLienHe;
                issuae.DienThoai   = DienThoai;
                issuae.DiDong      = DiDong;
                issuae.Email       = Email;
                issuae.TieuDe      = TieuDe;
                issuae.MoTa        = MoTa;
                issuae.LoaiIssue   = Protector.Short(LoaiIssue);
                if (NgayDeNghi != null)
                {
                    issuae.NgayDeNghi = DateTime.ParseExact(NgayDeNghi, "dd/MM/yyyy HH:mm", CultureInfo.GetCultureInfo("fr-FR"));
                }
                issuae.NguoiXuLy   = Protector.Int(NguoiXuLy);
                issuae.CachXuLy    = CachXuLy;
                issuae.HuongXuLy   = HuongXuly;
                issuae.MaTrangThai = MaTrangThai;
                if (MaTrangThai == "3")
                {
                    issuae.NgayKetThuc = DateTime.Now;
                }
                issuae.NgayTao    = DateTime.Now;
                issuae.NguoiTao   = Protector.Int(NguoiTao);
                issuae.XoaYn      = "N";
                issuae.CtrVersion = 1;

                IssueRepository repo = new IssueRepository(context);
                await repo.Insert(issuae);

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "Issue", issuae.IssueId, "Insert", issuae.NguoiTao);
                return(returnActionResult(HttpStatusCode.OK, issuae, 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));
            }
        }
예제 #14
0
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                dynamic result = new System.Dynamic.ExpandoObject();
                var     repo   = new DuAnRepository(context);
                await repo.UpdatePartial(this,
                                         nameof(TenDuAn),
                                         nameof(MoTa),
                                         nameof(MaTrangThai),
                                         nameof(PhongBan),
                                         nameof(QuanLy),
                                         nameof(NgayBatDau),
                                         nameof(NgayThatSuBatDau),
                                         nameof(NgayKetThuc),
                                         nameof(CtrVersion),
                                         nameof(NgayThatSuKetThuc)
                                         );

                result.data = this;
                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "DuAn", DuAnId, "Update", NguoiTao);
                Data.QLNS.DuAn.DeleteOneNhanVienDuAnDac dac = new Data.QLNS.DuAn.DeleteOneNhanVienDuAnDac(context);
                dac.DuAnId = DuAnId.ToString();
                await dac.Execute();

                if (NhanVien != null && NhanVien != "")
                {
                    var nvda  = new Entity.MSSQL_QLDN_QLNS.Entity.NhanVienDuAn();
                    var nvids = NhanVien.Split('|');
                    foreach (var nv in nvids)
                    {
                        nvda.DuAnId     = DuAnId;
                        nvda.XoaYN      = "N";
                        nvda.NhanVienId = Protector.Int(nv);
                        await repo.InsertNV(nvda);
                    }
                }
                return(returnActionResult(this, null));
            }
            catch (FormatException ex)
            {
                return(returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
        /// <summary>
        /// Ham xu ly chinh, chi nhan 1 bien moi truong
        /// </summary>
        /// <param name="context">Bien moi truong</param>
        /// <returns></returns>
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                Init();
                Validate();

                var repo = new KhoXuatNhapTonTheoKyRepository(context);

                var entity = new Entity.MSSQL_QLDN_QLNS.Entity.KhoBaoCaoTheoKy();
                entity.KyId        = this.KyId;
                entity.KyTruoc     = this.KyTruoc;
                entity.Ten         = this.Ten;
                entity.ThangNam    = this.ThangNam;
                entity.LoaiBaoCao  = this.LoaiBaoCao;
                entity.NgayBatDau  = this.NgayBatDau;
                entity.NgayKetThuc = this.NgayKetThuc;
                entity.KhoHangId   = this.KhoHangId;
                entity.GhiChu      = this.GhiChu;
                entity.NguoiTao    = this.NguoiTao;
                entity.MaTrangThai = this.MaTrangThai;

                entity = await repo.UpdatePartial(entity,
                                                  nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoBaoCaoTheoKy.KyTruoc),
                                                  nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoBaoCaoTheoKy.Ten),
                                                  nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoBaoCaoTheoKy.ThangNam),
                                                  nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoBaoCaoTheoKy.LoaiBaoCao),
                                                  nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoBaoCaoTheoKy.NgayBatDau),
                                                  nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoBaoCaoTheoKy.NgayKetThuc),
                                                  nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoBaoCaoTheoKy.KhoHangId),
                                                  nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoBaoCaoTheoKy.GhiChu),
                                                  nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoBaoCaoTheoKy.NguoiTao),
                                                  nameof(Entity.MSSQL_QLDN_QLNS.Entity.KhoBaoCaoTheoKy.MaTrangThai)
                                                  );

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "KhoXuatNhapTonTheoKy", _Id, "Update", entity.NguoiTao);

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, entity, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #16
0
        /// <summary>
        /// Ham xu ly chinh, chi nhan 1 bien moi truong
        /// </summary>
        /// <param name="context">Bien moi truong</param>
        /// <returns></returns>
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                Init();
                Validate();

                var repo = new NghiPhepRepository(context);

                var nghiphep = new Entity.MSSQL_QLDN_QLNS.Entity.NghiPhep();
                nghiphep.NghiPhepId     = _nghiphepId;
                nghiphep.TuNgay         = this.TuNgay == null ? DateTime.Today : this.TuNgay;
                nghiphep.DenNgay        = this.DenNgay == null ? DateTime.Today : this.DenNgay;
                nghiphep.SoNgay         = this.SoNgay == 0 ? 1 : this.SoNgay;
                nghiphep.LoaiNgay       = this.LoaiNgay;
                nghiphep.MaLoaiNghiPhep = this.MaLoaiNghiPhep;
                nghiphep.TieuDe         = this.TieuDe == null ? "" : this.TieuDe;
                nghiphep.LyDo           = this.LyDo;
                nghiphep.NguoiBanGiao   = this.NguoiBanGiao;
                nghiphep.NhanVienId     = this.NhanVienId;
                nghiphep.CtrVersion     = _CtrVersion;
                nghiphep = await repo.UpdatePartial(nghiphep,
                                                    nameof(Entity.MSSQL_QLDN_QLNS.Entity.NghiPhep.TuNgay),
                                                    nameof(Entity.MSSQL_QLDN_QLNS.Entity.NghiPhep.DenNgay),
                                                    nameof(Entity.MSSQL_QLDN_QLNS.Entity.NghiPhep.SoNgay),
                                                    nameof(Entity.MSSQL_QLDN_QLNS.Entity.NghiPhep.LoaiNgay),
                                                    nameof(Entity.MSSQL_QLDN_QLNS.Entity.NghiPhep.MaLoaiNghiPhep),
                                                    nameof(Entity.MSSQL_QLDN_QLNS.Entity.NghiPhep.TieuDe),
                                                    nameof(Entity.MSSQL_QLDN_QLNS.Entity.NghiPhep.LyDo),
                                                    nameof(Entity.MSSQL_QLDN_QLNS.Entity.NghiPhep.NguoiBanGiao),
                                                    nameof(Entity.MSSQL_QLDN_QLNS.Entity.NghiPhep.NhanVienId),
                                                    nameof(Entity.MSSQL_QLDN_QLNS.Entity.NghiPhep.CtrVersion)
                                                    );

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "NghiPhep", _nghiphepId, "Update", NhanVienId);

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, nghiphep, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #17
0
        /// <summary>
        /// Ham xu ly chinh, chi nhan 1 bien moi truong
        /// </summary>
        /// <param name="context">Bien moi truong</param>
        /// <returns></returns>
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                Init();
                Validate();

                var repo = new TangCaRepository(context);

                var entity = new Entity.MSSQL_QLDN_QLNS.Entity.TangCa();
                entity.TangCaId    = this.TangCaId;
                entity.NgayTangCa  = this.NgayTangCa;
                entity.GioBatDau   = this.GioBatDau;
                entity.GioKetThuc  = this.GioKetThuc;
                entity.SoGio       = this.SoGio == 0 ? 1 : this.SoGio;
                entity.Loai        = this.Loai;
                entity.TieuDe      = this.TieuDe == null ? "" : this.TieuDe;
                entity.LyDo        = this.LyDo;
                entity.NhanVienId  = this.NhanVienId;
                entity.MaTrangThai = this.MaTrangThai;
                entity.CtrVersion  = _CtrVersion;
                entity             = await repo.UpdatePartial(entity,
                                                              nameof(Entity.MSSQL_QLDN_QLNS.Entity.TangCa.NgayTangCa),
                                                              nameof(Entity.MSSQL_QLDN_QLNS.Entity.TangCa.GioBatDau),
                                                              nameof(Entity.MSSQL_QLDN_QLNS.Entity.TangCa.GioKetThuc),
                                                              nameof(Entity.MSSQL_QLDN_QLNS.Entity.TangCa.SoGio),
                                                              nameof(Entity.MSSQL_QLDN_QLNS.Entity.TangCa.Loai),
                                                              nameof(Entity.MSSQL_QLDN_QLNS.Entity.TangCa.TieuDe),
                                                              nameof(Entity.MSSQL_QLDN_QLNS.Entity.TangCa.LyDo),
                                                              nameof(Entity.MSSQL_QLDN_QLNS.Entity.TangCa.NhanVienId),
                                                              nameof(Entity.MSSQL_QLDN_QLNS.Entity.TangCa.MaTrangThai),
                                                              nameof(Entity.MSSQL_QLDN_QLNS.Entity.TangCa.CtrVersion)
                                                              );

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "TangCa", _Id, "Update", NguoiTao);

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, entity, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #18
0
        /// <summary>
        /// Ham xu ly chinh, chi nhan 1 bien moi truong
        /// </summary>
        /// <param name="context">Bien moi truong</param>
        /// <returns></returns>
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                Init();
                Validate();

                var repo = new NghiPhepRepository(context);

                var nghiphep = new Entity.MSSQL_QLDN_QLNS.Entity.NghiPhep();
                nghiphep.TuNgay         = this.TuNgay;
                nghiphep.DenNgay        = this.DenNgay;
                nghiphep.SoNgay         = this.SoNgay;
                nghiphep.LoaiNgay       = this.LoaiNgay;
                nghiphep.TieuDe         = this.TieuDe == null? "" : this.TieuDe;
                nghiphep.LyDo           = this.LyDo;
                nghiphep.NguoiBanGiao   = this.NguoiBanGiao;
                nghiphep.NhanVienId     = this.NhanVienId;
                nghiphep.NguoiTao       = this.NguoiTao == 0 ? 1 :  this.NguoiTao;
                nghiphep.NgayTao        = DateTime.Now;
                nghiphep.MaTrangThai    = this.MaTrangThai;
                nghiphep.MaLoaiNghiPhep = this.MaLoaiNghiPhep;
                nghiphep.XoaYN          = "N";
                nghiphep.CtrVersion     = 1;

                await repo.Insert(nghiphep);

                if (nghiphep.NghiPhepId == 0)
                {
                    return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, "Không thể thêm Nghỉ phép."));
                }

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "NghiPhep", nghiphep.NghiPhepId, "Insert", NguoiTao);

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, nghiphep, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #19
0
        /// <summary>
        /// Ham xu ly chinh, chi nhan 1 bien moi truong
        /// </summary>
        /// <param name="context">Bien moi truong</param>
        /// <returns></returns>
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                Init();
                Validate();

                var repo = new TangCaRepository(context);

                var entity = new Entity.MSSQL_QLDN_QLNS.Entity.TangCa();
                entity.NgayTangCa  = this.NgayTangCa;
                entity.GioBatDau   = this.GioBatDau;
                entity.GioKetThuc  = this.GioKetThuc;
                entity.SoGio       = this.SoGio;
                entity.Loai        = this.Loai;
                entity.TieuDe      = this.TieuDe == null? "" : this.TieuDe;
                entity.LyDo        = this.LyDo;
                entity.NhanVienId  = this.NhanVienId;
                entity.NguoiTao    = this.NguoiTao == 0 ? 1 :  this.NguoiTao;
                entity.NgayTao     = DateTime.Now;
                entity.MaTrangThai = this.MaTrangThai;
                entity.XoaYN       = "N";
                entity.CtrVersion  = 1;

                await repo.Insert(entity);

                if (entity.TangCaId == 0)
                {
                    return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, "Không thể thêm mới."));
                }

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "TangCa", entity.TangCaId, "Insert", NguoiTao);

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, entity, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #20
0
        /// <summary>
        /// Ham xu ly chinh, chi nhan 1 bien moi truong
        /// </summary>
        /// <param name="context">Bien moi truong</param>
        /// <returns></returns>
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                Init();
                Validate();

                var repo = new KhoXuatNhapTonTheoKyRepository(context);

                var entity = new Entity.MSSQL_QLDN_QLNS.Entity.KhoBaoCaoTheoKy();
                entity.KyTruoc     = this.KyTruoc;
                entity.Ten         = this.Ten;
                entity.ThangNam    = this.ThangNam;
                entity.KhoHangId   = this.KhoHangId;
                entity.NgayBatDau  = this.NgayBatDau;
                entity.NgayKetThuc = this.NgayKetThuc;
                entity.LoaiBaoCao  = this.LoaiBaoCao;
                entity.GhiChu      = this.GhiChu;
                entity.NgayTao     = DateTime.Now;
                entity.XoaYN       = "N";
                entity.CtrlVersion = 1;
                entity.NguoiTao    = this.NguoiTao;
                entity.MaTrangThai = this.MaTrangThai;

                await repo.Insert(entity);

                if (entity.KyId == 0)
                {
                    return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, "Không thể thêm mới."));
                }

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "KhoBaoCaoTheoKy", entity.KyId, "Insert", entity.NguoiTao);

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, entity, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #21
0
        /// <summary>
        /// Ham xu ly chinh, chi nhan 1 bien moi truong
        /// </summary>
        /// <param name="context">Bien moi truong</param>
        /// <returns></returns>
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                Init();
                Validate();

                var repo = new BangLuongRepository(context);

                var entity = new Entity.MSSQL_QLDN_QLNS.Entity.BangLuong();
                entity.TenBangLuong    = this.TenBangLuong;
                entity.ThangNam        = this.ThangNam;
                entity.TanSuatTraLuong = this.TanSuatTraLuong;
                entity.NgayBatDau      = this.NgayBatDau;
                entity.NgayKetThuc     = this.NgayKetThuc;
                entity.NgayTraLuong    = this.NgayTraLuong;
                entity.SoNgay          = this.SoNgay;
                entity.SoNguoi         = this.SoNguoi;
                entity.MaTrangThai     = this.MaTrangThai;
                entity.NguoiTao        = this.NguoiTao;
                entity.NgayTao         = DateTime.Now;
                entity.XoaYN           = "N";
                entity.CtrVersion      = 1;

                await repo.Insert(entity);

                if (entity.BangLuongId == 0)
                {
                    return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, "Không thể thêm mới."));
                }

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "BangLuong", entity.BangLuongId, "Insert", entity.NguoiTao);

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, entity, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #22
0
        public async Task <dynamic> Execute(ContextDto context)
        {
            try
            {
                if (MaTrangThai == "3")
                {
                    NgayKetThuc = DateTime.Now;
                }
                dynamic result = new System.Dynamic.ExpandoObject();
                var     repo   = new IssueRepository(context);
                await repo.UpdatePartial(this,
                                         nameof(KhachHangId),
                                         nameof(NguoiLienHe),
                                         nameof(DienThoai),
                                         nameof(DiDong),
                                         nameof(Email),
                                         nameof(TieuDe),
                                         nameof(MoTa),
                                         nameof(LoaiIssue),
                                         nameof(NgayDeNghi),
                                         nameof(NgayKetThuc),
                                         nameof(NguoiXuLy),
                                         nameof(CachXuLy),
                                         nameof(HuongXuLy),
                                         nameof(DanhGiaId),
                                         nameof(MaTrangThai)
                                         );

                result.data = this;
                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "Issue", IssueId, "Update", NguoiTao);
                return(returnActionResult(this, null));
            }
            catch (FormatException ex)
            {
                return(returnActionError(HttpStatusCode.BadRequest, ex.Message));
            }
            catch (Exception ex)
            {
                return(returnActionError(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
예제 #23
0
        /// <summary>
        /// Ham xu ly chinh, chi nhan 1 bien moi truong
        /// </summary>
        /// <param name="context">Bien moi truong</param>
        /// <returns></returns>
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                Init();
                Validate();

                var repo = new LoaiNghiPhepRepository(context);

                var loainghiphep = new Entity.MSSQL_QLDN_QLNS.Entity.LoaiNghiPhep();

                loainghiphep.NguoiTao = this.NguoiTao == 0 ? 1 : this.NguoiTao;
                loainghiphep.NgayTao  = DateTime.Now;

                loainghiphep.MaLoaiNghiPhep = this.MaLoaiNghiPhep;
                loainghiphep.TenLoaiPhep    = this.TenLoaiPhep;
                loainghiphep.SoNgay         = this.SoNgay;
                loainghiphep.GhiChu         = this.GhiChu;
                loainghiphep.XoaYN          = "N";
                loainghiphep.CtrVersion     = 1;

                await repo.Insert(loainghiphep);

                if (loainghiphep.LoaiNghiPhepId == 0)
                {
                    return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, "Không thể thêm Nghỉ phép."));
                }

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "LoaiNghiPhep", loainghiphep.LoaiNghiPhepId, "Insert", loainghiphep.NguoiTao);

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, loainghiphep, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #24
0
        /// <summary>
        /// Ham xu ly chinh, chi nhan 1 bien moi truong
        /// </summary>
        /// <param name="context">Bien moi truong</param>
        /// <returns></returns>
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                Init();
                Validate();

                var repo = new LoaiNghiPhepRepository(context);

                var loainghiphep = new Entity.MSSQL_QLDN_QLNS.Entity.LoaiNghiPhep();
                loainghiphep.LoaiNghiPhepId = _loainghiphepId;

                loainghiphep.MaLoaiNghiPhep = this.MaLoaiNghiPhep;
                loainghiphep.TenLoaiPhep    = this.TenLoaiPhep;
                loainghiphep.SoNgay         = this.SoNgay;
                loainghiphep.GhiChu         = this.GhiChu;
                loainghiphep.CtrVersion     = _CtrVersion;

                loainghiphep = await repo.UpdatePartial(loainghiphep,
                                                        nameof(Entity.MSSQL_QLDN_QLNS.Entity.LoaiNghiPhep.MaLoaiNghiPhep),
                                                        nameof(Entity.MSSQL_QLDN_QLNS.Entity.LoaiNghiPhep.TenLoaiPhep),
                                                        nameof(Entity.MSSQL_QLDN_QLNS.Entity.LoaiNghiPhep.SoNgay),
                                                        nameof(Entity.MSSQL_QLDN_QLNS.Entity.LoaiNghiPhep.GhiChu),
                                                        nameof(Entity.MSSQL_QLDN_QLNS.Entity.LoaiNghiPhep.LoaiNghiPhepId),
                                                        nameof(Entity.MSSQL_QLDN_QLNS.Entity.LoaiNghiPhep.CtrVersion)
                                                        );

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "LoaiNghiPhep", _loainghiphepId, "Update", NguoiTao);

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, loainghiphep, null));
            }
            catch (FormatException ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.BadRequest, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
            catch (Exception ex)
            {
                return(ActionHelper.returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #25
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                var khachhang = new Entity.MSSQL_QLDN_QLNS.Entity.KhoKhachHang();
                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.GhiChu         = GhiChu;
                khachhang.MaSoThue       = MaSoThue;
                khachhang.NgayTao        = DateTime.Now;
                khachhang.NguoiTao       = 1;
                khachhang.XoaYN          = "N";
                khachhang.CtrVersion     = 1;

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

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "KhoKhachHang", 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));
            }
        }
예제 #26
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();

                var biz = new UpdateBaoHiemXaHoiBiz(context);
                biz.NhanVienId     = NhanVienId;
                biz.BaoHiemXaHoiId = BaoHiemXaHoiId;
                biz.Ngay           = Ngay;
                biz.SoBHXH         = SoBHXH;
                biz.SoBHYT         = SoBHYT;
                biz.BHXH           = BHXH;
                biz.BHYT           = BHYT;
                biz.BHTN           = BHTN;
                biz.CongDoan       = CongDoan;
                biz.CtrVersion     = CtrVersion;
                biz.XoaYN          = "N";

                var obj = await biz.Execute();

                InsertLuocSuAction ls = new InsertLuocSuAction();
                ls.InsertLuocSu(context, "BaoHiemXaHoi", NhanVienId, "Update", _loginId);

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

                return(ActionHelper.returnActionResult(HttpStatusCode.OK, obj, _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));
            }
        }
예제 #27
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));
            }
        }
예제 #28
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                init();
                validate();


                var biz = new InsertChucVuBiz(context);
                biz.ChucVuId  = 0;
                biz.MaChucVu  = MaChucVu;
                biz.TenChucVu = TenChucVu;
                biz.GhiChu    = GhiChu;
                biz.LoginId   = _LoginId;

                var list = await biz.Execute();

                if (list.Count() > 0)
                {
                    var obj = list.FirstOrDefault();

                    InsertLuocSuAction ls = new InsertLuocSuAction();
                    ls.InsertLuocSu(context, "ChucVu", obj.ChucVuId, "Insert", _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.InnerException != null ? ex.InnerException.Message : ex.Message));
            }
        }
예제 #29
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                var tamung = new Entity.MSSQL_QLDN_QLNS.Entity.TamUng();
                foreach (var nhanvienid in NhanVienIds.Split('|'))
                {
                    tamung.NhanVienId  = Protector.Int(nhanvienid);
                    tamung.So          = So;
                    tamung.Ngay        = DateTime.ParseExact(Ngay, "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR"));
                    tamung.Tien        = Protector.Int(Tien);
                    tamung.BangChu     = BangChu;
                    tamung.LyDo        = LyDo;
                    tamung.NguoiTao    = Protector.Int(NguoiTao);
                    tamung.NgayTao     = DateTime.Now;
                    tamung.MaTrangThai = "TU_DD";
                    tamung.XoaYN       = "N";
                    tamung.CtrVersion  = 1;

                    TamUngRepository repo = new TamUngRepository(context);
                    await repo.Insert(tamung);

                    InsertLuocSuAction ls = new InsertLuocSuAction();
                    ls.InsertLuocSu(context, "TamUng", tamung.TamUngId, "Insert", tamung.NguoiTao);
                }
                return(returnActionResult(HttpStatusCode.OK, tamung, 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));
            }
        }