コード例 #1
0
ファイル: HomeController.cs プロジェクト: dqhl1990/dqhl
 public ActionResult SearchGoals(int UserID)
 {
     SqlFunctionalOperation searchgoals = new SqlFunctionalOperation();
     ControlGoals controlgoalsresults = new ControlGoals();
     controlgoalsresults = searchgoals.SearchControlGoals(UserID);
     return Json(controlgoalsresults);
 }
コード例 #2
0
ファイル: HomeController.cs プロジェクト: dqhl1990/dqhl
        public ActionResult UpateGoals(int UserID,float HbA1c, float FPG, bool FPGflag, float PPG, bool PPGflag, float BPH, float BPL, float Tch, bool Tchflag, float LDLch, bool LDLchflag, float HDLch, bool HDLchflag, float TG, bool TGflag, float Ua, bool Uaflag, float AlbCr, bool AlbCrflag, float Athlete, float Weight)
        {
            ControlGoalsResults newcontrolgoals = new ControlGoalsResults();
            newcontrolgoals.UserID = UserID;
            newcontrolgoals.HbA1c = HbA1c;
            newcontrolgoals.FPG = FPG;
            newcontrolgoals.FPGflag = FPGflag;
            newcontrolgoals.PPG = PPG;
            newcontrolgoals.PPGflag = PPGflag;
            newcontrolgoals.BPH = BPH;
            newcontrolgoals.BPL = BPL;
            newcontrolgoals.Tch = Tch;
            newcontrolgoals.Tchflag = Tchflag;
            newcontrolgoals.LDLch = LDLch;
            newcontrolgoals.LDLchflag = LDLchflag;
            newcontrolgoals.HDLch = HDLch;
            newcontrolgoals.HDLchflag = HDLchflag;
            newcontrolgoals.TG = TG;
            newcontrolgoals.TGflag = TGflag;
            newcontrolgoals.Ua = Ua;
            newcontrolgoals.Uaflag = Uaflag;
            newcontrolgoals.AlbCr = AlbCr;
            newcontrolgoals.AlbCrflag = AlbCrflag;
            newcontrolgoals.Athlete = Athlete;
            newcontrolgoals.Weight = Weight;

            SqlFunctionalOperation updategoals = new SqlFunctionalOperation();
            int i = updategoals.UpdateControlGoals(newcontrolgoals);

            SqlFunctionalOperation searchgoals = new SqlFunctionalOperation();
            ControlGoals controlgoalsresults = new ControlGoals();
            controlgoalsresults = searchgoals.SearchControlGoals(UserID);
            return Json(controlgoalsresults);
        }
