Beispiel #1
0
        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));
        }