如何解决如何在ASP.NET MVC中获得平均处理时间
我正在使用Entity Framework在ASP.NET MVC中开发Web应用程序。它是用于聊天的票证日志工具。因此,如果聊天进入,代理将复制电子邮件以及聊天日期和开始时间,请单击“提交”。这将仅在带有以下字段的工具中创建聊天条目:
Email,ChatStartDateTime,ChatCreatedDateTime
所以ChatStartDateTime
和ChatCreatedDateTime
会有所不同。
现在,座席共享对聊天的支持,并且可能是他在10分钟后结束了聊天。现在,他回到了Web应用程序,并添加了对在Web应用程序上进行聊天的操作的评论,并单击了按钮CHATCOMPLETE。
单击此按钮将更新其他字段属性,例如“描述”字段和“ ChatEndDateTime”。
所以,现在我如何知道这些字段之间的持续时间
- ChatStartDateTime和ChatStartDateTime
- ChatStartDateTime和ChatEndDateTime
聊天模型类:
public class Chat
{
[Key]
public int ChatId { get; set; }
[Required]
public string CustName { get; set; }
public string Query { get; set; }
public string Resolution { get; set; }
[Required]
public DateTime ChatStartDateTime { get; set; }
public DateTime? ChatCreateDateTime { get; set; }
public DateTime? ChatEndDateTime { get; set; }
public int Id { get; set; }
public string Username { get; set; }
public string FirstName { get; set; }
public string Email { get; set; }
[ForeignKey("Id")]
public virtual User User { get; set; }
}
ChatLog控制器动作
public ActionResult MyChats()
{
using (Db db = new Db())
{
Chat dto = new Chat();
var uName = User.Identity.Name;
ViewBag.myTodayTicket = db.Chats.Where(x => System.Data.Entity.DbFunctions.TruncateTime(x.ChatCreateDateTime) == DateTime.Today && x.Username == uName).Count();
return View(db.Chats.Where(x => x.Username == uName).ToArray().ToList());
}
}
非常感谢您的帮助。
解决方法
这是我如何解析@(string.Format(“ {0:hh \:mm \:ss}”,item.ChatEndDateTime-item.ChatCreateDateTime)的方法。现在检查如何统计所有聊天记录并获得平均值
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。