internal void SaveResult(DateTime predict_date, SP_Predict_AnimalList_Result item, double prob_calving, double missing_gaps)
        {
            int bolus_id = item.bolus_id;

            Prediction pr = new Prediction();

            pr.bolus_id      = bolus_id;
            pr.analysis_date = predict_date;
            pr.prob_calving  = prob_calving;
            pr.prop_missing  = 1 - missing_gaps;
            pr.confidence    = missing_gaps;
            pr.date_stamp    = DateTime.UtcNow;
            try
            {
                using (DB_A4A060_csEntities context = new DB_A4A060_csEntities())
                {
                    context.Predictions.Add(pr);
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                throw;
            }
        }
Exemple #2
0
        public void Write(string note)
        {
            Log lg = new Log
            {
                user_id        = "Admin",
                page           = "http://193.27.73.63/Predict/CPStart.html",
                function_query = "Predict",
                error          = "",
                note           = note,
                datestamp      = DateTime.UtcNow,
                recipient      = Properties.Settings.Default.emails
            };

            try
            {
                using (DB_A4A060_csEntities context = new DB_A4A060_csEntities())
                {
                    context.Logs.Add(lg);
                    context.SaveChanges();
                }
            }
            catch (Exception ex)
            {
                EmailBox em = new EmailBox();
                em.SendEmail("*****@*****.**",
                             Properties.Settings.Default.UserName,
                             "Predict - " + ex.Message,
                             "Predict error");
                throw;
            }
        }