public void OnRealizationEntry() { InvestorNotification.Realization(CurrentProject); AdminNotification.Realization(CurrentProject); ProcessMoving(ProjectWorkflow.State.Realization, "Проект теперь реализуется"); }
public async Task AdminNotifcation(AdminNotification adminNotification) { if (Clients != null) { await Clients.All.SendAsync("AdminNotification", adminNotification); } }
public async Task <IActionResult> GetAdminNotification() { var newOrdersCount = await this._context.Orders .Where(c => c.IsSend == true && c.OrderplacedId == (int)OrderplacedEnum.Client) .CountAsync(); var newOrdersDontSendCount = await this._context.Orders .Where(c => c.IsSend == false && c.OrderplacedId == (int)OrderplacedEnum.Client) .CountAsync(); var orderRequestEditStateCount = await this._context.ApproveAgentEditOrderRequests.Where(c => c.IsApprove == null).CountAsync(); var newEditRquests = await this._context.EditRequests.Where(c => c.Accept == null).CountAsync(); var newPaymentRequetsCount = await this._context.PaymentRequests .Where(c => c.Accept == null).CountAsync(); AdminNotification adminNotification = new AdminNotification() { NewOrdersCount = newOrdersCount, NewOrdersDontSendCount = newOrdersDontSendCount, OrderRequestEditStateCount = orderRequestEditStateCount, NewEditRquests = newEditRquests, NewPaymentRequetsCount = newPaymentRequetsCount }; return(Ok(adminNotification)); }
public async Task <IActionResult> Create([FromBody] CreatePaymentRequestDto createPaymentRequestDto) { PaymentRequest paymentRequest = new PaymentRequest() { PaymentWayId = createPaymentRequestDto.PaymentWayId, Note = createPaymentRequestDto.Note, ClientId = AuthoticateUserId(), CreateDate = createPaymentRequestDto.Date, Accept = null }; this._context.Add(paymentRequest); await this._context.SaveChangesAsync(); var newPaymentRequetsCount = await this._context.PaymentRequests .Where(c => c.Accept == null).CountAsync(); var adminNotification = new AdminNotification() { NewPaymentRequetsCount = newPaymentRequetsCount }; await _notificationHub.AdminNotifcation(adminNotification); return(Ok(_mapper.Map <PayemntRquestDto>(paymentRequest))); }
public void OnDoneEntry() { AdminNotification.Done(CurrentProject); InvestorNotification.Done(CurrentProject); ProcessMoving(ProjectWorkflow.State.Done, "Проект завершен"); }
public async Task <IActionResult> SetOrderState([FromBody] List <AgentOrderStateDto> agentOrderStateDtos) { var orders = await this._context.Orders.Where(c => agentOrderStateDtos.Select(c => c.Id).ToList().Contains(c.Id)).ToListAsync(); agentOrderStateDtos.ForEach(c => { var temp = new ApproveAgentEditOrderRequest() { AgentId = AuthoticateUserId(), IsApprove = null, NewAmount = c.Cost, OrderId = c.Id, OrderPlacedId = c.OrderplacedId, }; this._context.Add(temp); }); orders.ForEach(c => { c.AgentRequestStatus = (int)AgentRequestStatusEnum.Pending; }); await this._context.SaveChangesAsync(); var orderRequestEditStateCount = await this._context.ApproveAgentEditOrderRequests.Where(c => c.IsApprove == null).CountAsync(); AdminNotification adminNotification = new AdminNotification() { OrderRequestEditStateCount = orderRequestEditStateCount, }; await _notificationHub.AdminNotifcation(adminNotification); return(Ok()); }
public override void Load() { Config = new ServerConfigurationStruct(); TextReader reader = MyAPIGateway.Utilities.ReadFileInLocalStorage(Name, typeof(ServerConfig)); var xmlText = reader.ReadToEnd(); reader.Close(); if (string.IsNullOrWhiteSpace(xmlText)) { return; } try { Config = MyAPIGateway.Utilities.SerializeFromXML <ServerConfigurationStruct>(xmlText); } catch (Exception ex) { AdminNotification notification = new AdminNotification() { Date = DateTime.Now, Content = string.Format(@"There is an error in the config file. It couldn't be read. The server was started with default settings. Message: {0} If you can't find the error, simply delete the file. The server will create a new one with default settings on restart.", ex.Message) }; AdminNotificator.StoreAndNotify(notification); } if (Config == null) { Config = new ServerConfigurationStruct(); } var sendLogPms = Config.LogPrivateMessages != CommandPrivateMessage.LogPrivateMessages; CommandPrivateMessage.LogPrivateMessages = Config.LogPrivateMessages; if (sendLogPms) { ConnectionHelper.SendMessageToAllPlayers(new MessageConfig() { Config = new ServerConfigurationStruct() { LogPrivateMessages = CommandPrivateMessage.LogPrivateMessages }, Action = ConfigAction.LogPrivateMessages }); } Config.MotdFileSuffix = Config.MotdFileSuffix.ReplaceForbiddenChars(); }
public void OnInvestorApproveEntry() { CurrentProject = Repository.GetOne <Project>(p => p._id == CurrentProject._id); if (CurrentProject.WorkflowState.CurrentState == ProjectWorkflow.State.OnMap) { ProcessMoving(ProjectWorkflow.State.InvestorApprove, "Переход с стадии одобрения инвестора"); } AdminNotification.InvestorResponsed(CurrentProject); UserNotification.InvestorResponsed(CurrentProject); InvestorNotification.InvestorResponsed(CurrentProject); }
private async Task OnAdminNotificationAsync(AdminNotification notification, CancellationToken ct) { if (!string.IsNullOrEmpty(adminEmail)) { await Guard(() => SendEmailAsync(adminEmail, notification.Subject, notification.Message, ct), LogGuarded); } if (clusterConfig.Notifications?.Pushover?.Enabled == true) { await Guard(() => pushoverClient.PushMessage(notification.Subject, notification.Message, PushoverMessagePriority.None, ct), LogGuarded); } }
public void OnPlanCreatingEntry() { if (CurrentProject.WorkflowState.CurrentState == ProjectWorkflow.State.PlanCreating) { AdminNotification.PlanCreatingUpdate(CurrentProject); } else { InvestorNotification.MinEconomyResponsed(CurrentProject); } ProcessMoving(ProjectWorkflow.State.PlanCreating, "проект перешел в стадию создания дорожной карты"); }
public async Task <IActionResult> CorrectOrderCountry(List <KeyValuePair <int, int> > pairs) { var ids = pairs.Select(c => c.Key).ToList(); var cids = pairs.Select(c => c.Value).ToList(); var orders = await _context.OrderFromExcels.Where(c => ids.Contains(c.Id)).ToListAsync(); var countries = await _context.Countries.Where(c => cids.Contains(c.Id)).ToListAsync(); foreach (var item in pairs) { var ofe = orders.FirstOrDefault(c => c.Id == item.Key); if (ofe == null) { continue; } var country = countries.FirstOrDefault(c => c.Id == item.Value); var order = new Order() { Code = ofe.Code, CountryId = item.Value, Address = ofe.Address, RecipientName = ofe.RecipientName, RecipientPhones = ofe.Phone, ClientNote = ofe.Note, Cost = ofe.Cost, Date = ofe.CreateDate, MoenyPlacedId = (int)MoneyPalcedEnum.OutSideCompany, OrderplacedId = (int)OrderplacedEnum.Client, OrderStateId = (int)OrderStateEnum.Processing, ClientId = AuthoticateUserId(), CreatedBy = AuthoticateUserName(), DeliveryCost = country.DeliveryCost, IsSend = false, }; _context.Add(order); } _context.OrderFromExcels.RemoveRange(orders); _context.SaveChanges(); var newOrdersDontSendCount = await this._context.Orders .Where(c => c.IsSend == false && c.OrderplacedId == (int)OrderplacedEnum.Client) .CountAsync(); AdminNotification adminNotification = new AdminNotification() { NewOrdersDontSendCount = newOrdersDontSendCount }; await _notificationHub.AdminNotifcation(adminNotification); return(Ok()); }
public void OnWaitIspolcomFixesEntry() { if (CurrentProject.WorkflowState.CurrentState == ProjectWorkflow.State.WaitIspolcomFixes) { AdminNotification.UpdateIspolcomFix(CurrentProject); InvestorNotification.UpdateIspolcomFix(CurrentProject); } else { InvestorNotification.IspolcomFixNeeded(CurrentProject); } ProcessMoving(ProjectWorkflow.State.WaitIspolcomFixes, "Обновление состояния оиждает исправлений"); }
public void OnWaitComissionFixesEntry() { if (CurrentProject.WorkflowState.CurrentState == ProjectWorkflow.State.WaitComissionFixes) { AdminNotification.UpdateComissionFix(CurrentProject); InvestorNotification.UpdateComissionFix(CurrentProject); } else { InvestorNotification.ComissionFixNeeded(CurrentProject); } ProcessMoving(ProjectWorkflow.State.WaitComissionFixes, "Обновление состояния"); }
public void OnMapEntry() { GuardCurrentProjectNotNull(); CurrentProject = Repository.GetOne <Project>(p => p._id == CurrentProject._id); if (CurrentProject.Address.Lat > 50 && CurrentProject.Address.Lat < 56 && CurrentProject.Address.Lng > 27 && CurrentProject.Address.Lng < 33) { ProcessMoving(ProjectWorkflow.State.OnMap, "Проект перещел в состояние НА КАРТЕ"); AdminNotification.MapEntryNotificate(); } else { throw new InvalidOperationException("Адрес не верен, перепроверьте адрес"); } }
public void OnDocumentSendingEntry() { if (CurrentProject.WorkflowState.CurrentState == ProjectWorkflow.State.DocumentSending) { InvestorNotification.DocumentUpdate(CurrentProject); AdminNotification.DocumentUpdate(CurrentProject); } else { CurrentProject.InvestorUser = CurrentProject.Responses.Find(r => r.IsVerified).InvestorEmail; InvestorNotification.ProjectAproved(CurrentProject); } ProcessMoving(ProjectWorkflow.State.DocumentSending, "Проект в стадии сбора документов"); }
public void OnOnComissionEntry() { Comission comission = Repository.All <Comission>(c => c.CommissionTime > DateTime.Now && c.Type == ComissionType.Comission) .First(); if (comission.ProjectIds == null) { comission.ProjectIds = new List <string>(); } if (!comission.ProjectIds.Contains(CurrentProject._id)) { comission.ProjectIds.Add(CurrentProject._id); Repository.Update(comission); } InvestorNotification.Comission(comission, CurrentProject); AdminNotification.Comission(comission, CurrentProject); ProcessMoving(ProjectWorkflow.State.OnComission, "Проект ожидает комиссию"); }
public void OnOnIspolcomEntry() { Comission comission = Repository.All <Comission>(c => c.CommissionTime > DateTime.Now && c.Type == ComissionType.Ispolcom) .First(); if (comission.ProjectIds == null) { comission.ProjectIds = new List <string>(); } if (!comission.ProjectIds.Contains(CurrentProject._id)) { comission.ProjectIds.Add(CurrentProject._id); Repository.Update(comission); } AdminNotification.OnIspolcom(comission, CurrentProject); InvestorNotification.OnIspolcom(comission, CurrentProject); ProcessMoving(ProjectWorkflow.State.OnIspolcom, "Переход в состояние на исполкоме"); }
public async Task <IActionResult> Send([FromBody] int[] ids) { var sendOrder = await this._context.Orders.Where(c => ids.Contains(c.Id)).ToListAsync(); sendOrder.ForEach(c => c.IsSend = true); await this._context.SaveChangesAsync(); var newOrdersCount = await this._context.Orders .Where(c => c.IsSend == true && c.OrderplacedId == (int)OrderplacedEnum.Client) .CountAsync(); var newOrdersDontSendCount = await this._context.Orders .Where(c => c.IsSend == false && c.OrderplacedId == (int)OrderplacedEnum.Client) .CountAsync(); AdminNotification adminNotification = new AdminNotification() { NewOrdersCount = newOrdersCount, NewOrdersDontSendCount = newOrdersDontSendCount }; await _notificationHub.AdminNotifcation(adminNotification); return(Ok()); }
public void OnOpenExit() { AdminNotification.NotificateFill(CurrentProject); }
public override void Load() { TextReader reader = MyAPIGateway.Utilities.ReadFileInLocalStorage(Name, typeof(ServerConfig)); var text = reader.ReadToEnd(); reader.Close(); Permissions = new Permissions { Commands = new List <CommandStruct>(), Groups = new List <PermissionGroup>(), Players = new List <PlayerPermission>() }; if (!string.IsNullOrEmpty(text)) { try { Permissions = MyAPIGateway.Utilities.SerializeFromXML <Permissions>(text); } catch (Exception ex) { AdminNotification notification = new AdminNotification() { Date = DateTime.Now, Content = string.Format(@"There is an error in the _permissions file. It couldn't be read. The server was started with default _permissions. Message: {0} If you can't find the error, simply delete the file. The server will create a new one with default settings on restart.", ex.Message) }; AdminNotificator.StoreAndNotify(notification); } } //create a copy of the commands in the file var invalidCommands = new List <CommandStruct>(Permissions.Commands); foreach (ChatCommand command in _chatCommands) { if (!Permissions.Commands.Any(c => c.Name.Equals(command.Name))) { //add a command if it does not exist Permissions.Commands.Add(new CommandStruct() { Name = command.Name, NeededLevel = command.Security }); } else { //remove all commands from the list, that are valid invalidCommands.Remove(Permissions.Commands.First(c => c.Name.Equals(command.Name))); } } foreach (CommandStruct cmdStruct in invalidCommands) { // remove all invalid commands Permissions.Commands.Remove(cmdStruct); // clean up the player permissions var extentions = new List <PlayerPermission>(Permissions.Players.Where(p => p.Extensions.Any(c => c.Equals(cmdStruct.Name)))); var restrictions = new List <PlayerPermission>(Permissions.Players.Where(p => p.Restrictions.Any(c => c.Equals(cmdStruct.Name)))); foreach (PlayerPermission playerPermission in extentions) { var i = Permissions.Players.IndexOf(playerPermission); var player = Permissions.Players[i]; Permissions.Players.RemoveAt(i); player.Extensions.Remove(cmdStruct.Name); Permissions.Players.Insert(i, playerPermission); } foreach (PlayerPermission playerPermission in restrictions) { var i = Permissions.Players.IndexOf(playerPermission); var player = Permissions.Players[i]; Permissions.Players.RemoveAt(i); player.Restrictions.Remove(cmdStruct.Name); Permissions.Players.Insert(i, player); } // if the struct used an alias, we add it again properly while keeping the previous level // this might be because we changed the name of an command and keep the old as an alias to not confuse the users if (_chatCommands.Any(c => c.Commands.Any(s => s.Substring(1).Equals(cmdStruct.Name)))) { var command = _chatCommands.First(c => c.Commands.Any(s => s.Substring(1).Equals(cmdStruct.Name))); // remove all commands with the same name as we might have added it already asuming it is new Permissions.Commands.RemoveAll(c => c.Name.Equals(command.Name)); Permissions.Commands.Add(new CommandStruct() { Name = command.Name, NeededLevel = cmdStruct.NeededLevel }); foreach (PlayerPermission playerPermission in extentions) { var i = Permissions.Players.IndexOf(Permissions.Players.First(p => p.Player.SteamId == playerPermission.Player.SteamId)); var player = Permissions.Players[i]; Permissions.Players.RemoveAt(i); player.Extensions.Add(command.Name); Permissions.Players.Insert(i, player); } foreach (PlayerPermission playerPermission in restrictions) { var i = Permissions.Players.IndexOf(Permissions.Players.First(p => p.Player.SteamId == playerPermission.Player.SteamId)); var player = Permissions.Players[i]; Permissions.Players.RemoveAt(i); player.Restrictions.Add(command.Name); Permissions.Players.Insert(i, player); } } } Logger.Debug("Permission File loaded {0} commands.", Permissions.Commands.Count); // for better readability we sort it, first by level then by name Permissions.Commands = new List <CommandStruct>(Permissions.Commands.OrderByDescending(c => c.NeededLevel).ThenBy(c => c.Name)); }
public void OnWaitComissionEntry() { InvestorNotification.WaitComission(CurrentProject); AdminNotification.WaitComission(CurrentProject); ProcessMoving(ProjectWorkflow.State.WaitComission, "Проект ожидает комиссию"); }
public async Task <IActionResult> Update([FromBody] CUpdateClientDto updateClientDto) { try { var client = await this._context.Clients.FindAsync(AuthoticateUserId()); var clientName = client.Name; var clientUserName = client.UserName; var oldPassword = client.Password; client = _mapper.Map <CUpdateClientDto, Client>(updateClientDto, client); client.Name = clientName; client.UserName = clientUserName; if (client.Password == "") { client.Password = oldPassword; } this._context.Update(client); this._context.Entry(client).Collection(c => c.ClientPhones).Load(); client.ClientPhones.Clear(); if (updateClientDto.Phones != null) { foreach (var item in updateClientDto.Phones) { var clientPhone = new ClientPhone() { ClientId = AuthoticateUserId(), Phone = item, }; this._context.Add(clientPhone); } } bool isEditRequest = clientName != updateClientDto.Name || clientUserName != updateClientDto.UserName; if (isEditRequest) { EditRequest editRequest = new EditRequest(); if (clientName != updateClientDto.Name) { editRequest.OldName = clientName; editRequest.NewName = updateClientDto.Name; } if (clientUserName != updateClientDto.UserName) { editRequest.OldUserName = clientUserName; editRequest.NewUserName = updateClientDto.UserName; } editRequest.Accept = null; editRequest.ClientId = AuthoticateUserId(); editRequest.UserId = null; this._context.Add(editRequest); } await this._context.SaveChangesAsync(); if (isEditRequest) { var newEditRquests = await this._context.EditRequests.Where(c => c.Accept == null).CountAsync(); var adminNotification = new AdminNotification() { NewEditRquests = newEditRquests, }; await _notificationHub.AdminNotifcation(adminNotification); } return(Ok()); } catch (Exception ex) { return(BadRequest(new { message = "خطأ بالتعديل ", Ex = ex.Message })); } }
public void OnWaitInvolvedEntry() { AdminNotification.WaitInvolved(CurrentProject); ProcessMoving(ProjectWorkflow.State.WaitInvolved, "Заполнение заинтерисованных организаций"); }
public void OnWaitIspolcomEntry() { InvestorNotification.WaitIspolcom(CurrentProject); AdminNotification.WaitIspolcom(CurrentProject); ProcessMoving(ProjectWorkflow.State.WaitIspolcom, "Проект ожидает исполнительный комитет"); }
public async Task <IActionResult> UploadExcel(IFormFile file, [FromForm] DateTime dateTime) { System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); HashSet <string> errors = new HashSet <string>(); var excelOrder = new List <OrderFromExcelDto>(); using (var stream = new MemoryStream()) { file.CopyTo(stream); stream.Position = 0; using (var reader = ExcelReaderFactory.CreateReader(stream)) { while (reader.Read()) { var order = new OrderFromExcelDto(); if (!reader.IsDBNull(0)) { order.Code = reader.GetValue(0).ToString(); } else { errors.Add("يجب ملئ الكود "); } if (!reader.IsDBNull(1)) { order.RecipientName = reader.GetValue(1).ToString(); } if (!reader.IsDBNull(2)) { order.Country = reader.GetValue(2).ToString(); } else { errors.Add("يجب ملئ المحافظة"); } if (!reader.IsDBNull(3)) { if (Decimal.TryParse(reader.GetValue(3).ToString(), out var d)) { order.Cost = d; } else { errors.Add("كلفة الطلب ليست رقم"); } } else { errors.Add("كلفة الطلب إجبارية"); } if (!reader.IsDBNull(4)) { order.Address = reader.GetValue(4).ToString(); } if (!reader.IsDBNull(5)) { order.Phone = reader.GetValue(5).ToString(); if (order.Phone.Length > 15) { errors.Add("رقم الهاتف لا يجب ان يكون اكبر من 15 رقم"); } } else { errors.Add("رقم الهاتف إجباري"); } if (!reader.IsDBNull(6)) { order.Note = reader.GetValue(6).ToString(); } excelOrder.Add(order); } } } var codes = excelOrder.Select(c => c.Code); var similarOrders = await _context.Orders.Where(c => codes.Contains(c.Code) && c.ClientId == AuthoticateUserId()).Select(c => c.Code).ToListAsync(); var simialrCodeInExcelTable = await _context.OrderFromExcels.Where(c => c.ClientId == AuthoticateUserId() && codes.Contains(c.Code)).Select(c => c.Code).ToListAsync(); if (similarOrders.Any()) { errors.Add($"الأكواد مكررة{string.Join(",", similarOrders)}"); } if (simialrCodeInExcelTable.Any()) { errors.Add($"الأكواد {string.Join(",", simialrCodeInExcelTable)} مكررة يجب مراجعة واجهة التصحيح"); } if (errors.Any()) { return(Conflict(errors)); } bool correct = false; var dbTransacrion = this._context.Database.BeginTransaction(); try { var countriesName = excelOrder.Select(c => c.Country).Distinct().ToList(); var countries = await _context.Countries.Where(c => countriesName.Contains(c.Name)).ToListAsync(); foreach (var item in excelOrder) { var country = countries.FirstOrDefault(c => c.Name == item.Country); if (country == null) { var orderFromExcel = new OrderFromExcel() { Address = item.Address, Code = item.Code, Cost = item.Cost, Country = item.Country, Note = item.Note, Phone = item.Phone, RecipientName = item.RecipientName, ClientId = AuthoticateUserId(), CreateDate = dateTime }; await _context.AddAsync(orderFromExcel); correct = true; } else { var order = new Order() { Code = item.Code, CountryId = country.Id, Address = item.Address, RecipientName = item.RecipientName, RecipientPhones = item.Phone, ClientNote = item.Note, Cost = item.Cost, Date = dateTime, MoenyPlacedId = (int)MoneyPalcedEnum.OutSideCompany, OrderplacedId = (int)OrderplacedEnum.Client, OrderStateId = (int)OrderStateEnum.Processing, ClientId = AuthoticateUserId(), CreatedBy = AuthoticateUserName(), DeliveryCost = country.DeliveryCost, IsSend = false, }; _context.Add(order); } } await _context.SaveChangesAsync(); await dbTransacrion.CommitAsync(); var newOrdersDontSendCount = await this._context.Orders .Where(c => c.IsSend == false && c.OrderplacedId == (int)OrderplacedEnum.Client) .CountAsync(); AdminNotification adminNotification = new AdminNotification() { NewOrdersDontSendCount = newOrdersDontSendCount }; await _notificationHub.AdminNotifcation(adminNotification); return(Ok(correct)); } catch (Exception ex) { await dbTransacrion.RollbackAsync(); _logging.WriteExption(ex); return(BadRequest()); } }
public void OnInvolvedOrganizationsEntry() { InvestorNotification.InvolvedOrganizationUpdate(CurrentProject); AdminNotification.InvolvedOrganizationUpdate(CurrentProject); ProcessMoving(ProjectWorkflow.State.InvolvedOrganizations, "Обход заинтерисованных организаций"); }
public async Task <IActionResult> Create([FromBody] CreateOrderFromClient createOrderFromClient) { var dbTransacrion = this._context.Database.BeginTransaction(); try { var validate = await this.Validate(createOrderFromClient); if (validate.Count != 0) { return(Conflict(new { messages = validate })); } var country = this._context.Countries.Find(createOrderFromClient.CountryId); var order = _mapper.Map <Order>(createOrderFromClient); order.ClientId = AuthoticateUserId(); order.CreatedBy = AuthoticateUserName(); order.DeliveryCost = country.DeliveryCost; order.CreatedBy = AuthoticateUserName(); order.MoenyPlacedId = (int)MoneyPalcedEnum.OutSideCompany; order.OrderplacedId = (int)OrderplacedEnum.Client; order.OrderStateId = (int)OrderStateEnum.Processing; order.RecipientPhones = String.Join(',', createOrderFromClient.RecipientPhones); order.IsSend = false; order.CurrentCountry = this._context.Countries.Where(c => c.IsMain == true).FirstOrDefault().Id; this._context.Add(order); this._context.SaveChanges(); var orderItem = createOrderFromClient.OrderItem; if (orderItem != null) { foreach (var item in orderItem) { int orderTypeId; if (item.OrderTypeId == null) { if (item.OrderTypeName == "") { return(Conflict()); } var similerOrderType = this._context.OrderTypes.Where(c => c.Name == item.OrderTypeName).FirstOrDefault(); if (similerOrderType == null) { var orderType = new OrderType() { Name = item.OrderTypeName, }; this._context.Add(orderType); this._context.SaveChanges(); orderTypeId = orderType.Id; } else { orderTypeId = similerOrderType.Id; } } else { orderTypeId = (int)item.OrderTypeId; } this._context.Add(new OrderItem() { OrderTpyeId = orderTypeId, Count = item.Count, OrderId = order.Id }); this._context.SaveChanges(); } } await dbTransacrion.CommitAsync(); var newOrdersDontSendCount = await this._context.Orders .Where(c => c.IsSend == false && c.OrderplacedId == (int)OrderplacedEnum.Client) .CountAsync(); AdminNotification adminNotification = new AdminNotification() { NewOrdersDontSendCount = newOrdersDontSendCount }; await _notificationHub.AdminNotifcation(adminNotification); return(Ok(_mapper.Map <OrderResponseClientDto>(order))); } catch (Exception ex) { dbTransacrion.Rollback(); _logging.WriteExption(ex); return(BadRequest()); } }
public void OnOpenEntry() { ProcessMoving(ProjectWorkflow.State.Open, "Проект перещел в состояние НА КАРТЕ"); AdminNotification.NotificateReOpen(CurrentProject); }