示例#1
0
        public PEIS.Model.BusSymptom GetModel(int ID_Symptom)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.Append("select  top 1 ID_Symptom,ID_ExamItem,ID_Conclusion,SymptomName,SymptomDescribe,DiseaseLevel,Is_Default,NumOperSign,NumMale,NumFemale,InputCode,DispOrder,Is_Banned,ID_BanOpr,BanOperator,BanDate from BusSymptom ");
            stringBuilder.Append(" where ID_Symptom=@ID_Symptom");
            SqlParameter[] array = new SqlParameter[]
            {
                new SqlParameter("@ID_Symptom", SqlDbType.Int, 4)
            };
            array[0].Value = ID_Symptom;
            PEIS.Model.BusSymptom busSymptom = new PEIS.Model.BusSymptom();
            DataSet dataSet = DbHelperSQL.Query(stringBuilder.ToString(), array);

            PEIS.Model.BusSymptom result;
            if (dataSet.Tables[0].Rows.Count > 0)
            {
                if (dataSet.Tables[0].Rows[0]["ID_Symptom"].ToString() != "")
                {
                    busSymptom.ID_Symptom = int.Parse(dataSet.Tables[0].Rows[0]["ID_Symptom"].ToString());
                }
                if (dataSet.Tables[0].Rows[0]["ID_ExamItem"].ToString() != "")
                {
                    busSymptom.ID_ExamItem = new int?(int.Parse(dataSet.Tables[0].Rows[0]["ID_ExamItem"].ToString()));
                }
                if (dataSet.Tables[0].Rows[0]["ID_Conclusion"].ToString() != "")
                {
                    busSymptom.ID_Conclusion = new int?(int.Parse(dataSet.Tables[0].Rows[0]["ID_Conclusion"].ToString()));
                }
                busSymptom.SymptomName     = dataSet.Tables[0].Rows[0]["SymptomName"].ToString();
                busSymptom.SymptomDescribe = dataSet.Tables[0].Rows[0]["SymptomDescribe"].ToString();
                if (dataSet.Tables[0].Rows[0]["DiseaseLevel"].ToString() != "")
                {
                    busSymptom.DiseaseLevel = new int?(int.Parse(dataSet.Tables[0].Rows[0]["DiseaseLevel"].ToString()));
                }
                if (dataSet.Tables[0].Rows[0]["Is_Default"].ToString() != "")
                {
                    if (dataSet.Tables[0].Rows[0]["Is_Default"].ToString() == "1" || dataSet.Tables[0].Rows[0]["Is_Default"].ToString().ToLower() == "true")
                    {
                        busSymptom.Is_Default = new bool?(true);
                    }
                    else
                    {
                        busSymptom.Is_Default = new bool?(false);
                    }
                }
                busSymptom.NumOperSign = dataSet.Tables[0].Rows[0]["NumOperSign"].ToString();
                if (dataSet.Tables[0].Rows[0]["NumMale"].ToString() != "")
                {
                    busSymptom.NumMale = new decimal?(decimal.Parse(dataSet.Tables[0].Rows[0]["NumMale"].ToString()));
                }
                if (dataSet.Tables[0].Rows[0]["NumFemale"].ToString() != "")
                {
                    busSymptom.NumFemale = new decimal?(decimal.Parse(dataSet.Tables[0].Rows[0]["NumFemale"].ToString()));
                }
                busSymptom.InputCode = dataSet.Tables[0].Rows[0]["InputCode"].ToString();
                if (dataSet.Tables[0].Rows[0]["DispOrder"].ToString() != "")
                {
                    busSymptom.DispOrder = new int?(int.Parse(dataSet.Tables[0].Rows[0]["DispOrder"].ToString()));
                }
                if (dataSet.Tables[0].Rows[0]["Is_Banned"].ToString() != "")
                {
                    if (dataSet.Tables[0].Rows[0]["Is_Banned"].ToString() == "1" || dataSet.Tables[0].Rows[0]["Is_Banned"].ToString().ToLower() == "true")
                    {
                        busSymptom.Is_Banned = new bool?(true);
                    }
                    else
                    {
                        busSymptom.Is_Banned = new bool?(false);
                    }
                }
                if (dataSet.Tables[0].Rows[0]["ID_BanOpr"].ToString() != "")
                {
                    busSymptom.ID_BanOpr = new int?(int.Parse(dataSet.Tables[0].Rows[0]["ID_BanOpr"].ToString()));
                }
                busSymptom.BanOperator = dataSet.Tables[0].Rows[0]["BanOperator"].ToString();
                if (dataSet.Tables[0].Rows[0]["BanDate"].ToString() != "")
                {
                    busSymptom.BanDate = new DateTime?(DateTime.Parse(dataSet.Tables[0].Rows[0]["BanDate"].ToString()));
                }
                result = busSymptom;
            }
            else
            {
                result = null;
            }
            return(result);
        }