public static DataTable GetOperatorReport(DateTime startDate, DateTime endDate, int channleId, int clientChannleId, string mprovince, string moperator)
        {
            DataTable dt = new DataTable("DS");

            dt.Columns.Add("Operator");
            dt.Columns.Add("Province");
            dt.Columns.Add("Channel");
            dt.Columns.Add("Mo");
            dt.Columns.Add("RecordCount", typeof(int));
            dt.AcceptChanges();

            DataTable dtReportQuery = businessProxy.GetOperatorReport(startDate, endDate, channleId, clientChannleId, null, mprovince, moperator);

            List <ReportDataOperatorItem> reportDataProvinceItems = new List <ReportDataOperatorItem>();

            foreach (DataRow dr in dtReportQuery.Rows)
            {
                SPChannelWrapper channel = SPChannelWrapper.FindById((int)dr["ChannelID"]);
                SPClientChannelSettingWrapper channelSettingWrapper = SPClientChannelSettingWrapper.FindById((int)dr["ChannleClientID"]);

                string channelName = channel.Name;
                string moCode      = channelSettingWrapper.MoCode;
                int    recordCount = (int)dr["RecordCount"];
                string province    = dr["Province"].ToString();

                ReportDataOperatorItem reportDataProvinceItem = new ReportDataOperatorItem();
                reportDataProvinceItem.ChannelName = channelName.ToLower();
                reportDataProvinceItem.CodeName    = moCode.ToLower();
                if (string.IsNullOrEmpty(province))
                {
                    reportDataProvinceItem.Province = "未知省份";
                }
                else
                {
                    if (string.IsNullOrEmpty(province.Trim()))
                    {
                        reportDataProvinceItem.Province = "未知省份";
                    }
                    else
                    {
                        reportDataProvinceItem.Province = province.ToLower();
                    }
                }

                reportDataProvinceItem.RecordCount = recordCount;
                reportDataProvinceItem.Mo          = channelSettingWrapper.CommandCode.ToLower();
                if (channelSettingWrapper.ChannelCode == null)
                {
                    reportDataProvinceItem.SPCode = "";
                }
                else
                {
                    reportDataProvinceItem.SPCode = channelSettingWrapper.ChannelCode.ToLower();
                }


                if (channelSettingWrapper.CommandType == "1")
                {
                    reportDataProvinceItem.MoType = "1";
                }
                else if (channelSettingWrapper.CommandType == "2" || channelSettingWrapper.CommandType == "3" || channelSettingWrapper.CommandType == "4")
                {
                    reportDataProvinceItem.MoType = "2";
                }
                else
                {
                    reportDataProvinceItem.MoType = "0";
                }

                reportDataProvinceItem.MoLength     = reportDataProvinceItem.Mo.Length;
                reportDataProvinceItem.OperatorType = dr["Operator"].ToString();
                reportDataProvinceItems.Add(reportDataProvinceItem);
            }



            List <ReportDataOperatorItem> orderedItems = (from rap in reportDataProvinceItems
                                                          orderby rap.OperatorType, rap.Province, rap.ChannelName, rap.MoType, rap.Mo, rap.SPCode, rap.MoLength
                                                          select rap).ToList();

            List <ReportDataOperatorItem> groupItems = new List <ReportDataOperatorItem>();

            foreach (ReportDataOperatorItem oItem in orderedItems)
            {
                ReportDataOperatorItem item =
                    groupItems.Find(
                        p =>
                        (p.OperatorType == oItem.OperatorType && p.ChannelName == oItem.ChannelName &&
                         p.Province == oItem.Province && p.CodeName == oItem.CodeName));

                if (item != null)
                {
                    item.RecordCount = oItem.RecordCount + item.RecordCount;
                }
                else
                {
                    if (oItem.MoType == "2")
                    {
                        ReportDataOperatorItem mitem = (from rap in groupItems
                                                        where
                                                        (rap.OperatorType == oItem.OperatorType && rap.ChannelName == oItem.ChannelName &&
                                                         rap.Province == oItem.Province && rap.SPCode == oItem.SPCode &&
                                                         !oItem.Mo.Equals(rap.Mo) && oItem.Mo.Contains(rap.Mo))
                                                        orderby rap.MoLength
                                                        select rap).FirstOrDefault();

                        bool hasMain = (mitem != null);

                        if (hasMain)
                        {
                            mitem.RecordCount = oItem.RecordCount + mitem.RecordCount;

                            continue;
                        }
                    }

                    var addItem = oItem.Copy();

                    groupItems.Add(addItem);
                }
            }

            foreach (ReportDataOperatorItem groupItem in groupItems)
            {
                dt.Rows.Add(groupItem.OperatorType, groupItem.Province, groupItem.ChannelName, groupItem.CodeName,
                            groupItem.RecordCount);
            }



            dt.AcceptChanges();

            return(dt);
        }
