示例#1
0
文件: BHFiller.cs 项目: qwdingyu/C-
 public BHFiller(WebBrowser2 browser, Uri currentUri, BHUrlParameter urlParameter)
     : base(browser, currentUri)
 {
     _parameters   = new List <KeyValuePair <FillParameterKey, object> >();
     _urlParameter = urlParameter;
     formIndexes   = new Dictionary <string, int>();
 }
示例#2
0
        protected override FillBase CreateFill(Uri url, ExtendWebBrowser.WebBrowser2 browser)
        {
            BHUrlParameter urlParameter = Uris[url.AbsolutePath] as BHUrlParameter;
            BHFiller       filler       = null;

            if (url.AbsolutePath == "/motor/part/carpart!input.action")
            {
                filler = new BHEngineFiller(browser, url, urlParameter)
                {
                    DataFile = base.DataProvider.DataSourceFile, Converter = this.Converter
                }
            }
            ;
            else
            {
                filler = new BHFiller(browser, url, urlParameter)
                {
                    DataFile = base.DataProvider.DataSourceFile, Converter = this.Converter
                }
            };
            return(filler);
        }
示例#3
0
 internal BHEngineFiller(ExtendWebBrowser.WebBrowser2 browser, Uri currentUri, BHUrlParameter urlParameter)
     : base(browser, currentUri, urlParameter)
 {
 }
示例#4
0
        /// <summary>
        /// 北环得到路径
        /// </summary>
        /// <returns></returns>
        protected override Hashtable GetUris()
        {
            Hashtable uris = new Hashtable();
            //读取北环下面的公共页面(路径)
            string fileName = FileHelper.GetPublicPage(base.Version, base.FillType);

            using (Office.Excel.ForwardExcelReader pages = new Office.Excel.ForwardExcelReader(string.Format("{0}\\{1}", base.RuleFilePath, fileName)))
            {
                pages.Open();
                Office.Excel.ForwardReadWorksheet sheet = pages.Activate("页面汇总") as Office.Excel.ForwardReadWorksheet;
                if (sheet != null)
                {
                    BHUrlParameter urlParameter = null;
                    Uri            url          = null;
                    Hashtable      columnHeader = GetColumnHeader(sheet);
                    while (sheet.ReadNextRow()) // 读取下一行。
                    {
                        urlParameter = new BHUrlParameter();
                        while (sheet.ReadNextCell(false)) // 读取本行的下一个单元格数据。
                        {
                            switch (columnHeader[sheet.CurrentCell.ColumnIndex] as string)
                            {
                            case "URL":
                                url = new Uri(sheet.GetContent() as string);
                                break;

                            case "页面标签":
                                urlParameter.LabelName = sheet.GetContent() as string;
                                break;

                            case "所属Excel":
                                urlParameter.IsPublicUrl = ((sheet.GetContent() as string) == "公共页面");
                                break;

                            case "表数据":
                                urlParameter.IsTableData = ((sheet.GetContent() as string) == "是");
                                break;
                            }
                        }
                        if (url != null && string.IsNullOrEmpty(url.ToString()) == false)
                        {
                            if (uris.ContainsKey(url.AbsolutePath))
                            {
                                continue;
                            }
                            uris.Add(url.AbsolutePath, urlParameter);
                        }
                    }
                }
                sheet = pages.Activate(carTypeName) as Office.Excel.ForwardReadWorksheet;
                if (sheet != null)
                {
                    _carTypeList = ReadCarTypeList(sheet);
                }
                else
                {
                    throw new ArgumentException(string.Format("填报规则中没有名为“{0}”的工作表。", carTypeName));
                }
            }
            return(uris);
        }