public static BaseResponse SendExpenseForApproval(IdRequest request) { BaseResponse response = new BaseResponse(); ExpenseAppEntities entity = new ExpenseAppEntities(); try { var expenseToBeSentForApproval = (from expense in entity.Expenses where expense.ID == request.ID select expense).FirstOrDefault(); if (expenseToBeSentForApproval == null) { response.IsSuccess = false; return(response); } expenseToBeSentForApproval.LastExpenseActionId = (int)StatusEnum.WaitingForManagerApproval; ExpenseHandlers.CreateExpenseHistory(request.ID, entity, null); response.IsSuccess = true; entity.SaveChanges(); } catch (Exception ex) { response.IsSuccess = false; log.Error("Send Expense For Approval Unsuccessful", ex); } finally { entity.Dispose(); } return(response); }
public IActionResult GetBudgetPaymentOrder(IdRequest request) { if (ModelState.IsValid) { var authorizedCustomer = _cacheHelper.GetAuthorizedCustomer(); bool hasPermission = true; var order = _xBService.GetBudgetPaymentOrder(request.Id); order.ReceiverAccount.AccountNumber = order.ReceiverBankCode + order.ReceiverAccount.AccountNumber; SingleResponse <BudgetPaymentOrder> response = new SingleResponse <BudgetPaymentOrder>(); response.ResultCode = ResultCodes.normal; if (authorizedCustomer.LimitedAccess != 0) { if (!_xBService.HasProductPermission(order.DebitAccount.AccountNumber) || (order.FeeAccount != null && order.FeeAccount.AccountNumber != "0" && !_xBService.HasProductPermission(order.FeeAccount.AccountNumber))) { hasPermission = false; response.ResultCode = ResultCodes.failed; response.Result.Description = "Տվյալները հասանելի չեն։"; } } if (hasPermission) { response.ResultCode = ResultCodes.normal; response.Result = order; } return(ResponseExtensions.ToHttpResponse(response)); } else { return(ValidationError.GetValidationErrorResponse(ModelState)); } }
public override void OnActionExecuting(ActionExecutingContext context) { if (context.ActionArguments.Count != 0) { long id = 0; var argument = context.ActionArguments.Values.First(); if (argument is IdRequest) { IdRequest idRequest = argument as IdRequest; id = idRequest.Id; } else if (argument is DocIdRequest) { DocIdRequest docIdRequest = argument as DocIdRequest; id = docIdRequest.DocId; } else if (argument is OrderIdRequest) { OrderIdRequest orderIdRequest = argument as OrderIdRequest; id = orderIdRequest.OrderId; } if (!_xbService.ValidateDocId(id)) { Response response = new Response { ResultCode = ResultCodes.validationError, Description = _localizer["Գործարքի համարը սխալ է։"] }; context.Result = ResponseExtensions.ToHttpResponse(response); } } }
public static GetExpensesResponse GetExpenseByActionId(IdRequest request) { GetExpensesResponse response = new GetExpensesResponse(); ExpenseAppEntities entity = new ExpenseAppEntities(); try { response.ExpenseDto = from expense in entity.Expenses where expense.LastExpenseActionId == request.ID select new ExpenseDto { ID = expense.ID, CreatedDate = expense.CreatedDate, TotalAmount = expense.TotalAmount, UserId = expense.UserId, UserName = expense.User.FullName }; if (response.ExpenseDto == null) { response.IsSuccess = false; } response.IsSuccess = true; } catch (Exception ex) { response.IsSuccess = false; log.Error("Get Expense By UserId Unsuccessful", ex); } return(response); }
public override Task <ApplicantEducationReply> GetApplicantEducation(IdRequest request, ServerCallContext context) { ApplicantEducationPoco poco = _logic.Get(Guid.Parse(request.Id)); return(Task.FromResult <ApplicantEducationReply>(FromPoco(poco))); }
private string getListNotificationByEmpId(IdRequest request) { string json = null; int empId = request.id; JArray array = new JArray(); List <Notifications> notificationsList = getDataNotificationByEmpId(empId); //convert data foreach (var items in notificationsList) { JObject tmp = new JObject( new JProperty("createDate", items.CreateDate), new JProperty("title", items.Title), new JProperty("mode", items.CheckFace.Mode == 1 ? "Attendance Machine" : (items.CheckFace.Mode == 2 ? "Attendance OR code" : (items.CheckFace.Mode == 3 ? "Attendance Send Request By StoreManager" : null))) ); array.Add(tmp); } // JObject data = new JObject(new JProperty("historyNotifications", array)); json = JsonConvert.SerializeObject(data, Formatting.Indented); return(json); }
public override Task <SecurityLoginPayload> ReadSecurityLogin(IdRequest request, ServerCallContext context) { SecurityLoginPoco poco = _logic.Get(Guid.Parse(request.Id)); return(new Task <SecurityLoginPayload>( () => new SecurityLoginPayload() { Id = poco.Id.ToString(), Login = poco.Login, Password = poco.Password, Created = Timestamp.FromDateTime((DateTime)poco.Created), PasswordUpdate = poco.PasswordUpdate is null ? null : Timestamp.FromDateTime((DateTime)poco.PasswordUpdate), AgreementAccepted = poco.AgreementAccepted is null ? null : Timestamp.FromDateTime((DateTime)poco.AgreementAccepted), IsLocked = poco.IsLocked, IsInactive = poco.IsInactive, EmailAddress = poco.EmailAddress, PhoneNumber = poco.PhoneNumber, FullName = poco.FullName, ForceChangePassword = poco.ForceChangePassword, PrefferredLanguage = poco.PrefferredLanguage }));
public static BaseResponse PayExpense(IdRequest request) { BaseResponse response = new BaseResponse(); ExpenseAppEntities entity = new ExpenseAppEntities(); try { var expenseToBePaid = (from expense in entity.Expenses where expense.ID == request.ID select expense).FirstOrDefault(); if (expenseToBePaid == null) { response.IsSuccess = false; return(response); } expenseToBePaid.LastExpenseActionId = (int)StatusEnum.Completed; ExpenseHandlers.CreateExpenseHistory(request.ID, entity, null); entity.SaveChanges(); response.IsSuccess = true; } catch (Exception ex) { response.IsSuccess = false; log.Error("Pay Expense", ex); } finally { entity.Dispose(); } return(response); }
public BasicResponse <string> GetPointDw(IdRequest request) { var responseStr = HttpClientHelper.Post(Webapi + "/v1/Chart/GetPointDw?token=" + Token, JSONHelper.ToJSONString(request)); return(JSONHelper.ParseJSONString <BasicResponse <string> >(responseStr)); }
public IActionResult GetPeriodicDataChangeOrder(IdRequest request) { if (ModelState.IsValid) { var authorizedCustomer = _cacheHelper.GetAuthorizedCustomer(); bool hasPermission = true; var order = _xbService.GetPeriodicDataChangeOrder(request.Id); var response = new SingleResponse <PeriodicTransferDataChangeOrder>(); if (authorizedCustomer.LimitedAccess != 0) { if (_xbService.HasProductPermission(order.DebitAccount.AccountNumber)) { hasPermission = false; response.ResultCode = ResultCodes.failed; response.Result.Description = "Տվյալները հասանելի չեն։"; } } if (hasPermission) { if (order.Quality == OrderQuality.Declined) { order.RejectReason = _xbService.GetOrderRejectReason(request.Id, order.Type); } response.Result = order; response.ResultCode = ResultCodes.normal; } return(ResponseExtensions.ToHttpResponse(response)); } else { return(ValidationError.GetValidationErrorResponse(ModelState)); } }
public async Task <ActionResult <ListRequest> > Delete([FromBody] IdRequest request) { if (!await _authManager.HasAppPermissionsAsync(MenuUtils.AppPermissions.SettingsAdministratorsRole)) { return(Unauthorized()); } var roleInfo = await _roleRepository.GetRoleAsync(request.Id); await _permissionsInRolesRepository.DeleteAsync(roleInfo.RoleName); await _sitePermissionsRepository.DeleteAsync(roleInfo.RoleName); await _roleRepository.DeleteRoleAsync(roleInfo.Id); await _authManager.AddAdminLogAsync("删除管理员角色", $"角色名称:{roleInfo.RoleName}"); var roles = await _authManager.IsSuperAdminAsync() ? await _roleRepository.GetRolesAsync() : await _roleRepository.GetRolesByCreatorUserNameAsync(_authManager.AdminName); return(new ListRequest { Roles = roles }); }
public BaseResponse KelimeOnay(IdRequest idRequest) { var kelime = _kelimeRepository.Find(x => x.Id == idRequest.id); var kelimeFind = _kelimeRepository.List(x => x.Kelime.Trim().Replace(" ", string.Empty).ToLower() == kelime.Kelime.Trim().Replace(" ", string.Empty).ToLower() && x.Id != kelime.Id).ToList(); BaseResponse res; if (kelimeFind.Count() <= 0) { kelime.isOKey = true; _kelimeRepository.Update(kelime); res = new BaseResponse { isOkey = true, message = "Onaylama Başarılı" }; } else { res = new BaseResponse { isOkey = true, message = "Bu Kelime Zaten Var" }; } return(res); }
public IActionResult GetReceivedFastTransferPaymentOrder(IdRequest request) { if (ModelState.IsValid) { SingleResponse <ReceivedFastTransferPaymentOrder> response = new SingleResponse <ReceivedFastTransferPaymentOrder> { Result = _xBService.GetReceivedFastTransferPaymentOrder(request.Id) }; //քարտային հաշիվների դեպքում if (response.Result.ReceiverAccount.AccountType == 11) { response.Result.ReceiverAccount.ArcaBalance = _xBService.GetArcaBalance(response.Result.ReceiverAccount.ProductNumber .Substring(0, 16) .Trim()); if (response.Result.ReceiverAccount.AccountNumber == "220000295380000" && Convert.ToBoolean(_config["TestVersion"])) { response.Result.ReceiverAccount.ArcaBalance = null; } } response.ResultCode = ResultCodes.normal; if (response.Result.Quality == OrderQuality.Declined) { response.Result.RejectReason = _xBService.GetOrderRejectReason(request.Id, response.Result.Type); } return(ResponseExtensions.ToHttpResponse(response)); } else { return(ValidationError.GetValidationErrorResponse(ModelState)); } }
public override Task <ApplicantWorkHistoryPayload> ReadApplicantWorkHistory(IdRequest request, ServerCallContext context) { ApplicantWorkHistoryPoco poco = _logic.Get(Guid.Parse(request.Id)); return(new Task <ApplicantWorkHistoryPayload>(() => new ApplicantWorkHistoryPayload() { Id = poco.Id.ToString(), Applicant = poco.Applicant.ToString(), CompanyName = poco.CompanyName, CountryCode = poco.CountryCode, Location = poco.Location, JobTitle = poco.JobTitle, JobDescription = poco.JobDescription, StartMonth = poco.StartMonth, StartYear = poco.StartYear, EndMonth = poco.EndMonth, EndYear = poco.EndYear })); }
/// <summary> /// 获取测点的单位信息 /// </summary> /// <param name="CurrentDevid"></param> /// <returns></returns> public string getPointDw(string CurrentDevid) { var dw = ""; try { //dw = ServiceFactory.CreateService<IChartService>().getPointDw(CurrentDevid); var req = new IdRequest { Id = Convert.ToInt32(CurrentDevid) }; var res = _chartService.GetPointDw(req); if (!res.IsSuccess) { throw new Exception(res.Message); } dw = res.Data; } catch (Exception Ex) { LogHelper.Error("FiveMiniteLineQueryClass_getPointDw" + Ex.Message + Ex.StackTrace); } return(dw); }
public SupplyResponse AddToCategory(int id, [FromBody] IdRequest idRequest) { var category = _dbContext.Category.SingleOrDefault(p => p.CategoryId == id); var vItm = _dbContext.VirtualItem.SingleOrDefault(p => p.VirtualItemId == idRequest.Id); if (category == null) { return(SupplyResponse.NotFound("category", id + "")); } if (vItm == null) { return(SupplyResponse.NotFound("virtual item", idRequest.Id + "")); } var cItem = _dbContext.CategoryItem.SingleOrDefault(p => p.CategoryId == category.CategoryId && p.VirtualItem.VirtualItemId == vItm.VirtualItemId); if (cItem != null) { return(SupplyResponse.DuplicateEntry("category item", $"\"{cItem.VirtualItemId} in {cItem.CategoryId}\"")); } var cateItm = new CategoryItem { CategoryId = category.CategoryId, VirtualItemId = vItm.Id }; _dbContext.CategoryItem.Add(cateItm); _dbContext.SaveChanges(); return(Get(category.CategoryId)); }
public SupplyResponse Post(string id, [FromBody] IdRequest idRequest) { if (idRequest == null || string.IsNullOrWhiteSpace(idRequest.Id)) { return(SupplyResponse.RequiredFieldEmpty()); } var vItem = _dbContext.VirtualItem.SingleOrDefault(p => p.VirtualItemId == idRequest.Id); var item = _dbContext.Item.SingleOrDefault(p => p.SupplierItemId == id); if (item == null) { return(SupplyResponse.NotFound("item", id)); } if (vItem == null) { return(SupplyResponse.NotFound("virtual item", idRequest.Id)); } if (_dbContext.VirtualIdMap.SingleOrDefault(p => p.ItemId == item.Id && p.VirtualItemId == vItem.Id) != null) { return(SupplyResponse.DuplicateEntry("virtual map", $"{id}<->{idRequest.Id}")); } _dbContext.VirtualIdMap.Add(new VirtualIdMap { ItemId = item.Id, VirtualItemId = vItem.Id }); _dbContext.SaveChanges(); return(SupplyResponse.Ok()); }
public Response <Movie> Get([FromRoute] IdRequest request) { return(_movieManager.Get(request, new MovieInclude()).BindPayload(x => { x.Actors = x.ActorMovies.Select(y => y.Actor).ToList(); return x; })); }
/// <summary> /// 消息首页详情 /// </summary> /// <returns></returns> public ActionResult SendMessage(IdRequest request) { if (request != null) { ViewBag.Id = request.Id; } return(View()); }
public Response <bool> SetStatus <T>(IdRequest request, bool isActive) where T : DeletableEntity { var setActive = new SetActiveStatusRequest <T> { Id = request.Id, IsActive = isActive }; return(SetStatus(setActive)); }
public JsonResult Post([FromBody] IdRequest model) { Console.WriteLine(JsonConvert.SerializeObject(model)); var results = _service.PackageFiles(model.Id); return(Json(results)); }
/// <summary> /// 评价首页详情 /// </summary> /// <returns></returns> public ActionResult Detail(IdRequest request) { if (request != null && request.Id != 0) { ViewBag.Evaluate = EvaluateFunc.Instance.SelectById(request.Id); } return(View()); }
public override async Task <ToDoItem> Get(IdRequest request, ServerCallContext context) { if (Guid.TryParse(request.Id, out var guid)) { return(await _storage.GetAsync(guid)); } throw new FormatException($"{request.Id} is not a valid Guid"); }
public async Task Delete([FromBody] IdRequest req) { var modelToDel = Activator.CreateInstance <TEntity>(); modelToDel.Id = req.Id; _dbSet.Attach(modelToDel); _dbSet.Remove(modelToDel); await _db.SaveChangesAsync(); }
/// <summary> /// 评价首页详情 /// </summary> /// <returns></returns> public ActionResult ReturnDetail(IdRequest request) { if (request != null && request.Id != 0) { ViewBag.EvaluateParentId = request.Id; ViewBag.Reply = EvaluateFunc.Instance.SelectReplyById(request.Id); } return(View()); }
/// <summary> /// 确定发货 /// </summary> /// <param name="request">请求</param> /// <returns></returns> public ActionResult SendThing(IdRequest request) { if (request.Id != 0) { ViewBag.OrderInfo = OrderFunc.Instance.GetOrderById(request.Id); ViewBag.OrderID = request.Id; } return(View()); }
public async Task <OneObjectResponse <Guid> > Delete([FromBody] IdRequest request) { var now = await CheckAndGetEquipmentTypeAsync(request.Id); dbContext.Remove(now); await dbContext.SaveChangesAsync(); return(now.Id); }
public async Task <OneObjectResponse <Guid> > DeleteAsync([FromBody] IdRequest request) { var toDelete = await CheckAndGetEquipmentAsync(request.Id); dbContext.Equipments.Remove(toDelete); await dbContext.SaveChangesAsync(); return(request.Id); }
public override Task <SystemCountryCodePayload> ReadSystemCountryCode(IdRequest request, ServerCallContext context) { SystemCountryCodePoco poco = _logic.Get(request.Code); return(new Task <SystemCountryCodePayload>(() => new SystemCountryCodePayload() { Code = poco.Code, Name = poco.Name })); }
public IHttpActionResult DeleteProgram([FromBody] IdRequest request) { var response = _manager.DeleteProgram(request); if (!response.IsSuccessful) { return(BadRequest(response.ToString())); } return(Ok(response)); }