Exemplo n.º 2
0
 public static List <SPClientChannelSettingWrapper> FindAllByOrderByAndFilterAndChannelIDAndCodeAndPort(string sortFieldName, bool isDesc, int channleId, string mo, string port, int pageIndex, int pageSize, out int recordCount)
 {
     return(SPClientChannelSettingWrapper.ConvertToWrapperList(businessProxy.FindAllByOrderByAndFilterAndChannelIDAndCodeAndPort(sortFieldName, isDesc, channleId, mo, port, pageIndex, pageSize, out recordCount)));
 }
        public static DataTable GetProvinceReportForClientGroup(DateTime startDate, DateTime endDate, int clientGroupID, int channleClientID)
        {
            DataTable dt = new DataTable("DS");

            dt.Columns.Add("ClientGroupName");
            dt.Columns.Add("ChannelID");
            dt.Columns.Add("CodeName");
            dt.Columns.Add("ChannelClentID");
            dt.Columns.Add("Province");
            dt.Columns.Add("RecordCount", typeof(int));
            dt.AcceptChanges();

            DataTable dtReportQuery = businessProxy.GetProvinceReportForClientGroup(startDate, endDate, clientGroupID, channleClientID, false);

            List <ReportDataProvinceItem> reportDataProvinceItems = new List <ReportDataProvinceItem>();

            foreach (DataRow dr in dtReportQuery.Rows)
            {
                SPClientGroupWrapper          clientGroup           = SPClientGroupWrapper.FindById((int)dr["ClientGroupID"]);
                SPClientChannelSettingWrapper channelSettingWrapper = SPClientChannelSettingWrapper.FindById((int)dr["ChannleClientID"]);

                string channelName = clientGroup.Name;
                string moCode      = channelSettingWrapper.ParentClientChannelSetting.MoCode;
                string province    = dr["Province"].ToString();
                int    recordCount = (int)dr["RecordCount"];

                ReportDataProvinceItem reportDataProvinceItem = new ReportDataProvinceItem();
                reportDataProvinceItem.ChannelName = channelName.ToLower();
                reportDataProvinceItem.ChannelID   = clientGroup.Id;
                reportDataProvinceItem.CodeID      = channelSettingWrapper.Id;
                reportDataProvinceItem.CodeName    = moCode.ToLower();
                if (string.IsNullOrEmpty(province))
                {
                    reportDataProvinceItem.Province = "未知省份";
                }
                else
                {
                    if (string.IsNullOrEmpty(province.Trim()))
                    {
                        reportDataProvinceItem.Province = "未知省份";
                    }
                    else
                    {
                        reportDataProvinceItem.Province = province.ToLower();
                    }
                }

                reportDataProvinceItem.RecordCount = recordCount;
                reportDataProvinceItem.Mo          = channelSettingWrapper.CommandCode.ToLower();
                if (channelSettingWrapper.ChannelCode == null)
                {
                    reportDataProvinceItem.SPCode = "";
                }
                else
                {
                    reportDataProvinceItem.SPCode = channelSettingWrapper.ChannelCode.ToLower();
                }


                if (channelSettingWrapper.CommandType == "1")
                {
                    reportDataProvinceItem.MoType = "1";
                }
                else if (channelSettingWrapper.CommandType == "2" || channelSettingWrapper.CommandType == "3" || channelSettingWrapper.CommandType == "4")
                {
                    reportDataProvinceItem.MoType = "2";
                }
                else
                {
                    reportDataProvinceItem.MoType = "0";
                }

                reportDataProvinceItem.MoLength = reportDataProvinceItem.Mo.Length;

                reportDataProvinceItems.Add(reportDataProvinceItem);
            }



            foreach (ReportDataProvinceItem groupItem in reportDataProvinceItems)
            {
                AddNewProvinceReportRow1(dt, groupItem.ChannelName, groupItem.CodeName, groupItem.Province, groupItem.RecordCount, groupItem.ChannelID, groupItem.CodeID);
            }

            return(dt);
        }
