public bool QueueToRegister(string appointsId, string enrolDoctor)
{
using (OleDbConnection conn = new OleDbConnection(DBHelper.Instance.ConnectionStr))
{
conn.Open();
OleDbCommand cmd = conn.CreateCommand();
try
{
//插入号源属性
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "PROC_APPOINTTOENROL";
cmd.Parameters.Add("@p_APPOINTSID", OleDbType.VarChar).Value = appointsId;
cmd.Parameters.Add("@p_ENROLDOCTOR", OleDbType.VarChar).Value = enrolDoctor;
cmd.Parameters.Add("@p_IsUseCallCode", OleDbType.VarChar).Value = PubVariable.Instance.IsUseCallCode;
cmd.Parameters.Add("@p_AreaName", OleDbType.VarChar).Value = PubVariable.Instance.AreaName;
cmd.Parameters.Add("@p_result", OleDbType.Integer).Value = -1;
cmd.Parameters["@p_result"].Direction = ParameterDirection.InputOutput;
if (cmd.ExecuteNonQuery() > 0)
{
var aa = cmd.Parameters["@p_result"].Value.ToString();
return true;
}
}
catch { return false; }
finally
{
if (conn.State != ConnectionState.Closed) conn.Close();
}
}
return false;
}
using (OleDbConnection conn = new OleDbConnection(str))
{
OleDbTransaction tran = null;
conn.Open();
OleDbCommand cmd = conn.CreateCommand();
tran = conn.BeginTransaction(IsolationLevel.ReadCommitted);
cmd.Transaction = tran;
try
{
//插入号源属性
cmd.CommandType = CommandType.StoredProcedure;
cmd.CommandText = "PROC_APPOINTTOENROL";
cmd.Parameters.Add("@p_APPOINTSID", OleDbType.VarChar).Value = appointsId;
cmd.Parameters.Add("@p_ENROLDOCTOR", OleDbType.VarChar).Value = enrolDoctor;
cmd.Parameters.Add("@p_IsUseCallCode", OleDbType.VarChar).Value = isUseCallCode;
cmd.Parameters.Add("@p_AreaName", OleDbType.VarChar).Value = areaName;
cmd.Parameters.Add("@p_result", OleDbType.Integer).Value = -1;
cmd.Parameters["@p_result"].Direction = ParameterDirection.InputOutput;
if (cmd.ExecuteNonQuery() > 0)
{
string result = cmd.Parameters["@p_result"].Value.ToString();
log.WriteLogs("QueueToRegister return p_result:", "返回结果:", result);
if (result.Trim() != "1") return false;
tran.Commit();
log.WriteLogs("执行QueueToRegister:", "执行成功", ofdepart);
return true;
}
}
catch (Exception ex)
{
tran.Rollback();
log.WriteLogs("执行QueueToRegister:", "异常", ex.ToString());
return false;
}
finally
{
if (conn.State != ConnectionState.Closed) conn.Close();
}
}