示例#1
0
        /// <summary>
        /// 将记录集转为Model_Medical实体类 (Model_Medical)
        /// </summary>
        /// <param name="dr">记录集</param>
        /// <param name="fileds">字段名列表</param>
        /// <returns>Model_Medical</returns>
        protected Owen.Model.Model_Medical Populate_Medical(IDataReader reader, Dictionary<string, string> fileds)
        {
            Owen.Model.Model_Medical model = new Owen.Model.Model_Medical();
            if (fileds.ContainsKey("MedicalID") && !Convert.IsDBNull(reader["MedicalID"]))
                model.MedicalID = Convert.ToInt32(reader["MedicalID"]);
            if (fileds.ContainsKey("HospitalID") && !Convert.IsDBNull(reader["HospitalID"]))
            {
                model.HospitalID = Convert.ToInt32(reader["HospitalID"]);
                Model.Model_Hospital mHospital = new DAL_Hospital().GetEntity(model.HospitalID);
                if (mHospital != null)
                {
                    model.mHospital = mHospital;

                    Model.Model_City mCity = new DAL_City().GetEntity(model.mHospital.CityID);
                    if (mCity != null)
                    {
                        model.mCity = mCity;
                        Model.Model_Province mProvince = new DAL_Province().GetEntity(model.mCity.ProvinceID);
                        if (mProvince != null)
                            model.mProvince = mProvince;
                    }
                }
            }
            if (fileds.ContainsKey("HospitalNumber") && !Convert.IsDBNull(reader["HospitalNumber"]))
                model.HospitalNumber = reader["HospitalNumber"].ToString();
            if (fileds.ContainsKey("PatientName") && !Convert.IsDBNull(reader["PatientName"]))
                model.PatientName = reader["PatientName"].ToString();
            if (fileds.ContainsKey("PatientSex") && !Convert.IsDBNull(reader["PatientSex"]))
                model.PatientSex = Convert.ToInt32(reader["PatientSex"]);
            if (fileds.ContainsKey("PatientBirth") && !Convert.IsDBNull(reader["PatientBirth"]))
                model.PatientBirth = reader["PatientBirth"].ToString();
            if (fileds.ContainsKey("PatientMobile") && !Convert.IsDBNull(reader["PatientMobile"]))
                model.PatientMobile = reader["PatientMobile"].ToString();
            if (fileds.ContainsKey("DoctorID") && !Convert.IsDBNull(reader["DoctorID"]))
            {
                model.DoctorID = Convert.ToInt32(reader["DoctorID"]);

                Model.Model_Doctor mDoctor = new DAL_Doctor().GetEntity(model.DoctorID);
                if (mDoctor != null)
                    model.mDoctor = mDoctor;
            }
            if (fileds.ContainsKey("Surgery") && !Convert.IsDBNull(reader["Surgery"]))
                model.Surgery = reader["Surgery"].ToString();
            if (fileds.ContainsKey("ProductId") && !Convert.IsDBNull(reader["ProductId"]))
                model.ProductId = Convert.ToInt32(reader["ProductId"]);
            if (fileds.ContainsKey("Finish") && !Convert.IsDBNull(reader["Finish"]))
                model.Finish = Convert.ToDecimal(reader["Finish"]);
            if (fileds.ContainsKey("DistributorID") && !Convert.IsDBNull(reader["DistributorID"]))
                model.DistributorID = Convert.ToInt32(reader["DistributorID"]);
            if (fileds.ContainsKey("EmployeesID") && !Convert.IsDBNull(reader["EmployeesID"]))
                model.EmployeesID = Convert.ToInt32(reader["EmployeesID"]);
            if (fileds.ContainsKey("CreateDt") && !Convert.IsDBNull(reader["CreateDt"]))
                model.CreateDt = Convert.ToDateTime(reader["CreateDt"]);
            if (fileds.ContainsKey("Price") && !Convert.IsDBNull(reader["Price"]))
                model.Price = Convert.ToDecimal(reader["Price"]);
            if (fileds.ContainsKey("PatientAge") && !Convert.IsDBNull(reader["PatientAge"]))
                model.PatientAge = Convert.ToInt32(reader["PatientAge"]);

            return model;
        }
示例#2
0
        /// <summary>
        /// 将记录集转为Model_Doctor实体类 (Model_Doctor)
        /// </summary>
        /// <param name="dr">记录集</param>
        /// <param name="fileds">字段名列表</param>
        /// <returns>Model_Doctor</returns>
        protected Owen.Model.Model_Doctor Populate_Doctor(IDataReader reader, Dictionary<string, string> fileds)
        {
            Owen.Model.Model_Doctor model = new Owen.Model.Model_Doctor();
            if (fileds.ContainsKey("DoctorID") && !Convert.IsDBNull(reader["DoctorID"]))
            {
                model.DoctorID = Convert.ToInt32(reader["DoctorID"]);
            }
            if (fileds.ContainsKey("HospitalID") && !Convert.IsDBNull(reader["HospitalID"]))
            {
                model.HospitalID = Convert.ToInt32(reader["HospitalID"]);
                Model.Model_Hospital mHospital = new DAL_Hospital().GetEntity(model.HospitalID);
                if (mHospital != null)
                    model.Hospital = mHospital;
            }
            if (fileds.ContainsKey("DistributorID") && !Convert.IsDBNull(reader["DistributorID"]))
            {
                model.DistributorID = Convert.ToInt32(reader["DistributorID"]);
                Model.Model_Distributor mDistributor = new DAL_Distributor().GetEntity(model.DistributorID);
                if (mDistributor != null)
                    model.Distributor = mDistributor;
            }

            if (fileds.ContainsKey("Name") && !Convert.IsDBNull(reader["Name"]))
                model.Name = reader["Name"].ToString();
            if (fileds.ContainsKey("DepartmentID") && !Convert.IsDBNull(reader["DepartmentID"]))
            {
                model.DepartmentID = Convert.ToInt32(reader["DepartmentID"]);
                Model.Model_Dictionary mDic = new DAL_Dictionary().GetEntity(model.DepartmentID);
                if (mDic != null)
                    model.Department = mDic.DicName;
            }
                
            if (fileds.ContainsKey("JobTitle") && !Convert.IsDBNull(reader["JobTitle"]))
                model.JobTitle = reader["JobTitle"].ToString();
            if (fileds.ContainsKey("Mobile") && !Convert.IsDBNull(reader["Mobile"]))
                model.Mobile = reader["Mobile"].ToString();
            if (fileds.ContainsKey("Sex") && !Convert.IsDBNull(reader["Sex"]))
                model.Sex = Convert.ToInt32(reader["Sex"]);
            if (fileds.ContainsKey("NativePlace") && !Convert.IsDBNull(reader["NativePlace"]))
                model.NativePlace = reader["NativePlace"].ToString();
            if (fileds.ContainsKey("Status") && !Convert.IsDBNull(reader["Status"]))
                model.Status = Convert.ToInt32(reader["Status"]);
            if (fileds.ContainsKey("EmployeesID") && !Convert.IsDBNull(reader["EmployeesID"]))
                model.EmployeesID = Convert.ToInt32(reader["EmployeesID"]);
            return model;
        }