Exemplo n.º 4
0
 public static void Delete(SPClientChannelSettingWrapper instance)
 {
     businessProxy.Delete(instance.entity);
 }
Exemplo n.º 5
0
 public static void Refresh(SPClientChannelSettingWrapper instance)
 {
     businessProxy.Refresh(instance.entity);
 }
Exemplo n.º 6
0
 public static void SaveOrUpdate(SPClientChannelSettingWrapper obj)
 {
     businessProxy.SaveOrUpdate(obj.entity);
 }
Exemplo n.º 7
0
 public static List <SPClientChannelSettingWrapper> GetSettingByChannel(SPChannelWrapper spChannelWrapper)
 {
     return(SPClientChannelSettingWrapper.ConvertToWrapperList(businessProxy.GetSettingByChannel(spChannelWrapper.entity)));
 }
Exemplo n.º 8
0
 public static List <SPClientChannelSycnParamsWrapper> FindAllByOrderByAndFilterAndClientChannelSettingID(string orderByColumnName, bool isDesc, int pageIndex, int pageSize, SPClientChannelSettingWrapper clientChannelSettingID, out int recordCount)
 {
     return(ConvertToWrapperList(businessProxy.FindAllByOrderByAndFilterAndClientChannelSettingID(orderByColumnName, isDesc, pageIndex, pageSize, clientChannelSettingID.entity, out recordCount)));
 }
Exemplo n.º 9
0
 public static List <SPClientChannelSycnParamsWrapper> FindAllByClientChannelSettingID(SPClientChannelSettingWrapper clientChannelSettingID)
 {
     return(ConvertToWrapperList(businessProxy.FindAllByClientChannelSettingID(clientChannelSettingID.entity)));
 }
