/// <summary> /// 将记录集转为Model_Doctor实体类 (Model_Doctor) /// </summary> /// <param name="dr">记录集</param> /// <param name="fileds">字段名列表</param> /// <returns>Model_Doctor</returns> protected Owen.Model.Model_MedicalRelation Populate_MedicalRelation(IDataReader reader, Dictionary<string, string> fileds) { Owen.Model.Model_MedicalRelation model = new Owen.Model.Model_MedicalRelation(); if (fileds.ContainsKey("ID") && !Convert.IsDBNull(reader["ID"])) model.ID = Convert.ToInt32(reader["ID"]); if (fileds.ContainsKey("MedicalID") && !Convert.IsDBNull(reader["MedicalID"])) model.MedicalID = Convert.ToInt32(reader["MedicalID"]); if (fileds.ContainsKey("RelationType") && !Convert.IsDBNull(reader["RelationType"])) model.RelationType = Convert.ToInt32(reader["RelationType"]); if (fileds.ContainsKey("RelationID") && !Convert.IsDBNull(reader["RelationID"])) model.RelationID = Convert.ToInt32(reader["RelationID"]); return model; }
/// <summary> /// 添加 /// </summary> public bool Insert(int medicalID, CheckBoxList cbl, int infiniteType) { bool b = false; using (TransactionScope tranScope = new TransactionScope()) { DeleteEntity(string.Format(" MedicalID = {0} and RelationType = {1} ", medicalID, infiniteType)); foreach (ListItem li in cbl.Items) { int fraId = Convert.ToInt32(li.Value); if (li.Selected == true) { Owen.Model.Model_MedicalRelation mMedicalRelation = new Owen.Model.Model_MedicalRelation(); mMedicalRelation.RelationType = infiniteType; mMedicalRelation.RelationID = fraId; mMedicalRelation.MedicalID = medicalID; AddEntity(mMedicalRelation); } } tranScope.Complete(); b = true; } return b; }
/// <summary> /// 添加 /// </summary> public bool Insert(int medicalID, int fraId, int infiniteType) { bool b = false; using (TransactionScope tranScope = new TransactionScope()) { DeleteEntity(string.Format(" MedicalID = {0} and RelationType = {1} ", medicalID, infiniteType)); Owen.Model.Model_MedicalRelation mMedicalRelation = new Owen.Model.Model_MedicalRelation(); mMedicalRelation.RelationType = infiniteType; mMedicalRelation.RelationID = fraId; mMedicalRelation.MedicalID = medicalID; AddEntity(mMedicalRelation); tranScope.Complete(); b = true; } return b; }