当前位置: 首页>>代码示例>>C#>>正文


C# CommonLibrary.DataConnection类代码示例

本文整理汇总了C#中CDMISrestful.CommonLibrary.DataConnection的典型用法代码示例。如果您正苦于以下问题:C# DataConnection类的具体用法?C# DataConnection怎么用?C# DataConnection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DataConnection类属于CDMISrestful.CommonLibrary命名空间,在下文中一共展示了DataConnection类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Remove

        //private List<CmMstInfoItem> CmMstInfoItemList = new List<CmMstInfoItem>();
     

        //public IEnumerable<CmMstInfoItem> GetAll()
        //{
        //    List<CmMstInfoItem> CmMstInfoItemList = new List<CmMstInfoItem>();
        //    GetCmMstInfoItem(CmMstInfoItemList);
        //    return CmMstInfoItemList;
        //}

        //public CmMstInfoItem Get(string CategoryCode, string Code, int StartDate)
        //{
        //    List<CmMstInfoItem> CmMstInfoItemList = new List<CmMstInfoItem>();
        //    GetCmMstInfoItem(CmMstInfoItemList);
        //    return CmMstInfoItemList.Find(p => p.CategoryCode == CategoryCode && p.Code == Code && p.StartDate == StartDate);
        //}

        public int Remove(DataConnection pclsCache, string CategoryCode, string Code, int StartDate)
        {
             int ret = 3;
             try
             {
                 if (!pclsCache.Connect())
                 {
                     //MessageBox.Show("Cache数据库连接失败");
                     return ret;

                 }
                 ret = (int)Cm.MstInfoItem.DeleteData(pclsCache.CacheConnectionObject, CategoryCode, Code);
                 return ret;
             }
             catch (Exception ex)
             {
                 //MessageBox.Show(ex.ToString(), "保存失败!");
                 HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "CmMstInfoItem.DeleteData", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                 return ret;
             }
             finally
             {
                 pclsCache.DisConnect();
             }
        }
开发者ID:syfbme,项目名称:CDMISrestful,代码行数:42,代码来源:CmMstInfoItemRepository.cs

示例2: ChangePassword

        //ChangePassword ZAM 2014-12-01 //WF 20151010
        public int ChangePassword(DataConnection pclsCache, string UserId, string OldPassword, string newPassword, string revUserId, string TerminalName, string TerminalIP, int DeviceType)
        {
            int ret = 0;
            try
            {
                if (!pclsCache.Connect())
                {
                    //MessageBox.Show("Cache数据库连接失败");
                    return ret;

                }
                ret = (int)Cm.MstUser.ChangePassword(pclsCache.CacheConnectionObject, UserId, OldPassword, newPassword, revUserId, TerminalName, TerminalIP, DeviceType);
                return ret;
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString(), "保存失败!");
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "CmMstUser.ChangePassword", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return ret;
            }
            finally
            {
                pclsCache.DisConnect();
            }
        }
开发者ID:BME319,项目名称:CDMISrestful,代码行数:26,代码来源:UsersMethod.cs

示例3: GetVitalSignDates

 /// <summary>
 /// 获取某日期之后的有数据的起止时间 GL 2015-10-10
 /// </summary>
 /// <param name="UserId"></param>
 /// <param name="date"></param>
 /// <param name="Num"></param>
 /// <returns></returns>
 public VitalInfo GetVitalSignDates(DataConnection pclsCache, string UserId, int date, int Num)
 {
     try
     {
         VitalInfo item = new VitalInfo();
         InterSystems.Data.CacheTypes.CacheSysList list = null;
         if (!pclsCache.Connect())
         {
             return null;
         }
         list = Ps.VitalSigns.GetVitalSignDates(pclsCache.CacheConnectionObject, UserId, date, Num);
         if (list != null)
         {
             item.StartDate = list[0];
             item.EndDate = list[1];
         }
         return item;
     }
     catch (Exception ex)
     {
         HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "VitalInfoMethod.GetVitalSignDates", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
         return null;
     }
     finally
     {
         pclsCache.DisConnect();
     }
 }
