Ejemplo n.º 1
0
        public async Task <ActionResultDto> Execute(ContextDto context)
        {
            try
            {
                var khenthuong = new Entity.MSSQL_QLDN_QLNS.Entity.KhenThuongCaNhan();
                foreach (var nhanvienid in NhanVienIds.Split('|'))
                {
                    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.NhanVienId = Protector.Int(nhanvienid);
                    khenthuong.NgayTao    = DateTime.Now;
                    khenthuong.NguoiTao   = Protector.Int(NguoiTao);
                    khenthuong.XoaYN      = "N";
                    khenthuong.CtrVersion = 1;

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

                    InsertLuocSuAction ls = new InsertLuocSuAction();
                    ls.InsertLuocSu(context, "KhenThuongCaNhan", khenthuong.KhenThuongCaNhanId, "Insert", khenthuong.NguoiTao);
                }
                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));
            }
        }
Ejemplo n.º 2
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));
            }
        }