Beispiel #1
0
        /// <summary>
        /// 根据Xml生成人员实体集合
        /// </summary>
        /// <param name="OperatorXML">人员xml</param>
        /// <param name="IdFiledName">Id属性名称</param>
        /// <param name="NameFiledName">Name属性名称</param>
        /// <returns>人员实体集合</returns>
        private IList <Model.StatisticStructure.StatisticOperator> GetOperatorListByXML(string OperatorXML, string IdFiledName
                                                                                        , string NameFiledName)
        {
            if (string.IsNullOrEmpty(OperatorXML) || string.IsNullOrEmpty(IdFiledName) || string.IsNullOrEmpty(NameFiledName))
            {
                return(null);
            }

            XElement xRoot = XElement.Parse(OperatorXML);
            var      xRows = Utils.GetXElements(xRoot, "row");

            if (xRows == null || xRows.Count() <= 0)
            {
                return(null);
            }

            IList <Model.StatisticStructure.StatisticOperator> tmpList = new List <Model.StatisticStructure.StatisticOperator>();

            Model.StatisticStructure.StatisticOperator tmpModel = null;
            foreach (var t in xRows)
            {
                if (t == null)
                {
                    continue;
                }

                tmpModel              = new EyouSoft.Model.StatisticStructure.StatisticOperator();
                tmpModel.OperatorId   = Utils.GetInt(Utils.GetXAttributeValue(t, IdFiledName));
                tmpModel.OperatorName = Utils.GetXAttributeValue(t, NameFiledName);

                tmpList.Add(tmpModel);
            }

            return(tmpList);
        }
Beispiel #2
0
        /// <summary>
        /// 解析SqlXML获取人员信息
        /// </summary>
        /// <param name="strXML">SqlXML</param>
        /// <param name="strTableName">表名称</param>
        /// <param name="strIdValue">Id字段名称</param>
        /// <param name="strNameValue">Name字段名称</param>
        /// <returns></returns>
        public IList <Model.StatisticStructure.StatisticOperator> GetStatisticOperator(string strXML, string strTableName, string strIdValue, string strNameValue)
        {
            if (string.IsNullOrEmpty(strXML) || string.IsNullOrEmpty(strTableName) || string.IsNullOrEmpty(strIdValue) || string.IsNullOrEmpty(strNameValue))
            {
                return(null);
            }

            System.Xml.XmlAttributeCollection attList     = null;
            System.Xml.XmlDocument            xml         = null;
            System.Xml.XmlNodeList            xmlNodeList = null;
            xml = new System.Xml.XmlDocument();
            xml.LoadXml(strXML);
            xmlNodeList = xml.GetElementsByTagName(strTableName);
            if (xmlNodeList == null || xmlNodeList.Count <= 0)
            {
                return(null);
            }

            List <Model.StatisticStructure.StatisticOperator> list = new List <Model.StatisticStructure.StatisticOperator>();

            Model.StatisticStructure.StatisticOperator model = null;
            foreach (System.Xml.XmlNode node in xmlNodeList)
            {
                attList = node.Attributes;
                if (attList != null && attList.Count > 0)
                {
                    model = new EyouSoft.Model.StatisticStructure.StatisticOperator();
                    if (attList[strIdValue] != null && !string.IsNullOrEmpty(attList[strIdValue].Value))
                    {
                        model.OperatorId = int.Parse(attList[strIdValue].Value);
                    }
                    if (attList[strNameValue] != null)
                    {
                        model.OperatorName = attList[strNameValue].Value;
                    }

                    list.Add(model);
                }
            }
            if (list.Count > 0)
            {
                list = list.Distinct(new DistinctByStatisticOperator()).ToList();
            }

            xml         = null;
            attList     = null;
            xmlNodeList = null;

            return(list);
        }
Beispiel #3
0
        /// <summary>
        /// 根据XML获取计调员信息
        /// </summary>
        /// <param name="strXML"></param>
        /// <returns></returns>
        private IList <Model.StatisticStructure.StatisticOperator> GetStatisticOperatorByXML(string strXML)
        {
            if (string.IsNullOrEmpty(strXML))
            {
                return(null);
            }

            XElement xRoot = XElement.Parse(strXML);
            var      xRows = Utils.GetXElements(xRoot, "tmpVes");

            if (xRows == null || xRows.Count() <= 0)
            {
                return(null);
            }

            IList <Model.StatisticStructure.StatisticOperator> tmpList = new List <Model.StatisticStructure.StatisticOperator>();

            Model.StatisticStructure.StatisticOperator tmpModel = null;
            foreach (var t in xRows)
            {
                string strTmpXML = Utils.GetXAttributeValue(t, "Logistics");
                if (string.IsNullOrEmpty(strTmpXML))
                {
                    continue;
                }

                var TmpXRows = Utils.GetXElements(XElement.Parse(strTmpXML), "row");
                if (TmpXRows == null || TmpXRows.Count() <= 0)
                {
                    continue;
                }

                foreach (var tmp in TmpXRows)
                {
                    tmpModel              = new EyouSoft.Model.StatisticStructure.StatisticOperator();
                    tmpModel.OperatorId   = Utils.GetInt(Utils.GetXAttributeValue(tmp, "Id"));
                    tmpModel.OperatorName = Utils.GetXAttributeValue(tmp, "ContactName");
                    tmpList.Add(tmpModel);
                }
            }

            return(tmpList == null ? tmpList : tmpList.Distinct(new DistinctByStatisticOperator()).ToList());
        }