开发者ID:syfbme,项目名称:CDMISrestful,代码行数:35,代码来源:VitalInfoMethod.cs

示例4: SetSMS

 /// <summary>
 /// 将消息写入数据库并获取发送时间与显示时间 GL 2015-10-10(修改2015-10-26)
 /// </summary>
 /// <param name="SendBy"></param>
 /// <param name="Reciever"></param>
 /// <param name="Content"></param>
 /// <param name="piUserId"></param>
 /// <param name="piTerminalName"></param>
 /// <param name="piTerminalIP"></param>
 /// <param name="piDeviceType"></param>
 /// <returns></returns>
 public Message SetSMS(DataConnection pclsCache, string SendBy, string Reciever, string Content, string piUserId, string piTerminalName, string piTerminalIP, int piDeviceType)
 {
     try
     {
         Message Meg = new Message();
         if (!pclsCache.Connect())
         {
             return null;
         }
         InterSystems.Data.CacheTypes.CacheSysList list = null;
         list = Mb.MessageRecord.SetSMS(pclsCache.CacheConnectionObject, SendBy, Reciever, Content, piUserId, piTerminalName, piTerminalIP, piDeviceType);
         if (list != null)
         {
             Meg.Flag = list[0];
             Meg.SendDateTime = list[1];
             Meg.Time = list[2];
         }
         return Meg;
     }
     catch (Exception ex)
     {
         HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "MessageMethod.SetSMS", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
         return null;
     }
     finally
     {
         pclsCache.DisConnect();
     }           
 }
开发者ID:syfbme,项目名称:CDMISrestful,代码行数:40,代码来源:MessageMethod.cs

示例5: SynBasicInfoDetail

 /// <summary>
 /// 同步患者购买模块下的某些信息 LY 2015-10-14
 /// </summary>
 /// <param name="UserId"></param>
 /// <returns></returns>
 public SynBasicInfo SynBasicInfoDetail(DataConnection pclsCache, string UserId)
 {
     SynBasicInfo ret = new SynBasicInfo();
     ret.ExamInfo = new ClinicInfoMethod().GetNewExam(pclsCache, UserId);
     ret.LabTestInfo = new ClinicInfoMethod().GetNewLabTest(pclsCache, UserId);
     return ret;
 }
开发者ID:wfguanhan,项目名称:CDMISrestful,代码行数:12,代码来源:ModuleInfoRepository.cs

示例6: GetNo

        //GetNo 自动编号 CSQ 20151010
        public string GetNo(DataConnection pclsCache, int NumberingType, string TargetDate)
        {
            string number = "";
            try
            {
                if (!pclsCache.Connect())
                {
                    //MessageBox.Show("Cache数据库连接失败");
                    return number;

                }
                number = Cm.MstNumbering.GetNo(pclsCache.CacheConnectionObject, NumberingType, TargetDate);
                return number;
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.ToString(), "获取编号失败!");
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "CmMstNumbering.GetNo", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return number;
            }
            finally
            {
                pclsCache.DisConnect();
            }
        }
开发者ID:BME319,项目名称:CDMISrestful,代码行数:26,代码来源:CommonMethod.cs

示例7: GetUserInfoByUserId

 /// <summary>
 ///  GetUserInfoByUserId ZAM 2014-12-02 //syf 20151014
 /// </summary>
 /// <param name="pclsCache"></param>
 /// <param name="UserId"></param>
 /// <returns></returns>
 public UserInfoByUserId GetUserInfoByUserId(DataConnection pclsCache, string UserId)
 {
     UserInfoByUserId ret = new UserInfoByUserId();
     try
     {
         if (!pclsCache.Connect())
         {
             return null;
         }
         InterSystems.Data.CacheTypes.CacheSysList list = null;
         list = Cm.MstUser.GetUserInfoByUserId(pclsCache.CacheConnectionObject, UserId);
         if (list != null)
         {
             ret.UserId = list[0];
             ret.UserName = list[1];
             ret.Password = list[2];
             ret.Class = list[3];
             ret.ClassName = list[4];
             ret.StartDate = list[5];
             ret.EndDate = list[6];
         }
         return ret;
     }
     catch (Exception ex)
     {
         //MessageBox.Show(ex.ToString(), "获取名称失败!");
         HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "CmMstUser.GetUserInfoByUserId", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
         return null;
     }
     finally
     {
         pclsCache.DisConnect();
     }
 }
