public void AnswerQuestion(LogPostQuestion q, int?score = null, string text = null) { LogPostAnswer a = new LogPostAnswer(q.Id, score, text); if (QAList.ContainsKey(q)) { QAList.Remove(q); } QAList.Add(q, a); }
public IHttpActionResult GetAllCalls() { var qaLists = new List <QAList>(); try { var query = (from c in _db.QALists orderby c.Calldate select c); foreach (var q in query) { var qaList = new QAList { Agent = q.Agent.Trim(), Calldate = q.Calldate, ClientName = q.ClientName, CreatedDateTime = q.CreatedDateTime, InboundCall = q.InboundCall, OutboundCall = q.OutboundCall, CallLength = q.CallLength, Disposition = q.Disposition, Supervisor = q.Supervisor, Location = q.Location }; qaLists.Add(qaList); } if (query.Any() == false) { return(NotFound()); } return(Ok(qaLists)); } catch (Exception exception) { throw; } }
public IHttpActionResult GetQAFromDateTimeOLDWAY(string date, string time) { string xdate = "2-15-2017"; string xtime = "11"; string timeExt = ":00"; string combinedTime = date + ' ' + time + timeExt; string sprocName = "GetQAListByDateTime"; var qaLists = new List <QAList>(); using (SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["qaList"])) { try { using (SqlDataAdapter da = new SqlDataAdapter()) { da.SelectCommand = new SqlCommand(sprocName, conn); da.SelectCommand.CommandType = CommandType.StoredProcedure; da.SelectCommand.Parameters.Add("@datetime", SqlDbType.DateTime).Value = combinedTime; DataSet ds = new DataSet(); da.Fill(ds, "qaList"); DataTable dt = ds.Tables["qaList"]; foreach (DataRow row in dt.Rows) { var qaList = new QAList { Agent = CommonUtilities.ConvertFromDbVal <string>(row["Agent"]).Trim(), Calldate = CommonUtilities.ConvertFromDbVal <DateTime>(row["Calldate"]), CallLength = CommonUtilities.ConvertFromDbVal <int>(row["CallLength"]), ClientName = CommonUtilities.ConvertFromDbVal <string>(row["ClientName"]), InboundCall = CommonUtilities.ConvertFromDbVal <string>(row["InboundCall"]), OutboundCall = CommonUtilities.ConvertFromDbVal <string>(row["OutboundCall"]), CreatedDateTime = CommonUtilities.ConvertFromDbVal <DateTime>(row["CreatedDateTime"]) }; qaLists.Add(qaList); } if (qaLists.Any() == false) { return(NotFound()); } } } catch (SqlException ex) { } catch (Exception e) { throw; } } return(Ok(qaLists)); }