Example #1
0
 public async Task Post(NewAlert newAlert)
 {
     await ExecuteFunc(qry => qry.ExecuteAsync(AlertSql.Insert, new
     {
         newAlert.Message, newAlert.CreatedBy,
     }));
 }
Example #2
0
        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);
        }
Example #3
0
 public void Post(NewAlert newAlert)
 {
     var result = ExecuteFunc(qry => qry.ExecuteAsync(AlertSql.Insert, new
     {
         Message   = newAlert.Message,
         CreatedBy = newAlert.CreatedBy,
     }));
 }
Example #4
0
 public async Task Put(int id, NewAlert newAlert)
 {
     await ExecuteFunc(qry => qry.ExecuteAsync(AlertSql.Update, new
     {
         Id = id,
         newAlert.Message,
         newAlert.CreatedBy,
     }));
 }
Example #5
0
 public void Put(int id, NewAlert newAlert)
 {
     var result = ExecuteFunc(qry => qry.ExecuteAsync(AlertSql.Update, new
     {
         Id        = id,
         Message   = newAlert.Message,
         CreatedBy = newAlert.CreatedBy,
     }));
 }
Example #6
0
        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);
        }
Example #7
0
        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);
        }
Example #8
0
 public void Put(int id, [FromBody] NewAlert newAlert)
 {
     _alertProvider.Put(id, newAlert);
 }
Example #9
0
 public void Post([FromBody] NewAlert newAlert)
 {
     _alertProvider.Post(newAlert);
 }
Example #10
0
 public IActionResult Put(int id, [FromBody] NewAlert newAlert)
 {
     return(ExecuteAction(() => _alertProvider.Put(id, newAlert)));
 }
Example #11
0
 public IActionResult Post([FromBody] NewAlert newAlert)
 {
     return(ExecuteAction(() => _alertProvider.Post(newAlert)));
 }
Example #12
0
 public void Put(int id, NewAlert newAlert)
 {
     _alertRepo.Put(id, newAlert);
 }
Example #13
0
 public void Post(NewAlert newAlert)
 {
     _alertRepo.Post(newAlert);
 }