Exemple #1
0
        public int Add(HealthAssessExamModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" insert into HEALTHHOUSE_ASSESS_EXAM(");
            builder.Append("PID,IDCardNo,MedicalHistory,FamilyHistory,HospitalHistory,TakingMedicine,DietaryHabit,DietaryNum,DietaryLaw,DietaryOther,ExerciseExistense,IsSmoke,IsDrink,ExerciseExistenseOther,ExerciseRate,ExerciseTimes,OldSelfCareability,GloomyScore,MedicalOther,FamilyOther)");
            builder.Append(" values (");
            builder.Append("@PID,@IDCardNo,@MedicalHistory,@FamilyHistory,@HospitalHistory,@TakingMedicine,@DietaryHabit,@DietaryNum,@DietaryLaw,@DietaryOther,@ExerciseExistense,@IsSmoke,@IsDrink,@ExerciseExistenseOther,@ExerciseRate,@ExerciseTimes,@OldSelfCareability,@GloomyScore,@MedicalOther,@FamilyOther)");
            builder.Append(";select @@IDENTITY");
            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@PID", MySqlDbType.Int32),
                new MySqlParameter("@IDCardNo", MySqlDbType.String),
                new MySqlParameter("@MedicalHistory", MySqlDbType.String),
                new MySqlParameter("@FamilyHistory", MySqlDbType.String),
                new MySqlParameter("@HospitalHistory", MySqlDbType.String),
                new MySqlParameter("@TakingMedicine", MySqlDbType.String),
                new MySqlParameter("@DietaryHabit", MySqlDbType.String),
                new MySqlParameter("@DietaryNum", MySqlDbType.String),
                new MySqlParameter("@DietaryLaw", MySqlDbType.String),
                new MySqlParameter("@DietaryOther", MySqlDbType.String),
                new MySqlParameter("@ExerciseExistense", MySqlDbType.String),
                new MySqlParameter("@IsSmoke", MySqlDbType.String),
                new MySqlParameter("@IsDrink", MySqlDbType.String),
                new MySqlParameter("@ExerciseExistenseOther", MySqlDbType.String),
                new MySqlParameter("@ExerciseRate", MySqlDbType.String),
                new MySqlParameter("@ExerciseTimes", MySqlDbType.Decimal),
                new MySqlParameter("@OldSelfCareability", MySqlDbType.String),
                new MySqlParameter("@GloomyScore", MySqlDbType.Decimal),
                new MySqlParameter("@MedicalOther", MySqlDbType.String),
                new MySqlParameter("@FamilyOther", MySqlDbType.String)
            };
            cmdParms[0].Value  = model.PID;
            cmdParms[1].Value  = model.IDCardNo;
            cmdParms[2].Value  = model.MedicalHistory;
            cmdParms[3].Value  = model.FamilyHistory;
            cmdParms[4].Value  = model.HospitalHistory;
            cmdParms[5].Value  = model.TakingMedicine;
            cmdParms[6].Value  = model.DietaryHabit;
            cmdParms[7].Value  = model.DietaryNum;
            cmdParms[8].Value  = model.DietaryLaw;
            cmdParms[9].Value  = model.DietaryOther;
            cmdParms[10].Value = model.ExerciseExistense;
            cmdParms[11].Value = model.IsSmoke;
            cmdParms[12].Value = model.IsDrink;
            cmdParms[13].Value = model.ExerciseExistenseOther;
            cmdParms[14].Value = model.ExerciseRate;
            cmdParms[15].Value = model.ExerciseTimes;
            cmdParms[16].Value = model.OldSelfCareability;
            cmdParms[17].Value = model.GloomyScore;
            cmdParms[18].Value = model.MedicalOther;
            cmdParms[19].Value = model.FamilyOther;

            object single = MySQLHelper.GetSingle(builder.ToString(), cmdParms);

            if (single == null)
            {
                return(0);
            }
            return(Convert.ToInt32(single));
        }
 public bool Update(HealthAssessExamModel model)
 {
     return(this.dal.Update(model));
 }