开发者ID:syfbme,项目名称:CDMISrestful,代码行数:40,代码来源:UsersMethod.cs

示例8: GetLatestSMS

 /// <summary>
 /// 获取最新一条消息 GL 2015-10-10
 /// </summary>
 /// <param name="DoctorId"></param>
 /// <param name="PatientId"></param>
 /// <returns></returns>
 public Message GetLatestSMS(DataConnection pclsCache, string DoctorId, string PatientId)
 {
     try
     {
         Message Meg = new Message();
         if (!pclsCache.Connect())
         {
             return null;
         }
         InterSystems.Data.CacheTypes.CacheSysList list = null;
         list = Mb.MessageRecord.GetLatestSMS(pclsCache.CacheConnectionObject, DoctorId, PatientId);
         if (list != null)
         {
             Meg.MessageNo = list[0];
             Meg.Content = list[1];
             Meg.SendDateTime = list[2];
             Meg.SendByName = list[3];
             Meg.Flag = list[4];
         }
         return Meg;
     }
     catch (Exception ex)
     {
         HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "MessageMethod.GetLatestSMS", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
         return null;
     }
     finally
     {
         pclsCache.DisConnect();
     }
 }
开发者ID:wfguanhan,项目名称:CDMISrestful,代码行数:37,代码来源:MessageMethod.cs

示例9: GetLatestVitalSignsByDate

 /// <summary>
 /// 获取患者某项生理参数的RecordDate前的最近一条数据 GL 2015-10-10
 /// </summary>
 /// <param name="UserId"></param>
 /// <param name="ItemType"></param>
 /// <param name="ItemCode"></param>
 /// <param name="RecordDate"></param>
 /// <returns></returns>
 public VitalInfo GetLatestVitalSignsByDate(DataConnection pclsCache,string UserId, string ItemType, string ItemCode, int RecordDate)
 {
     try
     {
         VitalInfo item = new VitalInfo();
         InterSystems.Data.CacheTypes.CacheSysList list = null;
         list = Ps.VitalSigns.GetLatestVitalSignsByDate(pclsCache.CacheConnectionObject, UserId, ItemType, ItemCode, RecordDate);
         if (list != null)
         {
             item.RecordDate = list[0];
             item.RecordTime = list[1];
             item.Value = list[2];
             item.Unit = list[3];
         }
         return item;
     }
     catch (Exception ex)
     {
         HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "VitalInfoMethod.GetLatestSMS", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
         return null;
     }
     finally
     {
         pclsCache.DisConnect();
     }
 }
开发者ID:BME319,项目名称:CDMISrestful,代码行数:34,代码来源:VitalInfoMethod.cs

示例10: LogOn

 public ForToken LogOn(DataConnection pclsCache, string PwType, string userId, string password, string role)
 {
     int result = usersMethod.CheckPasswordByInput(pclsCache, PwType, userId, password);
     ForToken response = new ForToken();
     response.Status = "";
     response.Token = "";
     if (result == 1)
     {
         //密码验证成功
         string UId = usersMethod.GetIDByInput(pclsCache, PwType, userId); //输入手机号获取用户ID
         if (UId != "")
         {
             string Class = usersMethod.GetActivatedState(pclsCache, UId, role);
             if (Class == "0")
             {
                 int flag = 0;
                 List<string> AllRoleMatch = usersMethod.GetAllRoleMatch(pclsCache, UId);
                 if (AllRoleMatch != null)
                 {
                     for (int i = 0; i < AllRoleMatch.Count; i++)
                     {
                         if (AllRoleMatch[i].ToString() == role)//查询条件
                         {
                             flag = 1;
                             break;
                         }
                     }
                 }
                 if (flag == 1)
                 {
                     string ticks = new CommonMethod().GetServerTime(pclsCache);
                     response.Token = SecurityManager.GenerateToken(userId, password, role, ticks);
                     response.Status = "已注册激活且有权限,登陆成功,跳转到主页";
                     return response; //"已注册激活且有权限,登陆成功,跳转到主页"1;
                 }
                 else
                 {
                     response.Status = "已注册激活,但没有权限"; //"已注册激活 但没有权限"2;
                 }
             }
             else      //Class == "1" or Class == ""
             {
                 response.Status = "您的账号对应的角色未激活,需要先激活;界面跳转到游客页面(已注册但未激活)";            //您的账号对应的角色未激活,需要先激活;界面跳转到游客页面(已注册但未激活)3
             }
         }
         else
         {
             response.Status = "用户不存在"; //"用户不存在"4;
         }
     }
     else if (result == 0)
     {
         response.Status = "密码错误"; //"密码错误"5;
     }
     else
     {
         response.Status = "用户不存在";   //"用户不存在"4
     }
     return response;
 }
