Пример #1
0
        public JsonResult LanglieParameterSettingsJson()
        {
            double[]               xArray = new double[] { };
            int[]                  vArray = new int[] { };
            var                    str    = new StreamReader(Request.InputStream);
            var                    stream = str.ReadToEnd();
            JavaScriptSerializer   js     = new JavaScriptSerializer();
            LangleyExperimentTable let    = js.Deserialize <LangleyExperimentTable>(stream);

            let.let_RecordEmployeeId = LangleyPublic.adminId;
            let.let_ExperimentalDate = DateTime.Now;
            dbDrive.Insert(let);
            double sq     = LangleyPublic.SelectState(let).CalculateStimulusQuantity(xArray, vArray, let.let_StimulusQuantityCeiling, let.let_StimulusQuantityFloor, let.let_PrecisionInstruments);
            bool   isTure = dbDrive.Insert(LangleyPublic.LangleyDataTables(let.let_Id, dbDrive, sq));
            string name   = let.let_ProductName;

            string[] value = { isTure.ToString(), let.let_Id.ToString(), name };
            return(Json(value));
        }
        public JsonResult DoptimizeParameterSettingsJson()
        {
            double[]                 xArray = { };
            int[]                    vArray = { };
            var                      str    = new StreamReader(Request.InputStream);
            var                      stream = str.ReadToEnd();
            JavaScriptSerializer     js     = new JavaScriptSerializer();
            DoptimizeExperimentTable det    = js.Deserialize <DoptimizeExperimentTable>(stream);

            det.det_ExperimentalDate = DateTime.Now;
            det.det_RecordEmployeeId = LangleyPublic.adminId;
            dbDrive.Insert(det);
            var    outputParameter = DoptimizePublic.SelectState(det).GetResult(xArray, vArray, det.det_StimulusQuantityFloor, det.det_StimulusQuantityCeiling, det.det_PrecisionInstruments, out double z, det.det_StandardDeviationEstimate);
            bool   isTure          = dbDrive.Insert(DoptimizePublic.DoptimizeDataTable(det.det_Id, dbDrive, z, outputParameter));
            string name            = det.det_ProductName;

            string[] value = { isTure.ToString(), det.det_Id.ToString(), name };
            return(Json(value));
        }
Пример #3
0
        //添加管理员
        public ActionResult Admin_add()
        {
            var    sr               = new StreamReader(Request.InputStream);
            var    stream           = sr.ReadToEnd();
            string jsonText         = stream;
            JavaScriptSerializer js = new JavaScriptSerializer();
            Admin admin             = js.Deserialize <Admin>(stream);

            return(Json(dbDrive.Insert(admin)));
        }
Пример #4
0
        //添加角色
        public ActionResult Role_add()
        {
            var    sr               = new StreamReader(Request.InputStream);
            var    stream           = sr.ReadToEnd();
            string jsonText         = stream;
            JavaScriptSerializer js = new JavaScriptSerializer();
            Role role               = new Role();

            role       = js.Deserialize <Role>(stream);
            role.limit = role.admin + "-" + role.langley + "-" + role.liftingMethod + "-" + role.Doptimize + "-" + role.mysetting + "-" + role.about;
            return(Json(dbDrive.Insert(role)));
        }
Пример #5
0
        public ActionResult InsertData(string response, string sq, int langlryExpTableId)
        {
            LangleyExperimentTable  langlryExpTable   = dbDrive.GetLangleyExperimentTable(langlryExpTableId);
            List <LangleyDataTable> langleyDataTables = dbDrive.GetAllLangleyDataTable(langlryExpTable.let_Id);
            var xOrVArray = LangleyPublic.XAndVArrays(langleyDataTables);

            if (sq != null && sq != "")
            {
                xOrVArray.xArray[langleyDataTables.Count - 1] = double.Parse(sq);
            }
            if (response != null && response != "")
            {
                xOrVArray.vArray[langleyDataTables.Count - 1] = int.Parse(response);
            }
            else
            {
                xOrVArray.vArray[langleyDataTables.Count - 1] = 0;
            }
            var lr = LangleyPublic.SelectState(langlryExpTable);

            dbDrive.Update(LangleyPublic.UpdateLangleyDataTable(langlryExpTable, lr, xOrVArray.xArray, xOrVArray.vArray, langleyDataTables[langleyDataTables.Count - 1]));

            //增加一条新数据
            double StimulusQuantity = lr.CalculateStimulusQuantity(xOrVArray.xArray, xOrVArray.vArray, langlryExpTable.let_StimulusQuantityCeiling, langlryExpTable.let_StimulusQuantityFloor, langlryExpTable.let_PrecisionInstruments);
            var    isTrue           = dbDrive.Insert(LangleyPublic.LangleyDataTables(langlryExpTableId, dbDrive, double.Parse(StimulusQuantity.ToString("f6"))));
            var    xOrVArray2       = LangleyPublic.XAndVArrays(dbDrive.GetAllLangleyDataTable(langlryExpTable.let_Id));

            xOrVArray2.vArray = LangleyPublic.IsFlipTheResponse(langlryExpTable, xOrVArray2.vArray);
            if (langlryExpTable.let_FlipTheResponse == 1)
            {
                for (int i = 0; i < xOrVArray2.vArray.Length - 1; i++)
                {
                    if (xOrVArray2.vArray[i] == 0)
                    {
                        xOrVArray2.vArray[i] = 1;
                    }
                    else
                    {
                        xOrVArray2.vArray[i] = 0;
                    }
                }
            }
            string[] value = { isTrue.ToString(), (xOrVArray2.xArray.Length - 1).ToString(), lr.GetNM(xOrVArray2.xArray, xOrVArray2.vArray), StimulusQuantity.ToString() };
            return(Json(value));
        }
        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));
        }
Пример #7
0
        public ActionResult ManyexperimentsSetings(int ExperimentalId)
        {
            var sr     = new StreamReader(Request.InputStream);
            var stream = sr.ReadToEnd();
            JavaScriptSerializer js              = new JavaScriptSerializer();
            ManyexperimentsModel mm              = js.Deserialize <ManyexperimentsModel>(stream);
            UpDownGroup          upDownGroup     = new UpDownGroup();
            UpDownDataTable      upDownDataTable = new UpDownDataTable();

            upDownGroup.dudt_ExperimentId = ExperimentalId;
            upDownGroup.dudt_Stepd        = double.Parse(mm.stepLength);
            dbDrive.Insert(upDownGroup);
            upDownDataTable.dtup_DataTableId      = upDownGroup.Id;
            upDownDataTable.dtup_Initialstimulus  = double.Parse(mm.stimulusQuantity);
            upDownDataTable.dtup_Standardstimulus = LiftingPublic.SelectState(dbDrive.GetUpDownExperiment(ExperimentalId)).GetStandardStimulus(upDownDataTable.dtup_Initialstimulus);
            upDownDataTable.dtup_response         = 0;
            bool isTure = dbDrive.Insert(upDownDataTable);

            string[] value = { isTure.ToString(), upDownGroup.Id.ToString() };
            return(Json(value));
        }