Exemple #3
0
        public bool Update(HealthAssessExamModel model)
        {
            StringBuilder builder = new StringBuilder();

            builder.Append(" update HEALTHHOUSE_ASSESS_EXAM set ");
            builder.Append("PID=@PID,");
            builder.Append("IDCardNo=@IDCardNo,");
            builder.Append("MedicalHistory=@MedicalHistory,");
            builder.Append("FamilyHistory=@FamilyHistory,");
            builder.Append("HospitalHistory=@HospitalHistory,");
            builder.Append("TakingMedicine=@TakingMedicine,");
            builder.Append("DietaryHabit=@DietaryHabit,");
            builder.Append("DietaryNum=@DietaryNum,");
            builder.Append("DietaryLaw=@DietaryLaw,");
            builder.Append("DietaryOther=@DietaryOther,");
            builder.Append("ExerciseExistense=@ExerciseExistense,");
            builder.Append("IsSmoke=@IsSmoke,");
            builder.Append("IsDrink=@IsDrink,");
            builder.Append("ExerciseExistenseOther=@ExerciseExistenseOther,");
            builder.Append("ExerciseRate=@ExerciseRate,");
            builder.Append("ExerciseTimes=@ExerciseTimes,");
            builder.Append("OldSelfCareability=@OldSelfCareability,");
            builder.Append("GloomyScore=@GloomyScore,");
            builder.Append("MedicalOther=@MedicalOther,");
            builder.Append("FamilyOther=@FamilyOther");
            builder.Append(" where ID=@ID");
            MySqlParameter[] cmdParms = new MySqlParameter[] {
                new MySqlParameter("@PID", MySqlDbType.Int32),
                new MySqlParameter("@IDCardNo", MySqlDbType.String),
                new MySqlParameter("@MedicalHistory", MySqlDbType.String),
                new MySqlParameter("@FamilyHistory", MySqlDbType.String),
                new MySqlParameter("@HospitalHistory", MySqlDbType.String),
                new MySqlParameter("@TakingMedicine", MySqlDbType.String),
                new MySqlParameter("@DietaryHabit", MySqlDbType.String),
                new MySqlParameter("@DietaryNum", MySqlDbType.String),
                new MySqlParameter("@DietaryLaw", MySqlDbType.String),
                new MySqlParameter("@DietaryOther", MySqlDbType.String),
                new MySqlParameter("@ExerciseExistense", MySqlDbType.String),
                new MySqlParameter("@IsSmoke", MySqlDbType.String),
                new MySqlParameter("@IsDrink", MySqlDbType.String),
                new MySqlParameter("@ExerciseExistenseOther", MySqlDbType.String),
                new MySqlParameter("@ExerciseRate", MySqlDbType.String),
                new MySqlParameter("@ExerciseTimes", MySqlDbType.Decimal),
                new MySqlParameter("@OldSelfCareability", MySqlDbType.String),
                new MySqlParameter("@GloomyScore", MySqlDbType.Decimal),
                new MySqlParameter("@MedicalOther", MySqlDbType.String),
                new MySqlParameter("@FamilyOther", MySqlDbType.String),
                new MySqlParameter("@ID", MySqlDbType.Int32)
            };
            cmdParms[0].Value  = model.PID;
            cmdParms[1].Value  = model.IDCardNo;
            cmdParms[2].Value  = model.MedicalHistory;
            cmdParms[3].Value  = model.FamilyHistory;
            cmdParms[4].Value  = model.HospitalHistory;
            cmdParms[5].Value  = model.TakingMedicine;
            cmdParms[6].Value  = model.DietaryHabit;
            cmdParms[7].Value  = model.DietaryNum;
            cmdParms[8].Value  = model.DietaryLaw;
            cmdParms[9].Value  = model.DietaryOther;
            cmdParms[10].Value = model.ExerciseExistense;
            cmdParms[11].Value = model.IsSmoke;
            cmdParms[12].Value = model.IsDrink;
            cmdParms[13].Value = model.ExerciseExistenseOther;
            cmdParms[14].Value = model.ExerciseRate;
            cmdParms[15].Value = model.ExerciseTimes;
            cmdParms[16].Value = model.OldSelfCareability;
            cmdParms[17].Value = model.GloomyScore;
            cmdParms[18].Value = model.MedicalOther;
            cmdParms[19].Value = model.FamilyOther;
            cmdParms[20].Value = model.ID;
            return(MySQLHelper.ExecuteSql(builder.ToString(), cmdParms) > 0);
        }
 public int Add(HealthAssessExamModel model)
 {
     return(this.dal.Add(model));
 }