Пример #1
0
        public override DoptimizeDataTable GetDoptimizeDataTable(int id)
        {
            DoptimizeDataTable ddt = new DoptimizeDataTable();

            ddt = db.DoptimizeDataTable.Where(m => m.ddt_Id == id).ToList()[0];
            return(ddt);
        }
Пример #2
0
 public static void UpdateDoptimizeDataTable(ref DoptimizeDataTable ddt, OutputParameters outputParameters, string response, string sq)
 {
     ddt.ddt_StimulusQuantity          = double.Parse(sq);
     ddt.ddt_Response                  = int.Parse(response);
     ddt.ddt_Mean                      = double.Parse(outputParameters.μ0_final.ToString("f13"));
     ddt.ddt_StandardDeviation         = double.Parse(outputParameters.σ0_final.ToString("f13"));
     ddt.ddt_MeanVariance              = double.IsNaN(outputParameters.varmu) ? 0 : outputParameters.varmu;
     ddt.ddt_StandardDeviationVariance = double.IsNaN(outputParameters.varsigma) ? 0 : outputParameters.varsigma;
     ddt.ddt_Covmusigma                = double.IsNaN(outputParameters.covmusigma) ? 0 : outputParameters.covmusigma;
 }
        public JsonResult PointCalculate(int dop_id)
        {
            List <DoptimizeDataTable> ddt_list = dbDrive.GetDoptimizeDataTables(dop_id);
            DoptimizeDataTable        ddt      = ddt_list[ddt_list.Count - 2];
            var    lr   = DoptimizePublic.SelectState(dbDrive.GetDoptimizeExperimentTable(dop_id));
            double mean = ddt.ddt_Mean;
            double standardDeviation = ddt.ddt_StandardDeviation;

            double[] precs = lr.Precs(mean, standardDeviation);
            string[] value = { mean.ToString("f6"), standardDeviation.ToString("f6"), precs[0].ToString("f6"), precs[1].ToString("f6") };
            return(Json(value));
        }
Пример #4
0
 public override bool Insert(DoptimizeDataTable ddt)
 {
     try
     {
         db.DoptimizeDataTable.Add(ddt);
         db.SaveChanges();
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }
Пример #5
0
        public static DoptimizeDataTable DoptimizeDataTable(int det_Id, IDbDrive dbDrive, double sq, OutputParameters outputParameters)
        {
            DoptimizeDataTable doptimizeDataTable = new DoptimizeDataTable();

            doptimizeDataTable.ddt_ExperimentTableId = det_Id;
            doptimizeDataTable.ddt_StimulusQuantity  = double.Parse(sq.ToString("f6"));
            doptimizeDataTable.ddt_Number            = dbDrive.GetDoptimizeDataTables(det_Id).Count + 1;
            doptimizeDataTable.ddt_Response          = 0;
            doptimizeDataTable.ddt_Mean = 0;
            doptimizeDataTable.ddt_StandardDeviation         = 0;
            doptimizeDataTable.ddt_SigmaGuess                = outputParameters.sigmaguess;
            doptimizeDataTable.ddt_StandardDeviationVariance = 0;
            doptimizeDataTable.ddt_MeanVariance              = 0;
            doptimizeDataTable.ddt_Covmusigma                = 0;
            doptimizeDataTable.ddt_Note1 = "";
            return(doptimizeDataTable);
        }
Пример #6
0
        public override bool Delete(DoptimizeDataTable ddt)
        {
            DoptimizeDataTable modle = db.DoptimizeDataTable.FirstOrDefault(m => m.ddt_Id == ddt.ddt_Id);

            if (modle == null)
            {
                return(false);
            }
            try
            {
                db.DoptimizeDataTable.Remove(modle);
                db.SaveChanges();
            }
            catch (Exception)
            {
                return(false);
            }
            return(true);
        }
Пример #7
0
 public override bool Update(DoptimizeDataTable ddt)
 {
     try
     {
         var entry = db.Set <DoptimizeDataTable>().Find(ddt.ddt_Id);
         if (entry != null)
         {
             db.Entry <DoptimizeDataTable>(entry).State = EntityState.Detached; //这个是在同一个上下文能修改的关键
         }
         db.DoptimizeDataTable.Attach(ddt);
         db.Entry(ddt).State = EntityState.Modified;
         db.SaveChanges();
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }
        public JsonResult InsertData(int dop_id, string response, string sq)
        {
            DoptimizeExperimentTable  det      = dbDrive.GetDoptimizeExperimentTable(dop_id);
            List <DoptimizeDataTable> ddt_list = dbDrive.GetDoptimizeDataTables(dop_id);

            ddt_list[ddt_list.Count - 1].ddt_StimulusQuantity = sq != "" ? double.Parse(sq) : ddt_list[ddt_list.Count - 1].ddt_StimulusQuantity;
            ddt_list[ddt_list.Count - 1].ddt_Response         = int.Parse(response);
            var der_list           = DoptimizePublic.DoptimizeExperimentRecoedsList(ddt_list, det);
            var xAndV              = DoptimizePublic.ReturnXarrayAndVarray(der_list);
            var outputParameter    = DoptimizePublic.SelectState(det).GetResult(xAndV.xArray, xAndV.vArray, det.det_StimulusQuantityFloor, det.det_StimulusQuantityCeiling, det.det_PrecisionInstruments, out double z, ddt_list[ddt_list.Count - 1].ddt_SigmaGuess);
            DoptimizeDataTable ddt = ddt_list[ddt_list.Count - 1];

            DoptimizePublic.UpdateDoptimizeDataTable(ref ddt, outputParameter, response, sq);
            dbDrive.Update(ddt);
            bool isTurn = dbDrive.Insert(DoptimizePublic.DoptimizeDataTable(det.det_Id, dbDrive, double.Parse(z.ToString("f6")), outputParameter));

            string[] value = { isTurn.ToString(), ddt_list.Count.ToString(), z.ToString() };
            return(Json(value));
        }
Пример #9
0
 public abstract bool Delete(DoptimizeDataTable ddt);
Пример #10
0
 public abstract bool Update(DoptimizeDataTable ddt);
Пример #11
0
 public abstract bool Insert(DoptimizeDataTable ddt);