using Ninject; using System; using System.Collections.Generic; using System.Data; using System.ServiceModel; using System.ServiceModel.Web; using WX.CRM.Common; using WX.CRM.IBLL.Csvr; using WX.CRM.IBLL.Soft; using WX.CRM.IBLL.Util; using WX.CRM.Model.MAP; using WX.CRM.WebHelper.Infrastructure; namespace WxService { //[ServiceContract(Namespace = "")] //[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)] public class WxOrderSvr : IWxOrderSvr { //private readonly string _zxUrl = Utility.GetSettingByKey("ZxRegisterUrl"); //private readonly string _zxPassword = Utility.GetSettingByKey("ZxPassword"); //private readonly string _zxFrom = Utility.GetSettingByKey("ZxFrom"); //private readonly string _zxTeam = Utility.GetSettingByKey("ZxTeam"); private ISecurityHelper sHelper = NinjectControllerFactory.ninjectKernel.Get(); private ISOFT_USER_Q _soft_user_Q = NinjectControllerFactory.ninjectKernel.Get(); //private IISVR_INTERFACECALLLOG logHelper = NinjectControllerFactory.ninjectKernel.Get(); //private IRES_CUSTOMER_Q res_Customer_Q_BL = NinjectControllerFactory.ninjectKernel.Get(); //private IRES_CUSTOMER res_Customer_BL = NinjectControllerFactory.ninjectKernel.Get(); //private IWX_SZZYORDER wx_SzzyOrder_BL = NinjectControllerFactory.ninjectKernel.Get(); //private IWX_SZZYPRODUCT wx_SzzyProduct_BL = NinjectControllerFactory.ninjectKernel.Get(); //private IWX_SZZYSUBPRODUCT wx_SzzySubProduct_BL = NinjectControllerFactory.ninjectKernel.Get(); //private IRES_CUSTOMERDETAIL res_CustomerDetail_BL = NinjectControllerFactory.ninjectKernel.Get(); private string clientKey = WX.CRM.Common.Utility.GetSettingByKey("CRMClientKey"); private ICSVR_CALLRECORD _CSVR_CALLRECORD_BL = NinjectControllerFactory.ninjectKernel.Get(); public JsonResult> GetCallRecord(int page, string resId, string recordId = null) { //var customer = _customerQ.getResCustomerByResId(resId); //if (customer == null) // return new JsonResult> { result = false, retcode = (int)EnumInterfaceErrcode.参数错误, retmsg = null }; //var customerId = customer.CUSTOMERID; //var ds = _rcontact.GetChatUserByResId(customerId); //return new JsonResult> { result = true, retcode = (int)EnumInterfaceErrcode.调用成功, retmsg = ds.ToList() }; Pager pg = new Pager() { page = page, rows = 20 }; var ds = _CSVR_CALLRECORD_BL.GetCallRecord(ref pg, new QueryUserComboDto() { }, null, null, null, null, resId, recordId, -1, -1); var list = ds.Tables[0]; var data = new List(); foreach (DataRow item in list.Rows) { var info = new CallRecordView(); info.recordid = Convert.ToDecimal(item["recordid"]); info.RESID = item["RESID"].ToString(); var strIsTran = ""; if (item["ISTRAN"].ToString() == "1") { strIsTran = "(转接)"; } if (item["CALLTYPE"].ToString() == "1")//呼出 { info.CALLTYPE = "呼出" + strIsTran; info.SERVICENUMBER = item["SERVICENUMBER"].ToString();//主叫 info.TELNUMBERLAST4 = item["TELNUMBERLAST4"].ToString();//被叫 } else { info.CALLTYPE = "呼入" + strIsTran; info.SERVICENUMBER = item["TELNUMBERLAST4"].ToString();//被叫 info.TELNUMBERLAST4 = item["SERVICENUMBER"].ToString();//主叫 } info.TIMELENGTH = Convert.ToInt32(item["TIMELENGTH"]); info.TIMESTART = Convert.ToDateTime(item["TIMESTART"]); info.TIMEEND = Convert.ToDateTime(item["TIMEEND"]); info.SALESEID = item["UNAME"].ToString() + "-" + item["SALESEID"].ToString(); info.FileName = item["FileName"].ToString(); data.Add(info); } return new JsonResult> { result = true, retcode = pg.totalRows, retmsg = data }; } public JsonResult> GetSoftRpt(DateTime stime, DateTime etime) { var list = _soft_user_Q.Soft_Rpt_Get(stime, etime); return new JsonResult> { result = true, retcode = 200, retmsg = list }; } } [ServiceContract] public interface IWxOrderSvr { [OperationContract] [WebInvoke(Method = "*", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "CallRecord/Get?page={page}&resid={resid}&recordId={recordId}")] JsonResult> GetCallRecord(int page, string resId, string recordId = null); [OperationContract] [WebInvoke(Method = "*", ResponseFormat = WebMessageFormat.Json, BodyStyle = WebMessageBodyStyle.Bare, UriTemplate = "SoftRpt/Get?stime={stime}&etime={etime}")] JsonResult> GetSoftRpt(DateTime stime, DateTime etime); } public class CallRecordView { public decimal? recordid { get; set; } public string RESID { get; set; } public string CALLTYPE { get; set; } public string SERVICENUMBER { get; set; } public string TELNUMBERLAST4 { get; set; } public decimal? TIMELENGTH { get; set; } public DateTime? TIMESTART { get; set; } public DateTime? TIMEEND { get; set; } public string SALESEID { get; set; } public string FileName { get; set; } } //public class SoftRptListView //{ // public string ch { get; set; } // public decimal registernumber { get; set; } // public decimal resourcenumber { get; set; } // public string resourcerate { get; set; } // public decimal recordcount { get; set; } // public string recordcountrate { get; set; } // public decimal recordnumber { get; set; } // public string recordrate { get; set; } // public decimal firstcallnumber { get; set; } // public decimal secondcallnumber { get; set; } // public decimal allordernumber { get; set; } // public string allorderrate { get; set; } // public decimal allorderprice { get; set; } //} }