public JsonResult ApproveTimesheet(TimesheetViewModel model, int?roleId = null) { bool result; AssociateModel currentUserId = null; try { currentUserId = associateService.GetAssociate(User.Identity.Name); } catch (Exception) {} if (currentUserId == null || currentUserId.Id == 0) { model.CurrentUserId = this.ClientContactVerifiedDetails().ClientContactId; result = timesheetService.ApproveTimesheet(model, true); } else { result = timesheetService.ApproveTimesheet(model); } return(Json(result)); }
public IApiResponse Post(ApiRequest request) { //using (var dbConnection = new System.Data.SqlClient.SqlConnection(_dataService.ConnectionString.ConnectionString)) { var rObject = _requestParsing.ParseBody <E1Request>(request); //var treeResult = _treeService.GetDownlineIds(new DirectScale.Disco.Extension.NodeId(2), DirectScale.Disco.Extension.TreeType.Unilevel, 100); var info = _associateService.GetAssociate(rObject.BackOfficeId); //var associates = _associateService.GetAssociates(new[] { 1, 2 }); return(new Ok(new { Status = 1, RequestMessage = $"Updated {rObject.Message}.", AssociateName = info.Name })); } }
public CancelOrderHookResponse Invoke(CancelOrderHookRequest request, Func <CancelOrderHookRequest, CancelOrderHookResponse> func) { var response = func(request); var order = _orderService.GetOrderByOrderNumber(request.OrderNumber); if (string.IsNullOrEmpty(order.SpecialInstructions) || !order.SpecialInstructions.Contains("Route Shipping Protection")) { return(response); } var associate = _associateService.GetAssociate(order.AssociateId); var warehouseId = _orderService.GetWarehouseId(associate.Address); var orderDateRFC3339 = order.OrderDate.ToString("yyyy-MM-dd'T'HH:mm:ss.fffzzz"); var currencyCode = "USD"; if (order.LineItems.Count > 0 && !string.IsNullOrEmpty(order.LineItems[0].CurrencyCode)) { currencyCode = order.LineItems[0].CurrencyCode; } var req = new CancelRouteOrder { OrderId = request.OrderNumber.ToString(), OrderDateUtc = orderDateRFC3339, DistributorId = warehouseId.ToString(), OrderType = order.OrderType.ToString(), OrderTotal = order.TotalQV, OrderCountry = associate.Address.CountryCode, OrderCurrency = currencyCode, OrderStatus = order.Status, EventType = "", EventDateUtc = orderDateRFC3339 }; SendRequestToRoute(req); return(response); }