Пример #1
0
        /// <summary>
        ///  常用联系人门诊卡解绑
        /// </summary>
        /// <param name="openid">用户标识</param>
        /// <param name="linkmanid">联系人ID</param>
        /// <returns>0-成功  大于0-失败   小于0-异常</returns>
        public int DB_FavoriteContactsrmzkRelieveBindStr(string openid, string linkmanid, out PatientInfo paintentInfo, out string msg)
        {
            msg = "";

            OracleConnection connection = new OracleConnection(WebConfigParameter.ConnectionHisString);

            if (connection.State != ConnectionState.Open)
            {
                connection.Open();
            }
            OracleDataReader dr = null;

            OracleCommand cmd = new OracleCommand();

            cmd.Connection = connection;
            OracleTransaction tx = connection.BeginTransaction();

            cmd.Transaction = tx;

            int ret = -1;

            paintentInfo = new PatientInfo();
            try
            {
                bool   _flag    = false;
                string findText = _builder.GetLinkmanCardNoFromIDSql(openid, linkmanid, out _flag, out msg);
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, findText);

                if (!_flag)
                {
                    ret = 10;
                    return(ret);
                }
                cmd.CommandText = findText;
                dr = cmd.ExecuteReader();

                if (dr.Read())
                {
                    paintentInfo.bkhm = !dr.IsDBNull(0) ? dr.GetString(0) : "";
                }
                else
                {
                    msg = "医院端未找到,请核对信息后重试";
                    ret = 10;
                    dr.Close();
                    tx.Commit();
                    return(ret);
                }

                string updateText = _builder.GetFavoriteContactsrmzkRelieveBindSql(openid, linkmanid, out _flag, out msg);
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, updateText);

                if (!_flag)
                {
                    ret = 10;
                    return(ret);
                }
                cmd.CommandText = updateText;
                ret             = cmd.ExecuteNonQuery();
                if (ret == 1)
                {
                    ret = 0;
                }
                else
                {
                    ret = 12;
                    msg = "解绑更新异常!";
                    tx.Rollback();
                }

                dr.Close();
                tx.Commit();
                return(ret);
            }
            catch (Exception ex)
            {
                UtilLog.GetInstance().WriteProgramLog(System.Reflection.MethodBase.GetCurrentMethod().Name, ex);
                msg = GetExceptionInfo(ex);
                ret = -1;
                tx.Rollback();
                return(ret);
            }
            finally
            {
                if (null != dr)
                {
                    dr.Close();
                }
                connection.Close();
            }
        }