コード例 #1
0
        public static List <DataProject> QueryDataProjectList(IProxy psc, int cityId, int AreaId, string tableName)
        {
            var projects = psc.QueryDataProjectList(cityId, AreaId, tableName).ValidateStatus <DataProjectResponseModel>().DataProjects;

            #region 循环获取每个城市对应的区域数据,并将成City对象存入List集合中
            List <DataProject> list_projects = new List <DataProject>();
            foreach (DataProject item in projects)
            {
                DataProject item_tmp = new DataProject()
                {
                    CityID      = item.CityID,
                    OtherName   = item.OtherName,
                    PinYin      = item.PinYin,
                    PinYinAll   = item.PinYinAll,
                    ProjectId   = item.ProjectId,
                    ProjectName = item.ProjectName
                };

                //projectName
                //if ("".Equals(item.PinYinAll) || "".Equals(item.PinYin))
                //{
                string tmp_all = "";
                //if (item.ProjectName.Length >= 3)
                //{
                //    tmp_all = Chinese2Spell.Convert(item_tmp.ProjectName.Substring(0, 3));
                //}
                //else
                //{
                tmp_all = Chinese2Spell.Convert(item_tmp.ProjectName);
                //}

                item_tmp.PinYinAll = tmp_all.ToUpper();                     //ShenZhen
                item_tmp.PinYin    = Chinese2Spell.getFirstLetter(tmp_all); //SZ
                //}

                //otherName
                if (!string.IsNullOrEmpty(item_tmp.OtherName))
                //if (!"".Equals(Convert.ToString(item_tmp.OtherName)))
                {
                    //if (item_tmp.OtherName.Length >= 3)
                    //{
                    //    tmp_all = Chinese2Spell.Convert(item_tmp.OtherName.Substring(0, 3));
                    //}
                    //else
                    //{
                    tmp_all = Chinese2Spell.Convert(item_tmp.OtherName);
                    //}

                    item_tmp.OtherPinyinAll = tmp_all.ToUpper();                  //ShenZhen

                    item_tmp.OtherPinyin = Chinese2Spell.getFirstLetter(tmp_all); //SZ
                }

                list_projects.Add(item_tmp);
            }
            #endregion
            return(list_projects);
        }
コード例 #2
0
        protected override void OnEnter(EventArgs e)
        {
            foreach (object i in base.Items)
            {
                string strPy = "";
                strPy = Chinese2Spell.GetHeadOfChs(i.ToString());
                strPy = strPy.Replace(" ", "").ToLower();
                m_arrlist_All.Add(new object[] { i, strPy });
            }

            base.OnEnter(e);
        }
コード例 #3
0
ファイル: SearchComboBox.cs プロジェクト: uvbs/FullSource
 protected override void OnEnter(EventArgs e)
 {
     if (this.DropDownStyle != ComboBoxStyle.DropDown)
     {
         return;
     }
     foreach (object i in this.Items)
     {
         string strPy = "";
         //if (this.m_filter == FilterType.ShouZiMu)
         strPy = Chinese2Spell.GetHeadOfChs(i.ToString());
         //else if (this.m_filter == FilterType.QuanPin)
         //    strPy = Chinese2Spell.ChsString2Spell(i.ToString());
         strPy = strPy.Replace(" ", "").ToLower();
         m_arrlist_All.Add(new object[] { i, strPy });
     }
     base.OnEnter(e);
 }
コード例 #4
0
        /// <summary>
        /// 分页查询楼盘信息
        /// </summary>
        /// <param name="psc"></param>
        /// <param name="cityId"></param>
        /// <param name="AreaId"></param>
        /// <param name="tableName"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        public static List <DataProject> PagingQueryDataProjectList(IProxy psc, int cityId, int AreaId, string tableName, int page)
        {
            var projects = psc.PagingQueryProjectList(cityId, AreaId, tableName, page).ValidateStatus <DataProjectResponseModel>().DataProjects;

            #region 循环获取每个城市对应的区域数据,并将成City对象存入List集合中
            List <DataProject> list_projects = new List <DataProject>();
            foreach (DataProject item in projects)
            {
                DataProject item_tmp = new DataProject()
                {
                    CityID      = item.CityID,
                    OtherName   = item.OtherName,
                    PinYin      = item.PinYin,
                    PinYinAll   = item.PinYinAll,
                    ProjectId   = item.ProjectId,
                    ProjectName = item.ProjectName
                };

                string tmp_all = "";
                tmp_all = Chinese2Spell.Convert(item_tmp.ProjectName);

                item_tmp.PinYinAll = tmp_all.ToUpper();                     //ShenZhen
                item_tmp.PinYin    = Chinese2Spell.getFirstLetter(tmp_all); //SZ

                if (!string.IsNullOrEmpty(item_tmp.OtherName))
                {
                    tmp_all = Chinese2Spell.Convert(item_tmp.OtherName);
                    item_tmp.OtherPinyinAll = tmp_all.ToUpper();                     //ShenZhen
                    item_tmp.OtherPinyin    = Chinese2Spell.getFirstLetter(tmp_all); //SZ
                }

                list_projects.Add(item_tmp);
            }
            #endregion
            return(list_projects);
        }
コード例 #5
0
        public static int IsValidProject(List <DataProject> list, List <SYS_ProjectMatch> networkNames, DataCase data, Dictionary <string, int> cacheDict)
        {
            int projectId = -1;

            if (string.IsNullOrWhiteSpace(data.ProjectName))
            {
                return(projectId);
            }
            //原始数据
            string projectName = "";

            if (data.ProjectName.Length >= 3)
            {
                projectName = data.ProjectName.Substring(0, 3);
            }
            else
            {
                projectName = data.ProjectName;
            }

            if (cacheDict.ContainsKey(projectName))
            {
                return(cacheDict[projectName]);
            }

            string tmp_projectName      = Chinese2Spell.Convert(projectName);            //ShenZhen
            string projectNamePinyinAll = tmp_projectName.ToUpper();                     //SHENZHEN
            string projectNamePinyin    = Chinese2Spell.getFirstLetter(tmp_projectName); //SZ

            foreach (DataProject dp_item in list)
            {
                logger.Debug(dp_item.ProjectName + "\t" + projectName);
                //先比较拼音首字母是否等于
                logger.Debug(dp_item.PinYin + "\t" + projectNamePinyin);
                if (dp_item.PinYin.Contains(projectNamePinyin))
                {
                    logger.Debug(dp_item.PinYinAll + "\t" + projectNamePinyinAll);
                    if (dp_item.PinYinAll.Contains(projectNamePinyinAll))
                    {
                        projectId = dp_item.ProjectId;
                        break;
                    }
                }
                else if (!string.IsNullOrEmpty(dp_item.OtherName))
                {
                    if (dp_item.OtherPinyin.Contains(projectNamePinyin))
                    {
                        logger.Debug(dp_item.OtherPinyin + "\t" + projectNamePinyinAll);
                        if (dp_item.OtherPinyinAll.Contains(projectNamePinyinAll))
                        {
                            projectId = dp_item.ProjectId;
                            break;
                        }
                    }
                }
            }
            //匹配网络名称
            if (projectId == -1 && !string.IsNullOrWhiteSpace(data.ProjectName) && networkNames != null && networkNames.Count() > 0)
            {
                var r = networkNames.FirstOrDefault(p => p.NetName == data.ProjectName);
                if (r != null)
                {
                    projectId = r.ProjectNameId;
                }
            }
            cacheDict[projectName] = projectId;
            return(projectId);
        }