public IActionResult SendEmail(int id, ClientComment clientComment) { if (ModelState.IsValid) { string email = db.CommentFromPages.FirstOrDefault(c => c.Id == id).Email; clientComment.Email = email; MailMessage mail = new MailMessage(); mail.From = new MailAddress("*****@*****.**", "Organista"); mail.To.Add(new MailAddress(clientComment.Email)); mail.Subject = clientComment.Subject; mail.Body = clientComment.Message; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.EnableSsl = true; smtp.Credentials = new NetworkCredential("*****@*****.**", "Organista123"); db.CommentFromPages.FirstOrDefault(c => c.Id == id).IsResponsed = true; db.SaveChanges(); smtp.Send(mail); TempData["message"] = $"Message has sent to {clientComment.Email} "; return(RedirectToAction(nameof(Index))); } return(View(clientComment)); }
public ActionResult Comment(int?id, ClientComment comment) { comment.ProjectId = Convert.ToInt32(id); comment.ClientId = Convert.ToInt32(Session["ClientId"]); db.ClientComments.Add(comment); db.SaveChanges(); TempData["Message"] = "Success"; return(View()); }
public ActionResult AddComment(int?proId, string uName, string content, string dayCM) { ClientUser u = CSDLQLBH.GetUsers(filter: "f_Username = "******"Detail", "Product", new { id = proId })); }
public IActionResult AddClientComment(AddClientComment model) { Client client = db.Clients.Find(model.clientid); ClientComment cc = new ClientComment { Client = client, Posted = DateTime.Now, Text = model.comment }; string login = User.Identity.Name; cc.User = db.Users.Where(u => u.Login == login).FirstOrDefault(); db.ClientComments.Add(cc); db.SaveChanges(); return(ClientComments(model.clientid)); }
public static ClientComment UpdateComment(ClientComment clientComment) { try { var endPointString = endPointQLBH + "api/comments"; var commentUpdate = Task.Run(() => PutAsync <ClientComment>(endPointString, clientComment)).Result; return(commentUpdate); } catch (BusinessLayerException) { throw new BusinessLayerException(500, "#1001002 Không cập nhật được dữ liệu bình luận."); } catch (Exception) { throw new BusinessLayerException(500, "#1001003 Không cập nhật được dữ liệu bình luận."); } }
//TODO: Split wth the help of the process management private async Task ProcessFailedCashout(ProcessEthCoinEventCommand queueMessage) { CashOutContextData context = await _transactionService.GetTransactionContext <CashOutContextData>(queueMessage.OperationId); if (context != null) { string transactionHandlerUserId = "auto redeem"; string clientId = context.ClientId; string hash = queueMessage.TransactionHash; string cashOperationId = context.CashOperationId; string assetId = context.AssetId; var amount = context.Amount; try { ChaosKitty.Meow(); var asset = await _assetsService.AssetGetAsync(assetId); await _cashOperationsRepositoryClient.UpdateBlockchainHashAsync(clientId, cashOperationId, hash); var pt = await _paymentTransactionsRepository.TryCreateAsync(PaymentTransaction.Create(hash, CashInPaymentSystem.Ethereum, clientId, (double)amount, asset.DisplayId ?? asset.Id, status: PaymentStatus.Processing)); if (pt == null) { _log.Warning($"{nameof(EthereumCoreCommandHandler)}:{nameof(ProcessFailedCashout)}", "Transaction already handled", context: hash); return; //if was handled previously } ChaosKitty.Meow(); var sign = "+"; var commentText = $"Balance Update: {sign}{amount} {asset.Name}. Cashout failed: {hash} {queueMessage.OperationId}"; var newComment = new ClientComment { ClientId = clientId, Comment = commentText, CreatedAt = DateTime.UtcNow, FullName = "Lykke.Job.TransactionHandler", UserId = transactionHandlerUserId }; var exResult = await _exchangeOperationsServiceClient.ExchangeOperations.ManualCashInAsync( new ManualCashInRequestModel { ClientId = clientId, AssetId = assetId, Amount = (double)amount, UserId = "auto redeem", Comment = commentText, }); if (!exResult.IsOk()) { _log.Warning($"{nameof(EthereumCoreCommandHandler)}:{nameof(ProcessFailedCashout)}", "ME operation failed", context: new { ExchangeServiceResponse = exResult, QueueMessage = queueMessage }.ToJson()); } await _clientCommentsRepository.AddClientCommentAsync(newComment); await _paymentTransactionsRepository.SetStatus(hash, PaymentStatus.NotifyProcessed); ChaosKitty.Meow(); } catch (Exception e) { _log.Error($"{nameof(EthereumCoreCommandHandler)}:{nameof(ProcessFailedCashout)}", e, context: queueMessage.ToJson()); throw; } } else { _log.Warning("Can't get a context", context: queueMessage.ToJson()); } }
public JsonResult CommentClient(string clientId, string commentText) { if (!string.IsNullOrEmpty(clientId)) { var baseClient = _unitOfWork.ClientRepository.FindBy(t => t.Id == new Guid(clientId)).FirstOrDefault(); if (baseClient != null) { var newComment = new ClientComment { Id = Guid.NewGuid(), ClientId = new Guid(clientId), Comment = commentText }; _unitOfWork.ClientCommentRepository.Add(newComment); _unitOfWork.ClientCommentRepository.Save(); FileLoadHelper.AddImportLogComment(new List<ClientComment>() { newComment }); return Json(true, JsonRequestBehavior.AllowGet); } } return Json(false, JsonRequestBehavior.AllowGet); }
public JsonResult CommentMultipleClient(string[] clientsId, string commentText) { var arrayClientCommentForLog = new List<ClientComment>(); foreach (var clientId in clientsId) { if (!string.IsNullOrEmpty(clientId)) { var baseClient = _unitOfWork.ClientRepository.FindBy(t => t.Id == new Guid(clientId)).FirstOrDefault(); if (baseClient != null) { var newComment = new ClientComment { Id = Guid.NewGuid(), ClientId = new Guid(clientId), Comment = commentText }; arrayClientCommentForLog.Add(newComment); _unitOfWork.ClientCommentRepository.Add(newComment); _unitOfWork.ClientCommentRepository.Save(); } } else { return Json(false, JsonRequestBehavior.AllowGet); } } FileLoadHelper.AddImportLogComment(arrayClientCommentForLog); return Json(true, JsonRequestBehavior.AllowGet); }
protected override void Seed(TimeEntryLab.Model1 db) { Developer k = new Developer { FirstName = "Kate", LastName = "Ramsey", Email = "*****@*****.**", StartDate = new DateTime(2016, 02, 29) }; k.Groups.Add(new Group { Name = "Backend" }); Industry media = new Industry { Name = "Media" }; Client thv = new Client { Name = "THV11", Industry = media }; Project sr = new Project { Name = "Sales Report", Client = thv }; k.Projects.Add(sr); TimeEntry srt = new TimeEntry { Day = DateTime.Now, TimeSpent = 3.4f, Developer = k, Project = sr, }; var developers = Builder <Developer> .CreateListOfSize(10) .All() .With(m => m.FirstName = Faker.NameFaker.FirstName()) .With(m => m.LastName = Faker.NameFaker.LastName()) .With(m => m.Email = Faker.InternetFaker.Email()) .With(m => m.StartDate = Faker.DateTimeFaker.DateTime(new DateTime(1985, 01, 01), DateTime.Now)) .Build(); developers.Add(k); var industry = Builder <Industry> .CreateListOfSize(4) .All() .With(i => i.Name = Faker.CompanyFaker.BS()) .Build(); industry.Add(media); var clients = Builder <Client> .CreateListOfSize(7) .All() .With(m => m.Name = Faker.CompanyFaker.Name()) .With(i => i.Industry = industry[3]) .Build(); clients.Add(thv); var timeentries = new List <TimeEntry> { srt }; var project = Builder <Project> .CreateListOfSize(6) .All() .With(n => n.Name = Faker.StringFaker.Alpha(8)) .With(p => p.Client = thv) .Build(); project.Add(sr); ClientComment thvcomment = new ClientComment { Developer = k, Client = thv, Comment = "They are awesome to work with" }; IndustryComment mediaComment = new IndustryComment() { Developer = k, Industry = media, Comment = "Media people are strange" }; ProjectComment srComment = new ProjectComment() { Comment = "This project sucks!", Developer = k, Project = sr }; k.ClientComments.Add(thvcomment); k.IndustryComments.Add(mediaComment); k.ProjectComments.Add(srComment); db.Developers.AddOrUpdate(c => c.Id, developers.ToArray()); db.Projects.AddOrUpdate(p => p.ID, project.ToArray()); db.TimeEntries.AddOrUpdate(g => g.Id, timeentries.ToArray()); db.Clients.AddOrUpdate(c => c.Id, clients.ToArray()); db.Industries.AddOrUpdate(i => i.Id, industry.ToArray()); }
public SendCommentSuccessAction(ClientComment newPost) { NewComment = newPost; }
public void HandleReplyClicked(ClientComment comment) { IsReplyClicked = !IsReplyClicked; CommentReceived = comment; }