/// <summary> /// Добавление запроса пользователя /// </summary> /// <param name="botUser"></param> /// <param name="type"></param> /// <param name="answer"></param> /// <param name="query"></param> /// <param name="TimeToStartAnswer"></param> /// <param name="buRequest"></param> public void AddBotQuery(BotUser botUser, FindedInformation answer, DateTime TimeToStartAnswer, BotUserRequest buRequest) { try { buRequest.BotUserID = botUser.BotUserID; buRequest.NowIs = (MallBotWhatIsHappeningNow)botUser.NowIs; if (answer != null && answer.Result != null) { buRequest.Answer = JsonConvert.SerializeObject(answer.Result); } var TimeToAnswer = DateTime.Now.Subtract(TimeToStartAnswer); buRequest.TimeToAnswer = TimeToAnswer.Days.ToString() + ":" + TimeToAnswer.Hours.ToString() + ":" + TimeToAnswer.Minutes.ToString() + ":" + TimeToAnswer.Seconds.ToString() + ":" + TimeToAnswer.Milliseconds.ToString(); buRequest.DateTime = DateTime.Now; buRequest.BotUserID = botUser.BotUserID; buRequest.CustomerCompositeID = botUser.CustomerCompositeID; buRequest.Name = botUser.Name; botUser.LastActivityDate = DateTime.Now; BotUserRequest.Add(buRequest); SaveChanges(); } catch (Exception exc) { Logging.Logger.Error(exc); } }
/// <summary> /// Добавление запроса /// </summary> /// <param name="btrequest"></param> /// <param name="TimeToStartAnswer"></param> public void AddBotRequest(BotUserRequest btrequest, DateTime TimeToStartAnswer) { var TimeToAnswer = DateTime.Now.Subtract(TimeToStartAnswer); btrequest.TimeToAnswer = TimeToAnswer.Seconds.ToString() + ":" + TimeToAnswer.Milliseconds.ToString(); BotUserRequest.Add(btrequest); SaveChanges(); }
/// <summary> /// Добавление запроса /// </summary> /// <param name="btrequest"></param> /// <param name="TimeToStartAnswer"></param> public void AddBotRequest(Models.BotUserRequest btrequest, BotUser botUser, DateTime TimeToStartAnswer) { var TimeToAnswer = DateTime.Now.Subtract(TimeToStartAnswer); btrequest.TimeToAnswer = TimeToAnswer.Seconds.ToString() + ":" + TimeToAnswer.Milliseconds.ToString(); btrequest.DateTime = DateTime.Now; btrequest.BotUserID = botUser.BotUserID; btrequest.NowIs = (MallBotWhatIsHappeningNow)botUser.NowIs; botUser.LastActivityDate = DateTime.Now; BotUserRequest.Add(btrequest); SaveChanges(); }