public async Task Post(NewAlert newAlert) { await ExecuteFunc(qry => qry.ExecuteAsync(AlertSql.Insert, new { newAlert.Message, newAlert.CreatedBy, })); }
public void Create(ViewModels.Supplier supplier) { var newSupplier = new Classics.Data.Models.Supplier() { SupplierId = Guid.NewGuid(), Title = supplier.Title, Description = supplier.Description, Email = supplier.Email, PhoneNumber = supplier.PhoneNumber, Cnpj = supplier.Cnpj, CreatedBy = supplier.CreatedBy, Status = Enums.Supplier.SupplierStatus.Enable }; _unitOfWork.SupplierRepository.Add(newSupplier); _unitOfWork.Commit(); var alert = new NewAlert { Subject = "Novo Fornecedor", Message = "Novo fornecedor de peças cadastrado no Classics: " + supplier.Title, CreatedBy = supplier.CreatedBy, Receiver = 0 }; _alertService.Create(alert); }
public void Post(NewAlert newAlert) { var result = ExecuteFunc(qry => qry.ExecuteAsync(AlertSql.Insert, new { Message = newAlert.Message, CreatedBy = newAlert.CreatedBy, })); }
public async Task Put(int id, NewAlert newAlert) { await ExecuteFunc(qry => qry.ExecuteAsync(AlertSql.Update, new { Id = id, newAlert.Message, newAlert.CreatedBy, })); }
public void Put(int id, NewAlert newAlert) { var result = ExecuteFunc(qry => qry.ExecuteAsync(AlertSql.Update, new { Id = id, Message = newAlert.Message, CreatedBy = newAlert.CreatedBy, })); }
public List <NewAlert> GetNewsAlerts(int max, string type, string publish) { List <NewAlert> newalerts = new List <NewAlert>(); NewAlert item; try { SqlDataReader reader = SqlHelper.ExecuteReader(MySettings.ConnShared , "[dbo].sp_intra_GetNewAlert" , max // 0 all , type // N or A , publish // "9","0","1" all ); if (reader.HasRows) { while (reader.Read()) { item = new NewAlert(); item.fromDate = reader["fromDate"] != DBNull.Value ? string.Format("{0:MM/dd/yyyy}", (DateTime)reader["fromDate"]) : "-"; item.toDate = reader["toDate"] != DBNull.Value ? string.Format("{0:MM/dd/yyyy}", (DateTime)reader["toDate"]) : "-"; item.Id = (int)reader["id"]; item.memo = reader["memo"].ToString(); // System.Net.WebUtility.HtmlDecode(reader["memoenc"].ToString()); item.orden = (double)reader["orden"]; item.publish = (bool)reader["publish"]; item.title = reader["title"].ToString(); item.type = reader["type"].ToString(); item.index = 0; item.stamp = reader["stamp"] != DBNull.Value ? string.Format("{0:MM/dd/yyyy}", (DateTime)reader["stamp"]) : "-"; newalerts.Add(item); } } reader.Close(); newalerts = newalerts.OrderByDescending(al => al.publish).ThenBy(al => al.orden).ToList(); } catch (Exception ex) { //no data var msg = ex.Message; } return(newalerts); }
public NewAlert GetNewAlert(string id) { NewAlert item = new NewAlert(); try { SqlDataReader reader = SqlHelper.ExecuteReader(MySettings.ConnShared , "[dbo].sp_intra_GetNewAlertById" , id // 0 all ); if (reader.HasRows) { while (reader.Read()) { item.fromDate = reader["fromDate"] != DBNull.Value ? string.Format("{0:MM/dd/yyyy}", (DateTime)reader["fromDate"]) : ""; item.toDate = reader["toDate"] != DBNull.Value ? string.Format("{0:MM/dd/yyyy}", (DateTime)reader["toDate"]) : ""; item.Id = (int)reader["id"]; item.memo = System.Net.WebUtility.HtmlDecode(reader["memo"].ToString()); item.orden = (double)reader["orden"]; item.publish = (bool)reader["publish"]; item.title = reader["title"].ToString(); item.type = reader["type"].ToString(); item.index = 1; item.stamp = reader["stamp"] != DBNull.Value ? string.Format("{0:MM/dd/yyyy}", (DateTime)reader["stamp"]) : ""; } } reader.Close(); } catch (Exception ex) { //no data var msg = ex.Message; } return(item); }
public void Put(int id, [FromBody] NewAlert newAlert) { _alertProvider.Put(id, newAlert); }
public void Post([FromBody] NewAlert newAlert) { _alertProvider.Post(newAlert); }
public IActionResult Put(int id, [FromBody] NewAlert newAlert) { return(ExecuteAction(() => _alertProvider.Put(id, newAlert))); }
public IActionResult Post([FromBody] NewAlert newAlert) { return(ExecuteAction(() => _alertProvider.Post(newAlert))); }
public void Put(int id, NewAlert newAlert) { _alertRepo.Put(id, newAlert); }
public void Post(NewAlert newAlert) { _alertRepo.Post(newAlert); }