Exemplo n.º 10
0
        public static DataTable GetProvinceReport(DateTime startDate, DateTime endDate, int channelID,
                                                  int channleClientID)
        {
            DataTable dt = new DataTable("DS");

            dt.Columns.Add("ChannelName");
            dt.Columns.Add("CodeName");
            dt.Columns.Add("Province");
            dt.Columns.Add("RecordCount", typeof(int));
            dt.AcceptChanges();

            DataTable dtReportQuery = businessProxy.GetProvinceReport(startDate, endDate, channelID, channleClientID,
                                                                      null);

            List <ReportDataProvinceItem> reportDataProvinceItems = new List <ReportDataProvinceItem>();

            foreach (DataRow dr in dtReportQuery.Rows)
            {
                SPChannelWrapper channel = SPChannelWrapper.FindById((int)dr["ChannelID"]);
                SPClientChannelSettingWrapper channelSettingWrapper =
                    SPClientChannelSettingWrapper.FindById((int)dr["ChannleClientID"]);

                string channelName = channel.Name;
                string moCode      = channelSettingWrapper.ParentClientChannelSetting.MoCode;
                string province    = dr["Province"].ToString();
                int    recordCount = (int)dr["RecordCount"];

                ReportDataProvinceItem reportDataProvinceItem = new ReportDataProvinceItem();
                reportDataProvinceItem.ChannelName = channelName.ToLower();
                reportDataProvinceItem.CodeName    = moCode.ToLower();
                if (string.IsNullOrEmpty(province))
                {
                    reportDataProvinceItem.Province = "未知省份";
                }
                else
                {
                    if (string.IsNullOrEmpty(province.Trim()))
                    {
                        reportDataProvinceItem.Province = "未知省份";
                    }
                    else
                    {
                        reportDataProvinceItem.Province = province.ToLower();
                    }
                }

                reportDataProvinceItem.RecordCount = recordCount;
                reportDataProvinceItem.Mo          = channelSettingWrapper.CommandCode.ToLower();
                if (channelSettingWrapper.ChannelCode == null)
                {
                    reportDataProvinceItem.SPCode = "";
                }
                else
                {
                    reportDataProvinceItem.SPCode = channelSettingWrapper.ChannelCode.ToLower();
                }


                if (channelSettingWrapper.CommandType == "1")
                {
                    reportDataProvinceItem.MoType = "1";
                }
                else if (channelSettingWrapper.CommandType == "2" || channelSettingWrapper.CommandType == "3" ||
                         channelSettingWrapper.CommandType == "4")
                {
                    reportDataProvinceItem.MoType = "2";
                }
                else
                {
                    reportDataProvinceItem.MoType = "0";
                }

                reportDataProvinceItem.MoLength = reportDataProvinceItem.Mo.Length;

                reportDataProvinceItems.Add(reportDataProvinceItem);
            }


            //List<ReportDataProvinceItem> orderedItems = (from rap in reportDataProvinceItems
            //                                             orderby rap.ChannelName, rap.MoType, rap.Mo, rap.SPCode, rap.Province, rap.MoLength
            //              select rap).ToList();

            //List<ReportDataProvinceItem> groupItems = new List<ReportDataProvinceItem>();

            //foreach (ReportDataProvinceItem oItem in orderedItems)
            //{
            //    ReportDataProvinceItem item =
            //        groupItems.Find(
            //            p =>
            //            (p.ChannelName == oItem.ChannelName && p.CodeName == oItem.CodeName &&
            //             p.Province == oItem.Province));

            //    if (item!=null)
            //    {
            //        item.RecordCount = oItem.RecordCount + item.RecordCount;
            //    }
            //    else
            //    {
            //        if (oItem.MoType == "2")
            //        {
            //            //ReportDataProvinceItem mitem = (from rap in groupItems
            //            //     where
            //            //         (rap.ChannelName == oItem.ChannelName && rap.SPCode == oItem.SPCode &&
            //            //          !oItem.Mo.Equals(rap.Mo) && oItem.Mo.Contains(rap.Mo))
            //            //     orderby rap.MoLength
            //            //     select rap).FirstOrDefault();

            //            //bool hasMain = (mitem != null);

            //            //if(hasMain)
            //            //{
            //            //    ReportDataProvinceItem mi = groupItems.Find(p => (p.ChannelName == oItem.ChannelName && p.SPCode == oItem.SPCode && oItem.Mo.Contains(p.Mo) && p.Province == oItem.Province));

            //            //    if(mi!=null)
            //            //    {
            //            //        mi.RecordCount = oItem.RecordCount + mi.RecordCount;
            //            //    }
            //            //    else
            //            //    {
            //                    var maitem = oItem.Copy();
            //                    maitem.CodeName = oItem.CodeName;
            //                    maitem.Mo = oItem.Mo;
            //                    maitem.MoLength = oItem.MoLength;
            //                    maitem.Province = oItem.Province;
            //                    //if (string.IsNullOrEmpty(maitem.Province.Trim()))
            //                    //    throw new Exception("11111");

            //                    groupItems.Add(maitem);
            //            //    }

            //            //    continue;
            //            //}
            //        }

            //        var addItem = oItem.Copy();

            //        if (string.IsNullOrEmpty(addItem.Province.Trim()))
            //            throw new Exception("11111");

            //        groupItems.Add(addItem);
            //        //if (oItem.MoType == "2")
            //        //{
            //        //    DataRow dr = FindMainItemInDataTable(dt, oItem);

            //        //    if(dr!=null)
            //        //    {
            //        //        dr.BeginEdit();
            //        //        dr["RecordCount"] = oItem.RecordCount + (int)dr["RecordCount"];
            //        //        dr.EndEdit();
            //        //        dt.AcceptChanges();
            //        //    }
            //        //    else
            //        //    {
            //        //        AddNewProvinceReportRow(dt, oItem.ChannelName, oItem.CodeName, oItem.Province, oItem.RecordCount);
            //        //    }
            //        //}
            //        //else
            //        //{
            //        //    AddNewProvinceReportRow(dt, oItem.ChannelName, oItem.CodeName, oItem.Province, oItem.RecordCount);
            //        //}
            //    }

            //}

            foreach (ReportDataProvinceItem groupItem in reportDataProvinceItems)
            {
                AddNewProvinceReportRow(dt, groupItem.ChannelName, groupItem.CodeName, groupItem.Province,
                                        groupItem.RecordCount);
            }

            return(dt);
        }
        public void ReAutoMatch()
        {
            PhoneAreaInfo phoneAreaInfo = null;

#if DEBUG
            if (!string.IsNullOrEmpty(this.MobileNumber) && this.MobileNumber.Length > 7)
            {
                try
                {
                    phoneAreaInfo = SPPhoneAreaWrapper.GetPhoneCity(this.MobileNumber.Substring(0, 7));
                }
                catch (Exception ex)
                {
                    Logger.Error(ex.Message);
                }
            }
#else
            if (!string.IsNullOrEmpty(this.MobileNumber) && this.MobileNumber.Length > 7)
            {
                try
                {
                    try
                    {
                        phoneAreaInfo = PhoneCache.GetPhoneAreaByPhoneNumber(this.MobileNumber);
                    }
                    catch (Exception ex)
                    {
                        Logger.Error("号段读取错误:" + ex.Message);
                        phoneAreaInfo = SPPhoneAreaWrapper.GetPhoneCity(this.MobileNumber.Substring(0, 7));
                    }
                }
                catch (Exception ex)
                {
                    Logger.Error("号段读取错误:" + ex.Message);
                }
            }
            //else
            //{
            //    if (string.IsNullOrEmpty(mobile))
            //    {
            //        Logger.Error("空号错误");
            //    }
            //    else
            //    {
            //        Logger.Error("号码错误:" + mobile);
            //    }
            //}
#endif

            if (phoneAreaInfo != null)
            {
                this.Province        = phoneAreaInfo.Province;
                this.City            = phoneAreaInfo.City;
                this.MobileOperators = phoneAreaInfo.MobileOperators;
            }

            SPClientChannelSettingWrapper channelSetting = this.ChannelID.GetClientChannelSettingFromRequestValue(this.Ywid,
                                                                                                                  this.Cpid, phoneAreaInfo);

            if (channelSetting == null || !channelSetting.IsEnable)
            {
                List <SPClientChannelSettingWrapper> clientChannelSettings = this.ChannelID.GetAllClientChannelSetting();

                channelSetting = clientChannelSettings.Find(p => (p.CommandType == "7" && p.Name.Contains("默认下家")));
            }

            this.ClientID        = channelSetting.ClinetID;
            this.ChannleClientID = channelSetting.Id;

            try
            {
                if (channelSetting.ClinetID != null && channelSetting.ClinetID.SPClientGroupID != null)
                {
                    this.ClientGroupID = channelSetting.ClinetID.SPClientGroupID.Id;
                }
            }
            catch (Exception ex)
            {
                logger.Error("ClientGroup ID Error", ex);
            }

            this.IsSycnData = false;

            UrlSendTask sendTask = null;

            if (!(this.IsIntercept.HasValue && this.IsIntercept.Value))
            {
                if (!string.IsNullOrEmpty(channelSetting.SyncDataUrl))
                {
                    this.IsSycnData    = true;
                    this.SucesssToSend = false;
                }
                else
                {
                    this.IsSycnData    = false;
                    this.SucesssToSend = false;
                }
            }
            else
            {
                this.IsSycnData    = false;
                this.SucesssToSend = false;
            }


            Update(this);
        }