开发者ID:hsnowman,项目名称:CDMISrestful,代码行数:60,代码来源:UsersRepository.cs

示例11: PsTreatmentIndicatorsSetData

        /// <summary>
        /// Ps.TreatmentIndicators.SetData GL 2015-10-10
        /// </summary>
        /// <param name="UserId"></param>
        /// <param name="SortNo"></param>
        /// <param name="AssessmentType"></param>
        /// <param name="AssessmentName"></param>
        /// <param name="AssessmentTime"></param>
        /// <param name="Result"></param>
        /// <param name="revUserId"></param>
        /// <param name="TerminalName"></param>
        /// <param name="TerminalIP"></param>
        /// <param name="DeviceType"></param>
        /// <returns></returns>
        public int PsTreatmentIndicatorsSetData(DataConnection pclsCache, string UserId, int SortNo, string AssessmentType, string AssessmentName, DateTime AssessmentTime, string Result, string revUserId, string TerminalName, string TerminalIP, int DeviceType)
        {
            int ret = 2;
            try
            {
                if (!pclsCache.Connect())
                {
                    return ret;
                }
                ret = (int)Ps.TreatmentIndicators.SetData(pclsCache.CacheConnectionObject, UserId, SortNo, AssessmentType, AssessmentName, AssessmentTime, Result, revUserId, TerminalName, TerminalIP, DeviceType);
                //if(ret == 1)
                //{
                //    int Ass = 0;
                //    string Amt = "";
                //    Amt = Ps.DoctorInfoDetail.GetValue(pclsCache.CacheConnectionObject, revUserId, "Score", "AssessmentNum", 1);
                //    if(Amt != null)
                //    {
                //        Ass = Convert.ToInt32(Amt);
                //        Ass++;
                //    }
                //    ret = (int)Ps.DoctorInfoDetail.SetData(pclsCache.CacheConnectionObject, revUserId, "Score", "AssessmentNum", 1, Convert.ToString(Ass), "", 1, revUserId, TerminalName, TerminalIP, DeviceType);

                //}
                return ret;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "RiskInfoMethod.SetData", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return 2;
            }
            finally
            {
                pclsCache.DisConnect();
            }
        }
开发者ID:syfbme,项目名称:CDMISrestful,代码行数:49,代码来源:RiskInfoMethod.cs

