Пример #1
0
        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));
        }
Пример #2
0
        //更新控制目标
        public int UpdateControlGoals(ControlGoalsResults newcontrolgoals)
        {
            string sqlorder1 = string.Format("UPDATE ControlGoals SET HbA1c={0},BPH={1},BPL={2},Athlete={3},Weight={4},", newcontrolgoals.HbA1c, newcontrolgoals.BPH, newcontrolgoals.BPL, newcontrolgoals.Athlete, newcontrolgoals.Weight);

            if (newcontrolgoals.FPGflag == true)
            {
                string sqlorder = string.Format("FPGmmolL={0},FPGflag={1},", newcontrolgoals.FPG, 1);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            else
            {
                string sqlorder = string.Format("FPGmgdl={0},FPGflag={1},", newcontrolgoals.FPG, 0);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            if (newcontrolgoals.PPGflag == true)
            {
                string sqlorder = string.Format("PPGmmolL={0},PPGflag={1},", newcontrolgoals.PPG, 1);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            else
            {
                string sqlorder = string.Format("PPGmgdl={0},PPGflag={1},", newcontrolgoals.PPG, 0);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            if (newcontrolgoals.Tchflag == true)
            {
                string sqlorder = string.Format("TchmmolL={0},Tchflag={1},", newcontrolgoals.Tch, 1);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            else
            {
                string sqlorder = string.Format("Tchmgdl={0},Tchflag={1},", newcontrolgoals.Tch, 0);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            if (newcontrolgoals.LDLchflag == true)
            {
                string sqlorder = string.Format("LDLchmmolL={0},LDLchflag={1},", newcontrolgoals.LDLch, 1);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            else
            {
                string sqlorder = string.Format("LDLchmgdl={0},LDLchflag={1},", newcontrolgoals.LDLch, 0);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            if (newcontrolgoals.HDLchflag == true)
            {
                string sqlorder = string.Format("HDLchmmolL={0},HDLchflag={1},", newcontrolgoals.HDLch, 1);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            else
            {
                string sqlorder = string.Format("HDLchmgdl={0},HDLchflag={1},", newcontrolgoals.HDLch, 0);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            if (newcontrolgoals.TGflag == true)
            {
                string sqlorder = string.Format("TGmmolL={0},TGflag={1},", newcontrolgoals.TG, 1);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            else
            {
                string sqlorder = string.Format("TGmgdl={0},TGflag={1},", newcontrolgoals.TG, 0);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            if (newcontrolgoals.Uaflag == true)
            {
                string sqlorder = string.Format("UaumolL={0},Uaflag={1},", newcontrolgoals.Ua, 1);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            else
            {
                string sqlorder = string.Format("Uamgdl={0},Uaflag={1},", newcontrolgoals.Ua, 0);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            if (newcontrolgoals.AlbCrflag == true)
            {
                string sqlorder = string.Format("AlbCrmgmmol={0},AlbCrflag={1}", newcontrolgoals.AlbCr, 1);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            else
            {
                string sqlorder = string.Format("AlbCrmgg={0},AlbCrflag={1}", newcontrolgoals.AlbCr, 0);
                sqlorder1 = string.Concat(sqlorder1, sqlorder);
            }
            string sqlorder2 = string.Format(" WHERE UserID={0}", newcontrolgoals.UserID);

            sqlorder1 = string.Concat(sqlorder1, sqlorder2);

            SqlBasicOperation updategoals = new SqlBasicOperation();
            int i = updategoals.Update(sqlorder1);

            return(i);
        }