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)); } }
/// <summary> /// Ham khoi tao gia tri mac dinh cho cac bien /// </summary> private void init() { _PhieuCongTacId = Protector.Int(PhieuCongTacId, 0); _Ngay = Protector.DateTime(Ngay, "yyyyMMdd", true); NoiDung = Protector.String(NoiDung, ""); _SoLuong = Protector.Short(SoLuong, 0); _DonGia = Protector.Int(DonGia, 0); GhiChu = Protector.String(GhiChu, ""); }
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)); } }
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)); } }