Beispiel #4
0
        /// <summary>
        /// 根据订单XML获取订单部分信息
        /// </summary>
        /// <param name="strOrderXML">订单XML</param>
        /// <param name="model">查询实体</param>
        /// <param name="TotalAllIncome">团队总收入</param>
        /// <param name="TourPeopleNum">团队人数</param>
        /// <param name="tmpList">销售员集合</param>
        /// <param name="IsIList">是否为集合赋值</param>
        private void GetOrderInfoByXML(string strOrderXML, EyouSoft.Model.StatisticStructure.QueryEarningsStatistic model
                                       , ref decimal TotalAllIncome, ref int TourPeopleNum
                                       , ref IList <Model.StatisticStructure.StatisticOperator> tmpList, bool IsIList)
        {
            if (string.IsNullOrEmpty(strOrderXML))
            {
                return;
            }

            XElement xRoot = XElement.Parse(strOrderXML);
            var      xRows = Utils.GetXElements(xRoot, "tmpVes");

            if (xRows == null || xRows.Count() <= 0)
            {
                return;
            }

            TotalAllIncome = 0;
            TourPeopleNum  = 0;
            if (tmpList == null && IsIList)
            {
                tmpList = new List <Model.StatisticStructure.StatisticOperator>();
            }

            Model.StatisticStructure.StatisticOperator tmpModel = null;
            foreach (var t in xRows)
            {
                string strTmpXML = Utils.GetXAttributeValue(t, "Orders");
                if (string.IsNullOrEmpty(strTmpXML))
                {
                    continue;
                }

                var TmpXRows = Utils.GetXElements(XElement.Parse(strTmpXML), "row");
                if (TmpXRows == null || TmpXRows.Count() <= 0)
                {
                    continue;
                }

                foreach (var tmp in TmpXRows)
                {
                    int SaleId     = Utils.GetInt(Utils.GetXAttributeValue(tmp, "SalerId"));
                    int OrderState = Utils.GetInt(Utils.GetXAttributeValue(tmp, "OrderState"));
                    if (model != null)
                    {
                        //销售员查询
                        if (SaleId > 0 && model.SaleIds != null && model.SaleIds.Length > 0 && !model.SaleIds.Contains(SaleId))
                        {
                            continue;
                        }
                        //订单统计方式
                        if (model.ComputeOrderType == EyouSoft.Model.EnumType.CompanyStructure.ComputeOrderType.统计有效订单)
                        {
                            if (OrderState == (int)Model.EnumType.TourStructure.OrderState.受理 || OrderState == (int)Model.EnumType.TourStructure.OrderState.留位过期)
                            {
                                continue;
                            }
                        }
                        else if (model.ComputeOrderType == EyouSoft.Model.EnumType.CompanyStructure.ComputeOrderType.统计确认成交订单 && OrderState != (int)Model.EnumType.TourStructure.OrderState.已成交)
                        {
                            continue;
                        }
                    }

                    TourPeopleNum  += (Utils.GetInt(Utils.GetXAttributeValue(tmp, "PeopleNumber")) - Utils.GetInt(Utils.GetXAttributeValue(tmp, "LeaguePepoleNum")));
                    TotalAllIncome += Utils.GetDecimal(Utils.GetXAttributeValue(tmp, "FinanceSum"));

                    if (!IsIList)
                    {
                        continue;
                    }

                    tmpModel              = new EyouSoft.Model.StatisticStructure.StatisticOperator();
                    tmpModel.OperatorId   = Utils.GetInt(Utils.GetXAttributeValue(tmp, "SalerId"));
                    tmpModel.OperatorName = Utils.GetXAttributeValue(tmp, "SalerName");
                    tmpList.Add(tmpModel);
                }
            }

            if (tmpList != null)
            {
                tmpList = tmpList.Distinct(new DistinctByStatisticOperator()).ToList();
            }
        }