示例12: GetCompliacneRate

            /// <summary>
            /// 计算某段时间的总依从率 syf 2015-10-10
            /// </summary>
            /// <param name="pclsCache"></param>
            /// <param name="PatientId"></param>
            /// <param name="PlanNo"></param>
            /// <param name="StartDate"></param>
            /// <param name="EndDate"></param>
            /// <returns></returns>
            public string GetCompliacneRate(DataConnection pclsCache, string PatientId, string PlanNo, int StartDate, int EndDate)
            {
                string compliacneRate = "";
                   CacheCommand cmd = null;
                   CacheDataReader cdr = null;

                   try
                   {
                   if (!pclsCache.Connect())
                   {
                       return null;
                   }

                   cmd = new CacheCommand();
                   cmd = Ps.Compliance.GetComplianceListByPeriod(pclsCache.CacheConnectionObject);
                   cmd.Parameters.Add("PatientId", CacheDbType.NVarChar).Value = PatientId;
                   cmd.Parameters.Add("PlanNo", CacheDbType.NVarChar).Value = PlanNo;
                   cmd.Parameters.Add("StartDate", CacheDbType.NVarChar).Value = StartDate;
                   cmd.Parameters.Add("EndDate", CacheDbType.NVarChar).Value = EndDate;

                   cdr = cmd.ExecuteReader();

                   double sum = 0;
                   int count = 0;
                   while (cdr.Read())
                   {
                       sum += Convert.ToDouble(cdr["Compliance"]);
                       count++;
                   }

                   if (count != 0)
                   {
                       compliacneRate = (Math.Round(sum / count, 2, MidpointRounding.AwayFromZero) * 100).ToString(); //保留整数

                   }

                   return compliacneRate;
                   }
                   catch (Exception ex)
                   {
                   HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "PlanInfoMethod.GetCompliacneRate", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                   return null;
                   }
                   finally
                   {
                   if ((cdr != null))
                   {
                       cdr.Close();
                       cdr.Dispose(true);
                       cdr = null;
                   }
                   if ((cmd != null))
                   {
                       cmd.Parameters.Clear();
                       cmd.Dispose();
                       cmd = null;
                   }
                   pclsCache.DisConnect();
                   }
            }
开发者ID:BME319,项目名称:CDMISrestful,代码行数:69,代码来源:PlanInfoMethod.cs

示例13: GetCmMstInfoItem

        //public bool Update(CmMstInfoItem item)
        //{
        //    if (item == null)
        //    {
        //        throw new ArgumentNullException("item");
        //    }
        //    bool ret = SetData(item);
        //    return ret;
        //}

        //public bool AddItem(CmMstInfoItem item)
        //{
        //    if (item == null)
        //    {
        //        throw new ArgumentNullException("item");
        //    }
        //    bool ret = SetData(item);
        //    return ret;
        //}

        #region functions
        private void GetCmMstInfoItem(DataConnection pclsCache, List<CmMstInfoItem> CmMstInfoItemList)
        {
            CacheCommand cmd = null;
            CacheDataReader cdr = null;

            try
            {
                if (!pclsCache.Connect())
                {
                    return;
                }
                //cmd = new CacheCommand();
                cmd = Cm.MstInfoItem.GetInfoItem(pclsCache.CacheConnectionObject);
                cdr = cmd.ExecuteReader();
                while (cdr.Read())
                {
                    CmMstInfoItemList.Add(new CmMstInfoItem
                    {
                        CategoryCode = cdr["CategoryCode"].ToString(),
                                            Code = cdr["Code"].ToString(),
                                            Name = cdr["Name"].ToString(),
                                            ParentCode = cdr["ParentCode"].ToString(),
                                            SortNo = Convert.ToInt32(cdr["SortNo"].ToString()),
                                            StartDate = Convert.ToInt32(cdr["StartDate"].ToString()),
                                            EndDate = Convert.ToInt32(cdr["EndDate"].ToString()),
                                            GroupHeaderFlag = Convert.ToInt32(cdr["GroupHeaderFlag"].ToString()),
                                            ControlType = cdr["ControlType"].ToString(),
                                            OptionCategory = cdr["OptionCategory"].ToString(),
                                            RevUserId = "",
                                            TerminalName ="",
                                            TerminalIP = "",
                                            DeviceType = 0                                       
                    });
                }
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "CmMstInfoItem.GetInfoItem", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return;
            }
            finally
            {

                if ((cdr != null))
                {
                    cdr.Close();
                    cdr.Dispose(true);
                    cdr = null;
                }
                if ((cmd != null))
                {
                    cmd.Parameters.Clear();
                    cmd.Dispose();
                    cmd = null;
                }
                pclsCache.DisConnect();
            }
        }
开发者ID:syfbme,项目名称:CDMISrestful,代码行数:79,代码来源:CmMstInfoItemRepository.cs