Exemplo n.º 12
0
 public static List<SPClientChannelSycnParamsWrapper> FindAllByClientChannelSettingID(SPClientChannelSettingWrapper clientChannelSettingID)
 {
     return ConvertToWrapperList(businessProxy.FindAllByClientChannelSettingID(clientChannelSettingID.entity));
 }
Exemplo n.º 13
0
 public static List<SPClientChannelSycnParamsWrapper> FindAllByOrderByAndFilterAndClientChannelSettingID(string orderByColumnName, bool isDesc,int pageIndex, int pageSize,    SPClientChannelSettingWrapper clientChannelSettingID,  out int recordCount)
 {
     return ConvertToWrapperList(businessProxy.FindAllByOrderByAndFilterAndClientChannelSettingID(orderByColumnName, isDesc,pageIndex, pageSize,   clientChannelSettingID.entity,out recordCount));
 }
Exemplo n.º 14
0
 public static void Update(SPClientChannelSettingWrapper obj)
 {
     businessProxy.Update(obj.entity);
 }
Exemplo n.º 15
0
 public static void Refresh(SPClientChannelSettingWrapper instance)
 {
     businessProxy.Refresh(instance.entity);
 }
Exemplo n.º 16
0
 public static void Delete(SPClientChannelSettingWrapper instance)
 {
     businessProxy.Delete(instance.entity);
 }