public List <CaseReport> InsertCaseReport(CaseReport UI, HttpPostedFileBase image1)
        {
            var result = new List <CaseReport>();

            using (IDbConnection con = new SqlConnection(constring))
            {
                PriorityDictionary M = new PriorityDictionary();
                M.myString = M.myString.Select(x => x.ToUpper()).ToArray();
                if (UI.Notes == null)
                {
                    UI.Notes = "No description provided";
                }
                int hits = 0;
                foreach (string x in M.myString)
                {
                    if (UI.Notes.ToUpper().Contains(x))
                    {
                        Console.Write(x + " ");
                        hits++;
                    }
                }

                if (image1 != null)
                {
                    UI.CaseReportPhoto = new byte[image1.ContentLength];
                    image1.InputStream.Read(UI.CaseReportPhoto, 0, image1.ContentLength);
                }



                con.Open();
                var param = new DynamicParameters();
                param.Add("@UserInformationID", UI.UserInformationID);
                param.Add("@EnvironmentalConcernID", UI.EnvironmentalConcernID);
                param.Add("@XCoordinates", UI.XCoordinates);
                param.Add("@YCoordinates", UI.YCoordinates);
                param.Add("@CaseLocation", UI.CaseLocation);
                param.Add("@CaseReportPhoto", UI.CaseReportPhoto);
                param.Add("@Notes", UI.Notes);
                param.Add("@Hits", hits);
                param.Add("@SpecificEnvironmentalConcernID", UI.SpecificEnvironmentalConcernID);

                //  Convert.ToBase64String(UI.CaseReportPhoto);

                result = con.Query <CaseReport>(
                    StoredProcedureEnum.I_CaseReport.ToString(), param, commandType: CommandType.StoredProcedure).ToList();
            }
            return(result);
        }
        //
        public List <CaseReport> UpdateCaseReportConcern(CaseReport UI)
        {
            var result = new List <CaseReport>();

            using (IDbConnection con = new SqlConnection(constring))
            {
                con.Open();
                var param = new DynamicParameters();
                param.Add("@CaseReportID", UI.CaseReportID);
                param.Add("@EnvironmentalConcernID", UI.EnvironmentalConcernID);
                param.Add("@SpecificEnvironmentalConcernID", UI.SpecificEnvironmentalConcernID);

                result = con.Query <CaseReport>(
                    StoredProcedureEnum.U_CaseReportConcern.ToString(), param, commandType: CommandType.StoredProcedure).ToList();
            }
            return(result);
        }
        public List <CaseReport> UpdateCaseReport_Completed(CaseReport UI, HttpPostedFileBase image1)
        {
            var result = new List <CaseReport>();

            using (IDbConnection con = new SqlConnection(constring))
            {
                if (image1 != null)
                {
                    UI.CaseReportPhotoCompleted = new byte[image1.ContentLength];
                    image1.InputStream.Read(UI.CaseReportPhotoCompleted, 0, image1.ContentLength);
                }


                string imgurId = "785030f668c9715";
                string finalURL;
                using (var w = new WebClient())
                {
                    string clientID = imgurId;
                    w.Headers.Add("Authorization", "Client-ID " + clientID);


                    var values = new NameValueCollection {
                        { "image", Convert.ToBase64String(UI.CaseReportPhotoCompleted) }
                    };
                    byte[] response    = w.UploadValues("https://api.imgur.com/3/upload.xml", values);
                    var    responseXml = XDocument.Load(new MemoryStream(response));
                    string imageUrl    = (string)responseXml.Root.Element("link");

                    finalURL = imageUrl;
                }

                con.Open();
                var param = new DynamicParameters();
                param.Add("@CaseReportID", UI.CaseReportID);
                param.Add("@CaseReportPhotoCompleted", UI.CaseReportPhotoCompleted);
                param.Add("@CaseReportPhotoLinkCompleted", finalURL);


                result = con.Query <CaseReport>(
                    StoredProcedureEnum.U_CaseReport_C.ToString(), param, commandType: CommandType.StoredProcedure).ToList();
            }
            return(result);
        }