public async Task <ActionResultDto> Execute(ContextDto context) { try { init(); validate(); var orderClause = sortName + " " + sortDir; var total = 0; var biz = new GetListKhoKyPopupByCriteriaBiz(context); biz.FIELD = fields; biz.SEARCH_STRING = search; biz.ORDER_CLAUSE = orderClause; biz.SKIP = _start; biz.TAKE = _length; var 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 (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)); } }
public async Task <dynamic> Execute(ContextDto context) { try { dynamic result = new ActionResultDto(); var repo = new KhoPhieuThuRepository(context); await repo.UpdatePartial(this, nameof(SoPhieu), nameof(KhachHangId), nameof(NgayThu), nameof(LyDo), nameof(SoTien), nameof(SoTienBangChu), nameof(HinhThucThanhToan), nameof(NganHang), nameof(TaiKhoanCo), nameof(TaiKhoanNo), nameof(Hinh), nameof(GhiChu), nameof(Hinh), nameof(NguoiNopTien) ); result.ReturnCode = HttpStatusCode.OK; result.ReturnData = new { data = this }; InsertKhoLuocSuAction ls = new InsertKhoLuocSuAction(); ls.InsertKhoLuocSu(context, "KhoPhieuThu", PhieuThuId, "Update", Protector.Int(NguoiTao)); return(result); } 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 total = 0; GetListKhoTonKhoByCriteriaBiz biz = new GetListKhoTonKhoByCriteriaBiz(context); biz.TU_NGAY = _tuNgay; biz.DEN_NGAY = _denNgay; biz.KHO_HANG_ID = _khoHangId; biz.SKIP = _start; biz.TAKE = _length; biz.LOGIN_ID = LoginId; 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)); } }
/// <summary> /// Ham khoi tao gia tri mac dinh cho cac bien /// </summary> private void init() { KhoHangIds = Protector.String(KhoHangIds, ""); HangHoaIds = Protector.String(HangHoaIds, ""); StartDate = Protector.String(StartDate, ""); _StartDate = Protector.DateTime(StartDate, "yyyy-MM-dd", true); EndDate = Protector.String(EndDate, ""); _EndDate = Protector.DateTime(EndDate, "yyyy-MM-dd", true); _draw = Protector.Int(Draw, 0); _start = Protector.Int(Start, 0); _length = Protector.Int(Length, 0); _LoginId = Protector.Int(LoginId, 0); SortName = Protector.String(SortName, "HangHoaId"); SortDir = Protector.String(SortDir, "asc"); _orderClause = SortName + " " + SortDir; }
public async Task <ActionResultDto> Execute(ContextDto context) { try { init(); validate(); var orderClause = sortName + " " + sortDir; var total = 0; var biz = new GetListChiTietByPhieuCongTacIdBiz(context); biz.PHIEU_CONG_TAC = phieuCongTacId; biz.XOA = "N"; biz.ORDER_CLAUSE = orderClause; biz.SKIP = _start; biz.TAKE = _length; 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)); } }
/// <summary> /// Ham khoi tao gia tri mac dinh cho cac bien /// </summary> private void init() { PhieuNhap = Protector.String(PhieuNhap, "{}"); var __PhieuNhap = JsonConvert.DeserializeObject <dynamic>(PhieuNhap); __PhieuNhap.strNgayChungTu = Protector.String(__PhieuNhap.strNgayChungTu, ""); __PhieuNhap.strNgayThanhToan = Protector.String(__PhieuNhap.strNgayThanhToan, ""); __PhieuNhap.NgayThanhToan = Protector.DateTime(__PhieuNhap.strNgayThanhToan, "yyyy-MM-dd", true); __PhieuNhap.NgayNhap = Protector.DateTime(__PhieuNhap.strNgayNhap, "yyyy-MM-dd", true); __PhieuNhap.NgayChungTu = Protector.DateTime(__PhieuNhap.strNgayChungTu, "yyyy-MM-dd", true); __PhieuNhap.NgayChungTu = __PhieuNhap.NgayChungTu ?? DateTime.Now; PhieuNhap = JsonConvert.SerializeObject(__PhieuNhap); _PhieuNhap = JsonConvert.DeserializeObject <Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuNhap>(PhieuNhap); listChiTiet = Protector.String(listChiTiet, "{}"); _listChiTiet = JsonConvert.DeserializeObject <List <Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuNhapChiTiet> >(listChiTiet); _LoginId = Protector.Int(LoginId, 0); }
public async Task <ActionResultDto> Execute(ContextDto context) { var _result = new ActionResultDto(); try { /* kiểm tra input */ var _error = validate(); if (_error.code > 0) { return(returnActionError(HttpStatusCode.BadRequest, _error.message)); } /* convert input */ var _KhachHangId = Protector.Int(KhachHangId); GetListKhachHangByCriteriaBiz biz = new GetListKhachHangByCriteriaBiz(context); biz.KhachHang = KhachHangId; biz.FieldsField = "KhachHangId,A.Ma,A.Ten,A.Loai,A.DienThoai,A.DiDong,A.Email,A.TinhThanhPhoId,B.TenTT,A.QuanHuyenId,C.TenQuanHuyen,A.PhuongXaId,D.TenPhuongXa,A.DiaChi,A.AnyDesk,A.CtrVersion"; biz.OrderClause = "A.KhachHangId asc"; var KhachHang = await biz.Execute(); if (KhachHang == null) { return(returnActionError(HttpStatusCode.BadRequest, string.Format("Không tìm thấy KhachHangId '{0}'", _KhachHangId))); } _result.ReturnCode = HttpStatusCode.OK; _result.ReturnData = new { data = KhachHang }; return(_result); } catch (Exception ex) { return(returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } }
public async Task <ActionResultDto> Execute(ContextDto context) { var _result = new ActionResultDto(); try { /* kiểm tra input */ var _error = validate(); if (_error.code > 0) { return(returnActionError(HttpStatusCode.BadRequest, _error.message)); } /* convert input */ var _IssueId = Protector.Int(IssueId); GetListIssueByCriteraBiz biz = new GetListIssueByCriteraBiz(context); biz.IssueId = IssueId; biz.FieldsField = "A.*,B.Ten as KhachHang,C.Ho,C.Ten"; biz.OrderClause = "A.IssueId asc"; var Issue = await biz.Execute(); if (Issue == null) { return(returnActionError(HttpStatusCode.BadRequest, string.Format("Không tìm thấy IssueId '{0}'", _IssueId))); } _result.ReturnCode = HttpStatusCode.OK; _result.ReturnData = new { data = Issue }; return(_result); } catch (Exception ex) { return(returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } }
public async Task <ActionResultDto> Execute(ContextDto context) { try { init(); validate(); //var count = 0; //var repo = new KhoNuocSanXuatRepository(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); var biz = new DeleteListKhoNuocSanXuatBiz(context); biz.NUOC_SAN_XUAT_IDS = ids; biz.LOGIN_ID = Protector.Int(loginId); var result = await biz.Execute(); dynamic _metaData = new System.Dynamic.ExpandoObject(); return(ActionHelper.returnActionResult(HttpStatusCode.OK, result, _metaData)); } 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 AccountListEntity GetAll(AccountEntity entity, long pageIndex, long pageSize) { var list = new AccountListEntity(); try { using (var _uow = _unitOfWorkProvider.GetUnitOfWork()) { var query = PetaPoco.Sql.Builder.Append(@"SELECT * FROM Account WHERE bDeleted=@0", entity.bDeleted); //if (entity.CityId > 0) //{ // query.Append("AND CityId=@0", entity.CityId); //} //if (entity.Star > 0) //{ // query.Append("AND Star=@0", entity.Star); //} query.Append("ORDER BY ModifiedDate DESC"); var result = _uow.Db.Page <AccountEntity>(pageIndex, pageSize, query); if (result != null && result.TotalItems > 0) { list.List = result.Items; // danh sách data trả về list.PageTotal = result.TotalPages; // tổng số Pages list.PageIndex = result.CurrentPage; // Page hiện tại của data duoc trả về list.Count = Protector.Int(result.TotalItems); // count data } _uow.Commit(); } } catch (Exception ex) { Logger.ErrorLog(ConstantsHandler.ForderLogName.RepoBranch, "GetAll : ", ex.ToString()); } return(list); }
public async Task <dynamic> Execute(ContextDto context) { try { init(); validate(); var biz = new UpdateXoaListKhoPhieuXuatBiz(context); var ls = new InsertKhoLuocSuAction(); foreach (var item in _list) { biz.PHIEU_XUAT_ID = item.KPX_ID; biz.CTRVERSION = Protector.Int(item.KPX_CTRVERSION, -1); biz.XOA = "Y"; var result = await biz.Execute(); if (string.IsNullOrEmpty(biz.MESSAGE) == false) { throw new BaseException(biz.MESSAGE.Split('|')[2]); } item.XoaYN = "Y"; ls.InsertKhoLuocSu(context, "KhoPhieuXuat", biz.PHIEU_XUAT_ID, "Delete", _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.Message)); } }
public async Task <ActionResultDto> Execute(ContextDto context) { try { init(); validate(); var orderClause = sortName + " " + sortDir; var total = 0; var biz = new GetChucVuByIdBiz(context); biz.CHUC_VU_ID = _ChucVuId; biz.LOGIN_ID = _LoginId; 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)); } }
public async Task <ActionResultDto> Execute(ContextDto context) { var _result = new ActionResultDto(); try { /* kiểm tra input */ var _error = validate(); if (_error.code > 0) { return(returnActionError(HttpStatusCode.BadRequest, _error.message)); } /* convert input */ var _DuAnId = Protector.Int(DuAnId); GetListDuAnByIdBiz biz = new GetListDuAnByIdBiz(context); biz.DuAn = DuAnId; var DuAn = await biz.Execute(); if (DuAn == null) { return(returnActionError(HttpStatusCode.BadRequest, string.Format("Không tìm thấy DuAnId '{0}'", _DuAnId))); } _result.ReturnCode = HttpStatusCode.OK; _result.ReturnData = new { data = DuAn }; return(_result); } catch (Exception ex) { return(returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } }
public async Task <ActionResultDto> Execute(ContextDto context) { var _result = new ActionResultDto(); try { /* kiểm tra input */ var _error = validate(); if (_error.code > 0) { return(returnActionError(HttpStatusCode.BadRequest, _error.message)); } /* convert input */ var _KhenThuongId = Protector.Int(KhenThuongId); var repo = new KhenThuongRepository(context); var KhenThuong = await repo.GetById(_KhenThuongId); if (KhenThuong == null) { return(returnActionError(HttpStatusCode.BadRequest, string.Format("Không tìm thấy KhenThuongId '{0}'", _KhenThuongId))); } _result.ReturnCode = HttpStatusCode.OK; _result.ReturnData = new { data = KhenThuong }; return(_result); } catch (Exception ex) { return(returnActionError(HttpStatusCode.InternalServerError, ex.InnerException != null ? ex.InnerException.Message : ex.Message)); } }
public async Task <ActionResultDto> Execute(ContextDto context) { try { /* kiểm tra input */ var _error = validate(); if (_error.code > 0) { return(returnActionError(HttpStatusCode.BadRequest, _error.message)); } /* convert input */ var _chucNangId = Protector.Int(ChucNangId); var repo = new QuyenTacVuRepository(context); var fields = new string[] { nameof(Entity.MSSQL_QLDN_MAIN.Entity.QuyenTacVu.DSQuyenTacVu), }; var chucNang = new Entity.MSSQL_QLDN_MAIN.Entity.QuyenTacVu(); chucNang.VaiTroId = Protector.Int(VaiTroId); chucNang.ChucNangId = _chucNangId; chucNang.DSQuyenTacVu = DSQuyenTacVu; chucNang = await repo.UpdatePartial(chucNang, fields); if (chucNang == null) { return(returnActionError(HttpStatusCode.BadRequest, string.Format("Không tìm thấy QuyenTacVuId '{0}'", _chucNangId))); } return(returnActionResult(HttpStatusCode.OK, chucNang, null)); } 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() { field = Protector.String(field, ""); Series = Protector.String(Series, ""); DienThoai = Protector.String(DienThoai, ""); thongTinKhachHang = Protector.String(thongTinKhachHang, ""); sanPhamCty = Protector.String(sanPhamCty, ""); strStartDate = Protector.String(strStartDate, ""); startDate = Protector.DateTime(strStartDate, "yyyy-MM-dd", true); strEndDate = Protector.String(strEndDate, ""); endDate = Protector.DateTime(strEndDate, "yyyy-MM-dd", true); _draw = Protector.Int(draw, 0); _start = Protector.Int(start, 0); _length = Protector.Int(length, 0); _LoginId = Protector.Int(loginId, 0); sortName = Protector.String(sortName, "KPBH.NgayHen"); sortDir = Protector.String(sortDir, "DESC"); _orderClause = sortName + " " + sortDir; }
/// <summary> /// Ham khoi tao gia tri mac dinh cho cac bien /// </summary> private void init() { field = Protector.String(field, ""); search = Protector.String(search, ""); khachHang = Protector.String(khachHang, ""); khoHang = Protector.String(khoHang, ""); trangThai = Protector.String(trangThai, ""); strStartDate = Protector.String(strStartDate, ""); startDate = Protector.DateTime(strStartDate, "yyyy-MM-dd", true); strEndDate = Protector.String(strEndDate, ""); endDate = Protector.DateTime(strEndDate, "yyyy-MM-dd", true); _draw = Protector.Int(draw, 0); _start = Protector.Int(start, 0); _length = Protector.Int(length, 0); _LoginId = Protector.Int(loginId, 0); sortName = Protector.String(sortName, "KPN_ID"); sortDir = Protector.String(sortDir, "asc"); _orderClause = sortName + " " + sortDir; }
/// <summary> /// Ham khoi tao gia tri mac dinh cho cac bien /// </summary> private void init() { _draw = Protector.Int(draw); _start = Protector.Int(start); _length = Protector.Int(length); sortName = string.IsNullOrEmpty(sortName) ? "NV_ID" : sortName; sortDir = string.IsNullOrEmpty(sortDir) ? "asc" : sortDir; _length = _length < 1 ? 10 : _length; _loginId = Protector.Int(loginId); fields = string.IsNullOrEmpty(fields) ? "" : fields; search = string.IsNullOrEmpty(search) ? "" : search; _ngayTuyenDungFrom = Protector.DateTime(ngayFrom, "yyyyMMdd", true); _ngayTuyenDungTo = Protector.DateTime(ngayTo, "yyyyMMdd", true); nhanVien = string.IsNullOrEmpty(nhanVien) ? "" : nhanVien; phongBan = string.IsNullOrEmpty(phongBan) ? "" : phongBan; duAn = string.IsNullOrEmpty(duAn) ? "" : duAn; chucVu = string.IsNullOrEmpty(chucVu) ? "" : chucVu; _dangLamViec = string.IsNullOrEmpty(dangLamViec) ? null : Protector.Bool(dangLamViec, true, true); maForm = string.IsNullOrEmpty(maForm) ? "" : maForm; maTrangThai = string.IsNullOrEmpty(maTrangThai) ? "" : maForm; }
/// <summary> /// Ham khoi tao gia tri mac dinh cho cac bien /// </summary> private void init() { PhieuChuyen = Protector.String(PhieuChuyen, "{}"); var __PhieuChuyen = JsonConvert.DeserializeObject <dynamic>(PhieuChuyen); __PhieuChuyen.NgayXuat = Protector.String(__PhieuChuyen.NgayXuat, ""); __PhieuChuyen.NgayNhap = Protector.String(__PhieuChuyen.NgayNhap, ""); __PhieuChuyen.NgayXuat = Protector.DateTime(__PhieuChuyen.NgayXuat, "dd/MM/yyyy", true); __PhieuChuyen.NgayNhap = Protector.DateTime(__PhieuChuyen.NgayNhap, "dd/MM/yyyy", true); PhieuChuyen = JsonConvert.SerializeObject(__PhieuChuyen); _PhieuChuyen = JsonConvert.DeserializeObject <Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuChuyen>(PhieuChuyen); _PhieuChuyen.NgayTao = DateTime.Now; _PhieuChuyen.MaTrangThai = "KPC_KN"; _PhieuChuyen.XoaYN = "N"; _PhieuChuyen.CtrVersion = 1; listChiTiet = Protector.String(listChiTiet, "{}"); _listChiTiet = JsonConvert.DeserializeObject <List <Entity.MSSQL_QLDN_QLNS.Entity.KhoPhieuChuyenChiTiet> >(listChiTiet); _LoginId = Protector.Int(LoginId, 0); }
public async Task <dynamic> Execute(ContextDto context) { try { init(); validate(); var biz = new UpdateXoaListKhoPhieuNhapBiz(context); var ls = new InsertKhoLuocSuAction(); foreach (var item in _list) { biz.PHIEU_NHAP_ID = item.KPN_ID; biz.CTRVERSION = Protector.Int(item.KPN_CTRVERSION, -1); biz.XOA = "Y"; var result = await biz.Execute(); if (biz.RESULT != null && biz.RESULT.Value > 0) { item.XoaYN = "Y"; ls.InsertKhoLuocSu(context, "KhoPhieuNhap", biz.PHIEU_NHAP_ID, "Delete", _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.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 biz = new GetListChucNangByVaiTroIdBiz(context); biz.VaiTroId = Protector.Int(VaiTroId); biz.Loai = Loai; var config = await biz.Execute(); return(ActionHelper.returnActionResult(HttpStatusCode.OK, config, 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)); } }
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)); } }
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)); } }
/// <summary> /// Ham khoi tao gia tri mac dinh cho cac bien /// </summary> private void init() { var _TuNgay = Protector.DateTime(strTuNgay, "yyyy-MM-dd", true); if (_TuNgay == null) { throw new BaseException("TuNgay không dúng."); } TuNgay = _TuNgay.Value; var _DenNgay = Protector.DateTime(strDenNgay, "yyyy-MM-dd", true); if (_DenNgay == null) { throw new BaseException("DenNgay không dúng."); } DenNgay = _DenNgay.Value; NgayKetThucSom = Protector.DateTime(strNgayKetThucSom, "yyyy-MM-dd", true); HopDong = Protector.String(HopDong, ""); HuongLuong = Protector.Decimal(HuongLuong, 0); Luong = Protector.Int(Luong, 0); Hinh = Protector.String(Hinh, ""); }
private void init() { _CtrVersion = Protector.Int(CtrVersion); }
/// <summary> /// Ham khoi tao gia tri mac dinh cho cac bien /// </summary> private void init() { _list = JsonConvert.DeserializeObject <List <KhoHangHoaActionModel> >(listHangHoa); _LoginId = Protector.Int(LoginId, 0); }
public async Task <ActionResultDto> Execute(ContextDto context) { GetListKhoDuyetPhieuByCriteriaBiz biz = new GetListKhoDuyetPhieuByCriteriaBiz(context); var result = new ActionResultDto(); try { var _draw = Protector.Int(draw); var _start = Protector.Int(start); var _length = Protector.Int(length); /* ========================= * fixed input * ========================= */ sortName = string.IsNullOrEmpty(sortName) ? "DuyetPhieuId" : sortName; sortDir = string.IsNullOrEmpty(sortDir) ? "asc" : sortDir; _length = _length < 1 ? 10 : _length; fields = string.IsNullOrEmpty(fields) ? "*" : fields; if (search != null && search != "") { try { if (search.Split('|')[0] != "" && search.Split('|')[0] != "__/__/____") { biz.START_DATE = DateTime.ParseExact(search.Split('|')[0], "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR")).ToString("yyyy-MM-dd"); } } catch { biz.START_DATE = ""; } try { if (search.Split('|')[1] != "" && search.Split('|')[1] != "__/__/____") { biz.END_DATE = DateTime.ParseExact(search.Split('|')[1], "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR")).ToString("yyyy-MM-dd"); } } catch { biz.END_DATE = ""; } biz.LOAI_PHIEU = search.Split('|')[2]; biz.KHO_HANG = search.Split('|')[3]; biz.TRANG_THAI = search.Split('|')[4]; } var orderClause = sortName + " " + sortDir; var total = 0; biz.SEARCH_STRING = searchstring; biz.LOGIN_ID = LoginId; biz.FIELD = fields; biz.ORDER_CLAUSE = orderClause; biz.SKIP = _start; biz.TAKE = _length; IEnumerable <dynamic> listDuyetPhieu = await biz.Execute(); if (listDuyetPhieu.Count() > 0) { var obj = listDuyetPhieu.FirstOrDefault(); total = Protector.Int(obj.MAXCNT); } dynamic _metaData = new System.Dynamic.ExpandoObject(); _metaData.draw = _draw; _metaData.total = total; return(ActionHelper.returnActionResult(HttpStatusCode.OK, listDuyetPhieu, _metaData)); } catch (Exception ex) { result.ReturnCode = HttpStatusCode.InternalServerError; result.ReturnData = new { error = new { code = HttpStatusCode.InternalServerError, type = HttpStatusCode.InternalServerError.ToString(), message = ex.InnerException != null ? ex.InnerException.Message : ex.Message } }; return(result); } }
/// <summary> /// Ham khoi tao gia tri mac dinh cho cac bien /// </summary> private void init() { fields = Protector.String(fields, ""); _HangSanXuatId = Protector.Int(HangSanXuatId, 0); _loginId = Protector.Int(loginId, 0); }
public async Task <ActionResultDto> Execute(ContextDto context) { GetListPhepNamByCriteraBiz biz = new GetListPhepNamByCriteraBiz(context); var result = new ActionResultDto(); try { var _draw = Protector.Int(draw); var _start = Protector.Int(start); var _length = Protector.Int(length); /* ========================= * fixed input * ========================= */ sortName = string.IsNullOrEmpty(sortName) ? "ChamCongId" : sortName; sortDir = string.IsNullOrEmpty(sortDir) ? "asc" : sortDir; _length = _length < 1 ? 10 : _length; fields = string.IsNullOrEmpty(fields) ? "*" : fields; if (search != null && search != "") { try { if (search.Split('|')[0] != "" && search.Split('|')[0] != "__/__/____") { biz.TuNgay = DateTime.ParseExact(search.Split('|')[0], "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR")).ToString("yyyy-MM-dd"); } } catch { biz.TuNgay = ""; } try { if (search.Split('|')[1] != "" && search.Split('|')[1] != "__/__/____") { biz.DenNgay = DateTime.ParseExact(search.Split('|')[1], "dd/MM/yyyy", CultureInfo.GetCultureInfo("fr-FR")).ToString("yyyy-MM-dd"); } } catch { biz.DenNgay = ""; } biz.NhanVien = search.Split('|')[2]; biz.PhongBan = search.Split('|')[3]; biz.ChiNhanh = search.Split('|')[4]; } biz.LoginId = LoginId; var orderClause = sortName + " " + sortDir; var total = 0; biz.FieldsField = fields; biz.OrderClause = orderClause; biz.Skip = _start; biz.Take = _length; IEnumerable <dynamic> listChamCong = await biz.Execute(); dynamic _metaData = new System.Dynamic.ExpandoObject(); _metaData.draw = _draw; _metaData.total = total; return(ActionHelper.returnActionResult(HttpStatusCode.OK, listChamCong, _metaData)); } catch (Exception ex) { result.ReturnCode = HttpStatusCode.InternalServerError; result.ReturnData = new { error = new { code = HttpStatusCode.InternalServerError, type = HttpStatusCode.InternalServerError.ToString(), message = ex.InnerException != null ? ex.InnerException.Message : ex.Message } }; return(result); } }
/// <summary> /// Ham khoi tao gia tri mac dinh cho cac bien /// </summary> private void init() { _LoginId = Protector.Int(loginId, 0); _phieuBaoHanhId = Protector.Int(phieuBaoHanhId, 0); }