public
int
Add()
... {
int intReturn = -1;
if (this.GetPhsInfo(this.Terminal_No) == null)
...{
intReturn = -1;
}
else
...{
SMS.Agent.AgentPhsNoInfo agent = this.GetPhsInfo(this.Terminal_No);
this.Agent_Code_One = agent.AgentCodeOne;
this.Agent_Code_Two = agent.AgentCodeTwo;
//更新终端号码的值
if (agent.PhsNo == null)
...{
this.Terminal_Phs_No = "";
}
else
...{
this.Terminal_Phs_No=agent.PhsNo;
}
}
OracleConnection connection = new OracleConnection(SMS.DBUtility.OracleHelper.ConnectionString);
connection.Open();
OracleTransaction transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted);
OracleCommand oraCmd = new OracleCommand();
try
...{
string strSqlAddDeduct = "Insert Into ter_phs_deduct_list(Agent_Key,Agent_Code_One,Agent_Code_Two,Terminal_Phs_No,Phs_No," +
"Account_Money,Account_Date,Status,Send_Status,Memo,FormNo,Terminal_No) Values('" + this.Agent_Key + "'," +
"'" + this.Agent_Code_One + "','" + this.Agent_Code_Two + "','" + this.Terminal_Phs_No + "'," +
"'" + this.Phs_No + "','" + this.Account_Money + "',to_date('" + this.Account_Date.ToString() + "','yyyy-mm-dd hh24:mi:ss')," +
"'" + this.Status + "','" + this.Send_Status + "','" + this.Memo + "','" + this.FormNo + "','" + this.Terminal_No + "')";
//对用户终端的可用金额 Account_Money 字段进行更新
string strUpdateMoney = "Update agent_phs_No Set Account_Money=Account_Money - " + this.Account_Money + " Where Terminal_No='" + this.Terminal_No + "'";
oraCmd.Connection = connection;
oraCmd.Transaction = transaction;
oraCmd.CommandText = strSqlAddDeduct;
oraCmd.ExecuteNonQuery();
oraCmd.CommandText = strUpdateMoney;
oraCmd.ExecuteNonQuery();
transaction.Commit();
intReturn = 1;
}
catch(Exception ex)
...{
transaction.Rollback();
connection.Close();
connection.Dispose();
}
finally
...{
transaction.Dispose();
connection.Close();
connection.Dispose();
}
return intReturn;
}
... {
int intReturn = -1;
if (this.GetPhsInfo(this.Terminal_No) == null)
...{
intReturn = -1;
}
else
...{
SMS.Agent.AgentPhsNoInfo agent = this.GetPhsInfo(this.Terminal_No);
this.Agent_Code_One = agent.AgentCodeOne;
this.Agent_Code_Two = agent.AgentCodeTwo;
//更新终端号码的值
if (agent.PhsNo == null)
...{
this.Terminal_Phs_No = "";
}
else
...{
this.Terminal_Phs_No=agent.PhsNo;
}
}
OracleConnection connection = new OracleConnection(SMS.DBUtility.OracleHelper.ConnectionString);
connection.Open();
OracleTransaction transaction = connection.BeginTransaction(IsolationLevel.ReadCommitted);
OracleCommand oraCmd = new OracleCommand();
try
...{
string strSqlAddDeduct = "Insert Into ter_phs_deduct_list(Agent_Key,Agent_Code_One,Agent_Code_Two,Terminal_Phs_No,Phs_No," +
"Account_Money,Account_Date,Status,Send_Status,Memo,FormNo,Terminal_No) Values('" + this.Agent_Key + "'," +
"'" + this.Agent_Code_One + "','" + this.Agent_Code_Two + "','" + this.Terminal_Phs_No + "'," +
"'" + this.Phs_No + "','" + this.Account_Money + "',to_date('" + this.Account_Date.ToString() + "','yyyy-mm-dd hh24:mi:ss')," +
"'" + this.Status + "','" + this.Send_Status + "','" + this.Memo + "','" + this.FormNo + "','" + this.Terminal_No + "')";
//对用户终端的可用金额 Account_Money 字段进行更新
string strUpdateMoney = "Update agent_phs_No Set Account_Money=Account_Money - " + this.Account_Money + " Where Terminal_No='" + this.Terminal_No + "'";
oraCmd.Connection = connection;
oraCmd.Transaction = transaction;
oraCmd.CommandText = strSqlAddDeduct;
oraCmd.ExecuteNonQuery();
oraCmd.CommandText = strUpdateMoney;
oraCmd.ExecuteNonQuery();
transaction.Commit();
intReturn = 1;
}
catch(Exception ex)
...{
transaction.Rollback();
connection.Close();
connection.Dispose();
}
finally
...{
transaction.Dispose();
connection.Close();
connection.Dispose();
}
return intReturn;
}