TG.WXCRM.V4/DAL/Csvr/CALLDATAREPORT_DAL.cs

66 lines
3.4 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using System.Data.OracleClient;
using WX.CRM.Common;
using WX.CRM.Model.MAP;
namespace WX.CRM.DAL.Csvr
{
public class CALLDATAREPORT_DAL
{
public DataSet GetCallReport(ref Pager pager, QueryUserComboDto usercomboDto, DateTime? V_STIME, DateTime? V_ETIME)
{
OracleConnection conn = new OracleConnection(OracleHelper.AYCRMConn);
if (conn.State == ConnectionState.Closed)
conn.Open();
try
{
using (OracleTransaction trans = conn.BeginTransaction())
{
var p = new List<OracleParameter> {
usercomboDto.companyId.HasValue ? new OracleParameter{ ParameterName="V_COMPANYID", OracleType = OracleType.Number, Value=usercomboDto.companyId.Value } : new OracleParameter{ ParameterName="V_COMPANYID", OracleType = OracleType.Number, Value=DBNull.Value },
string.IsNullOrEmpty(usercomboDto.deptId) ? new OracleParameter{ ParameterName="V_DEPTID", OracleType = OracleType.VarChar,Value=DBNull.Value } : new OracleParameter{ ParameterName="V_DEPTID", OracleType = OracleType.VarChar,Value=usercomboDto.deptId },
string.IsNullOrEmpty(usercomboDto.groupIds) ? new OracleParameter{ ParameterName="V_GROUPID", OracleType = OracleType.VarChar,Value=DBNull.Value } : new OracleParameter{ ParameterName="V_GROUPID", OracleType = OracleType.VarChar,Value=usercomboDto.groupIds },
usercomboDto.userId.HasValue ? new OracleParameter{ ParameterName="V_USERID", OracleType = OracleType.VarChar,Value=usercomboDto.userId.Value } : new OracleParameter{ ParameterName="V_USERID", OracleType = OracleType.Number,Value=DBNull.Value },
new OracleParameter{ ParameterName="V_STIME", OracleType = OracleType.DateTime,Value=V_STIME },
new OracleParameter{ ParameterName="V_ETIME", OracleType = OracleType.DateTime, Value=V_ETIME },
new OracleParameter{ParameterName="p_sqlData",OracleType=OracleType.Cursor,Direction = ParameterDirection.Output}
};
var ds = OracleHelper.DataQueray(trans, CommandType.StoredProcedure, "PACK_CSVR.CSVR_CALLREPORTQUERY", p.ToArray());
trans.Commit();
if (null != ds && ds.Tables[0].Rows.Count > 0)
pager.totalRows = ds.Tables[0].Rows.Count;
return ds;
}
}
catch { throw; }
finally { conn.Close(); }
}
public DataSet Get_WD_CallReport()
{
OracleConnection conn = new OracleConnection(OracleHelper.AYCRMConn);
if (conn.State == ConnectionState.Closed)
conn.Open();
try
{
using (OracleTransaction trans = conn.BeginTransaction())
{
OracleParameter[] p = new[] {
new OracleParameter{ParameterName="p_sqlData",OracleType=OracleType.Cursor,Direction = ParameterDirection.Output}
};
var ds = OracleHelper.DataQueray(trans, CommandType.StoredProcedure, "PACK_CSVR.CSVR_WD_CALLREPORTQUERY", p);
trans.Commit();
return ds;
}
}
catch { throw; }
finally { conn.Close(); }
}
}
}