示例14: GetAllSignsByPeriod

        //输出一段时间中记录的所有体征信息
        public List<VitalInfo> GetAllSignsByPeriod(DataConnection pclsCache, string UserId, int StartDate, int EndDate)
        {
            {
                List<VitalInfo> items = new List<VitalInfo>();
                CacheCommand cmd = null;
                CacheDataReader cdr = null;
                try
                {
                    if (!pclsCache.Connect())
                    {
                        return null;
                    }
                    cmd = new CacheCommand();
                    cmd = Ps.VitalSigns.GetAllSignsByPeriod(pclsCache.CacheConnectionObject);
                    cmd.Parameters.Add("UserId", CacheDbType.NVarChar).Value = UserId;
                    cmd.Parameters.Add("StartDate", CacheDbType.NVarChar).Value = StartDate;
                    cmd.Parameters.Add("EndDate", CacheDbType.NVarChar).Value = EndDate;

                    cdr = cmd.ExecuteReader();
                    while (cdr.Read())
                    {
                        VitalInfo item = new VitalInfo();
                        item.RecordDate = cdr["RecordDate"].ToString();
                        item.RecordTime = cdr["RecordTime"].ToString();
                        item.ItemType   = cdr["ItemType"].ToString();
                        item.ItemCode   = cdr["ItemCode"].ToString();
                        item.Value      = cdr["Value"].ToString();
                        item.Unit       = cdr["Unit"].ToString();
                        item.Name = cdr["VitalName"].ToString();
                        items.Add(item);
                    }
                    return items;
                }
                catch (Exception ex)
                {
                    HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "VitalInfoMethod.GetAllSignsByPeriod", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                    return null;
                }
                finally
                {
                    if ((cdr != null))
                    {
                        cdr.Close();
                        cdr.Dispose(true);
                        cdr = null;
                    }
                    if ((cmd != null))
                    {
                        cmd.Parameters.Clear();
                        cmd.Dispose();
                        cmd = null;
                    }
                    pclsCache.DisConnect();
                }
            }
        }
开发者ID:wfguanhan,项目名称:CDMISrestful,代码行数:57,代码来源:VitalInfoMethod.cs

示例15: GetLifeStyleDetail

        /// <summary>
        /// 获取生活方式细节 CSQ 20151010
        /// </summary>
        /// <param name="pclsCache"></param>
        /// <param name="Module"></param>
        /// <returns></returns>
        public List<LifeStyleDetail> GetLifeStyleDetail(DataConnection pclsCache, string Module)
        {
            List<LifeStyleDetail> list = new List<LifeStyleDetail>();

            CacheCommand cmd = null;
            CacheDataReader cdr = null;

            try
            {
                if (!pclsCache.Connect())
                {
                    return null;
                }
                cmd = new CacheCommand();
                cmd = Cm.MstLifeStyleDetail.GetLifeStyleDetail(pclsCache.CacheConnectionObject);
                cmd.Parameters.Add("Module", CacheDbType.NVarChar).Value = Module;

                cdr = cmd.ExecuteReader();
                while (cdr.Read())
                {
                    list.Add(new LifeStyleDetail
                    {
                        StyleId = cdr["StyleId"].ToString(),
                        Name = cdr["Name"].ToString(),
                        CurativeEffect = cdr["CurativeEffect"].ToString(),
                        SideEffect = cdr["SideEffect"].ToString(),
                        Instruction = cdr["Instruction"].ToString(),
                        HealthEffect = cdr["HealthEffect"].ToString(),
                        Unit = cdr["Unit"].ToString(),
                    });
                }
                return list;
            }
            catch (Exception ex)
            {
                HygeiaComUtility.WriteClientLog(HygeiaEnum.LogType.ErrorLog, "DictMethod.GetLifeStyleDetail", "数据库操作异常! error information : " + ex.Message + Environment.NewLine + ex.StackTrace);
                return null;
            }
            finally
            {
                if ((cdr != null))
                {
                    cdr.Close();
                    cdr.Dispose(true);
                    cdr = null;
                }
                if ((cmd != null))
                {
                    cmd.Parameters.Clear();
                    cmd.Dispose();
                    cmd = null;
                }
                pclsCache.DisConnect();
            }
        }
开发者ID:syfbme,项目名称:CDMISrestful,代码行数:61,代码来源:DictMethod.cs


注:本文中的CDMISrestful.CommonLibrary.DataConnection类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。