using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using CoreFS.CA06;
using DbHelp = Core.StlMes.Client.Sale.DbHelp;
using System.Collections;
namespace Core.StlMes.Client.Sale.SaleFundMgt.FundBLL.FundBaseBLL
{
public class FundBaseBLL
{
private OpeBase _ob;
public FundBaseBLL(OpeBase ob)
{
_ob = ob;
}
protected FundDAL.FundPactAccountDAL.FundPactAccountDAL GetFundPactAccountInstance()
{
return new FundDAL.FundPactAccountDAL.FundPactAccountDAL(_ob);
}
protected FundDAL.FundPactAccountDAL.FundPactAccountRelationDAL GetFundPactAccountRelationInstance()
{
return new FundDAL.FundPactAccountDAL.FundPactAccountRelationDAL(_ob);
}
protected FundDAL.FundPactAccountDAL.FundPactUsedDetailDAL GetFundPactUsedDetailInstance()
{
return new FundDAL.FundPactAccountDAL.FundPactUsedDetailDAL(_ob);
}
protected FundDAL.FundPactAccountDAL.FundPactTransDetailDAL GetFundPactTransDetailInstance()
{
return new FundDAL.FundPactAccountDAL.FundPactTransDetailDAL(_ob);
}
protected FundDAL.FundCustAccountDAL.FundCustUsedDetailDAL GetFundCustUsedDetailInstance()
{
return new FundDAL.FundCustAccountDAL.FundCustUsedDetailDAL(_ob);
}
protected FundDAL.FundInOutDAL.FundInOutDAL GetFundInOutInstance()
{
return new FundDAL.FundInOutDAL.FundInOutDAL(_ob);
}
protected FundDAL.FundCustAccountDAL.FundCustAccountDAL GetFundCustAccountInstance()
{
return new FundDAL.FundCustAccountDAL.FundCustAccountDAL(_ob);
}
protected FundDAL.FundSecondLevelAccountDAL.FundSecondlevelAccountDAL GetFundSecondAccountInstance()
{
return new FundDAL.FundSecondLevelAccountDAL.FundSecondlevelAccountDAL(_ob);
}
protected FundDAL.FundSecondLevelAccountDAL.FundSecondUsedDetailDAL GetFundSecondUsedDetailInstance()
{
return new FundDAL.FundSecondLevelAccountDAL.FundSecondUsedDetailDAL(_ob);
}
protected FundDAL.FundUserAndBalanceRelationDAL.FundUserAndBalRelationDAL GetFundUserAndBalRelationInstance()
{
return new FundDAL.FundUserAndBalanceRelationDAL.FundUserAndBalRelationDAL(_ob);
}
protected FundDAL.FundBusiNessInfoDAL.SelFundBusinessinfoDAL GetFundBusinessInfoDAL()
{
return new FundDAL.FundBusiNessInfoDAL.SelFundBusinessinfoDAL(_ob);
}
protected Model.SEL_FUND_TRANS_CUST GetSelFundTranCustModel(string balancesubject, string buyercode, double transmoney)
{
return new Model.SEL_FUND_TRANS_CUST(balancesubject,buyercode,transmoney);
}
protected Model.SEL_FUND_TRANS_SECONDACCOUNT GetSelFundTransSecondAccount(string balancesubject, string buyercode, string secondAccount, double transmoney)
{
Model.SEL_FUND_TRANS_CUST cust = GetSelFundTranCustModel(balancesubject,buyercode,transmoney);
return new Model.SEL_FUND_TRANS_SECONDACCOUNT(cust,secondAccount,transmoney);
}
public Model.SEL_FUND_TRANS_PACT GetSelFundTransPact(string balancesubject, string buyercode, string secondAccount, string pactno, double transmoney)
{
return new Model.SEL_FUND_TRANS_PACT
(GetSelFundTransSecondAccount(balancesubject,buyercode,secondAccount,transmoney),pactno,transmoney);
}
protected Model.SEL_FUND_PACT_ACCOUNT GetFundPactAccount(string balansub, string buyercode, string secondeaccount, string pactno)
{
Model.SEL_FUND_PACT_ACCOUNT acct = new Model.SEL_FUND_PACT_ACCOUNT();
acct.BALANCESUBJECT = balansub;
acct.BUYERCODE = buyercode;
acct.SECONDACCOUNT = secondeaccount;
acct.PACTNO = pactno;
acct.PACT_BEGINDATE = Util.DateTimeUtil.GetSystemDate();
acct.IMPORTTIME = Util.DateTimeUtil.GetSystemDate();
acct.IMPORTOR = "";
acct.PACT_BEGINDATE = Util.DateTimeUtil.GetSystemDate();
return acct;
}
///
/// 获取事务管理实例类
///
///
protected DbHelp.DbTransaction GetTransaction()
{
return new Core.StlMes.Client.Sale.DbHelp.DbTransaction(this._ob);
}
public DataSet ExecuteReader(string sql)
{
Core.StlMes.Client.Sale.DbHelp.DbExecute dbExecute
= new Core.StlMes.Client.Sale.DbHelp.DbExecute(this._ob);
return dbExecute.ExecuteQuery(sql);
}
public void ExecuteNoReader(ArrayList sqlList,out string errMsg)
{
string gurid = System.Guid.NewGuid().ToString();
errMsg = "";
Core.StlMes.Client.Sale.DbHelp.DbExecute dbExecute
= new Core.StlMes.Client.Sale.DbHelp.DbExecute(this._ob);
if (sqlList == null || sqlList.Count == 0)
return;
StringBuilder sblist = new StringBuilder();
foreach (string s in sqlList)
{
sblist.Append(s).Append(" ;");
}
StringBuilder sb = new StringBuilder();
sb.Append("declare str varchar2(1000); ");
sb.Append(" begin ");
sb.Append(sblist.ToString());
sb.Append(" commit; ");
sb.Append(string.Format(" exception when others then rollback; str := substr(sqlerrm,1,100); insert into slm_pro_execute_result(id_,exresult,eresult) select '{0}',-1,substr(str,1,200) from dual; delete from slm_pro_execute_result where indate < sysdate - 600/86400; commit; ", gurid));
sb.Append(" end ;");
string sql = sb.ToString();
dbExecute.ExecuteNoQuery(sql);
string sqlresutl = string.Format(" select id_,exresult,eresult from slm_pro_execute_result where id_= '{0}' and exresult = -1", gurid);
try
{
DataSet ds = dbExecute.ExecuteQuery(sqlresutl);
if (ds == null || ds.Tables.Count == 0 || ds.Tables[0].Rows.Count == 0)
{
}
else
{
foreach (DataRow dr in ds.Tables[0].Rows)
{
errMsg = dr["ERESULT"].ToString();
break;
}
}
}
catch
{ }
}
protected string _errMsgMoneyNotEnough = "资金不足";
protected string _errDefaultMsg = "异常错误";
}
}