コード例 #3
0
        //控制目标在建立用户时应为其自动设置默认值
        //查找控制目标
        public ControlGoals SearchControlGoals(int UserID)
        {
            string sqlorder = string.Format("SELECT * FROM ControlGoals WHERE UserID={0}", UserID);
            SqlBasicOperation searchgoals = new SqlBasicOperation();
            DataSet dataset = new DataSet();
            dataset = searchgoals.Search(sqlorder);
            ControlGoals goals = new ControlGoals();
            //ControlGoalsResults controlgoalsresults = new ControlGoalsResults();
            if (dataset.Tables[0].Rows.Count != 0)
            {
                goals.UserID = Convert.ToInt32(dataset.Tables[0].Rows[0][0]);
                goals.ControlGoalID = Convert.ToInt32(dataset.Tables[0].Rows[0][1]);
                goals.HbA1c = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][2]);
                goals.FPGmmolL = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][3]);
                goals.FPGmgdl = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][4]);
                goals.FPGflag = (bool)dataset.Tables[0].Rows[0][5];
                goals.PPGmmolL = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][6]);
                goals.PPGmgdl = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][7]);
                goals.PPGflag = (bool)dataset.Tables[0].Rows[0][8];
                goals.BPH = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][9]);
                goals.BPL = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][10]);
                goals.TchmmolL = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][11]);
                goals.Tchmgdl = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][12]);
                goals.Tchflag = (bool)dataset.Tables[0].Rows[0][13];
                goals.LDLchmmolL = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][14]);
                goals.LDLchmgdl = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][15]);
                goals.LDLchflag = (bool)dataset.Tables[0].Rows[0][16];
                goals.HDLchmmolL = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][17]);
                goals.HDLchmgdl = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][18]);
                goals.HDLchflag = (bool)dataset.Tables[0].Rows[0][19];
                goals.TGmmolL = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][20]);
                goals.TGmgdl = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][21]);
                goals.TGflag = (bool)dataset.Tables[0].Rows[0][22];
                goals.UaumolL = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][23]);
                goals.Uamgdl = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][24]);
                goals.Uaflag = (bool)dataset.Tables[0].Rows[0][25];
                goals.AlbCrmgmmol = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][26]);
                goals.AlbCrmgg = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][27]);
                goals.AlbCrflag = (bool)dataset.Tables[0].Rows[0][28];
                goals.Athlete = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][29]);
                goals.Weight = (float)Convert.ToDouble(dataset.Tables[0].Rows[0][30]);

                
            //    controlgoalsresults.UserID = goals.UserID;

            //    controlgoalsresults.HbA1c = goals.HbA1c;

            //    if (goals.FPGflag == true)
            //    {
            //        controlgoalsresults.FPG = goals.FPGmmolL;
            //    }
            //    else
            //    {
            //        controlgoalsresults.FPG = goals.FPGmgdl;
            //    }
            //    controlgoalsresults.FPGflag = goals.FPGflag;

            //    if (goals.PPGflag == true)
            //    {
            //        controlgoalsresults.PPG = goals.PPGmmolL;
            //    }
            //    else
            //    {
            //        controlgoalsresults.PPG = goals.PPGmgdl;
            //    }
            //    controlgoalsresults.PPGflag = goals.PPGflag;

            //    controlgoalsresults.BPH = goals.BPH;

            //    controlgoalsresults.BPL = goals.BPL;

            //    if (goals.Tchflag == true)
            //    {
            //        controlgoalsresults.Tch = goals.TchmmolL;
            //    }
            //    else
            //    {
            //        controlgoalsresults.Tch = goals.Tchmgdl;
            //    }
            //    controlgoalsresults.Tchflag = goals.Tchflag;

            //    if (goals.LDLchflag == true)
            //    {
            //        controlgoalsresults.LDLch = goals.LDLchmmolL;
            //    }
            //    else
            //    {
            //        controlgoalsresults.LDLch = goals.LDLchmgdl;
            //    }
            //    controlgoalsresults.LDLchflag = goals.LDLchflag;

            //    if (goals.TGflag == true)
            //    {
            //        controlgoalsresults.TG = goals.TGmmolL;
            //    }
            //    else
            //    {
            //        controlgoalsresults.TG = goals.TGmgdl;
            //    }
            //    controlgoalsresults.TGflag = goals.TGflag;

            //    if (goals.Uaflag == true)
            //    {
            //        controlgoalsresults.Ua = goals.UaumolL;
            //    }
            //    else
            //    {
            //        controlgoalsresults.Ua = goals.Uamgdl;
            //    }
            //    controlgoalsresults.Uaflag = goals.Uaflag;

            //    controlgoalsresults.Athlete = goals.Athlete;

            //    controlgoalsresults.Weight = goals.Weight;

                
            //    if (goals.HDLchflag == true)
            //    {
            //        controlgoalsresults.HDLch = goals.HDLchmmolL;
            //    }
            //    else
            //    {
            //        controlgoalsresults.HDLch = goals.HDLchmgdl;
            //    }
            //    controlgoalsresults.HDLchflag = goals.HDLchflag;
            //    if (goals.AlbCrflag == true)
            //    {
            //        controlgoalsresults.AlbCr = goals.AlbCrmgmmol;
            //    }
            //    else
            //    {
            //        controlgoalsresults.AlbCr = goals.AlbCrmgg;
            //    }
            //    controlgoalsresults.AlbCrflag = goals.AlbCrflag;
            }
                
            else
            {
                //goals.UserID = 0;
                //controlgoalsresults.UserID = 0;
                goals.UserID = 0;
            }


            return goals;

        }