示例#1
0
 private void FormSet_FormClosing(object sender, FormClosingEventArgs e)
 {
     PublicConfig.FileRowNum        = Convert.ToInt32(txbFileRowNum.Text);
     PublicConfig.FilterCompanyName = txbFilterCompanyName.Text;
     PublicConfig.SaveDir           = txbSaveDir.Text;
     PublicConfig.InitFilterCompanyName();
     PublicConfig.SaveConfig();
 }
示例#2
0
        private void FormMian_Load(object sender, EventArgs e)
        {
            mExcelPath = @"E:\work\300\qichamao.xlsx";
            PublicConfig.XlsTemplatePath  = Environment.CurrentDirectory + @"\导出模板.xls";
            PublicConfig.XlsTemplatePath2 = Environment.CurrentDirectory + @"\导出模板2.xls";
            LogHelper.showLog("拖动文件到程序窗口,然后导出即可!");

            PublicConfig.ReadConfig();
            PublicConfig.InitFilterCompanyName();
            DateTime dt    = DateTime.Now;
            TimeSpan tSpan = new TimeSpan(dt.Ticks);

            //PublicConfig.AppNow = tSpan.TotalSeconds;
            PublicConfig.AppNow = 0;
        }
示例#3
0
        public static void SaveConfig()
        {
            PublicConfig.setAppSetting("ExportCompanyName", ExportCompanyName.ToString());
            PublicConfig.setAppSetting("ExportName", ExportName.ToString());
            PublicConfig.setAppSetting("ExportPhone", ExportPhone.ToString());
            PublicConfig.setAppSetting("ExportGSNB", ExportGSNB.ToString());
            PublicConfig.setAppSetting("ExportMorePhone", ExportMorePhone.ToString());
            PublicConfig.setAppSetting("ExportZuoJi", ExportZuoJi.ToString());
            PublicConfig.setAppSetting("FilterSamePhone", FilterSamePhone.ToString());
            PublicConfig.setAppSetting("FileRowNum", FileRowNum.ToString());
            PublicConfig.setAppSetting("FilterCompanyName", FilterCompanyName);
            PublicConfig.setAppSetting("GetFirstPhone", GetFirstPhone.ToString());
            PublicConfig.setAppSetting("GetSecondPhone", GetSecondPhone.ToString());

            PublicConfig.setAppSetting("SaveDir", SaveDir);
        }
示例#4
0
        public static void ReadConfig()
        {
            ExportCompanyName = Convert.ToBoolean(PublicConfig.getAppSetting("ExportCompanyName"));
            ExportName        = Convert.ToBoolean(PublicConfig.getAppSetting("ExportName"));
            ExportPhone       = Convert.ToBoolean(PublicConfig.getAppSetting("ExportPhone"));
            ExportGSNB        = Convert.ToBoolean(PublicConfig.getAppSetting("ExportGSNB"));
            ExportMorePhone   = Convert.ToBoolean(PublicConfig.getAppSetting("ExportMorePhone"));
            ExportZuoJi       = Convert.ToBoolean(PublicConfig.getAppSetting("ExportZuoJi"));
            FilterSamePhone   = Convert.ToBoolean(PublicConfig.getAppSetting("FilterSamePhone"));
            GetFirstPhone     = Convert.ToBoolean(PublicConfig.getAppSetting("GetFirstPhone"));
            GetSecondPhone    = Convert.ToBoolean(PublicConfig.getAppSetting("GetSecondPhone"));

            FileRowNum        = Convert.ToInt32(PublicConfig.getAppSetting("FileRowNum"));
            FilterCompanyName = PublicConfig.getAppSetting("FilterCompanyName");
            SaveDir           = PublicConfig.getAppSetting("SaveDir");
            if (SaveDir.Length <= 0 || System.IO.Directory.Exists(SaveDir) == false)
            {
                SaveDir = Environment.CurrentDirectory;
            }
        }
示例#5
0
        private static List <ExcelRow> getRowList(string path)
        {
            bool isTemplate = IsTemplateFile(path);

            List <ExcelRow> listRow = new List <ExcelRow>();

            Aspose.Cells.Workbook wk       = new Aspose.Cells.Workbook(path);
            Worksheet             workbook = wk.Worksheets[0];
            Cells  cells = workbook.Cells;
            string data  = string.Empty;

            int row = 2;

            if (isTemplate)
            {
                row = 0;
            }

            for (; row <= cells.MaxDataRow; row++)
            {
                ExcelRow excelRow = new ExcelRow();

                if (isTemplate)
                {
                    excelRow.CompanyName = cells.GetCell(row, 0).StringValue; // 公司名称
                }
                else
                {
                    excelRow.CompanyName = cells.GetCell(row, 1).StringValue; // 公司名称
                }

                if (PublicConfig.IsFilterCompanyName(excelRow.CompanyName))
                {
                    continue;
                }

                // 企查猫 有邮箱
                if (cells.MaxColumn == 16)
                {
                    string mail = cells.GetCell(row, 14).StringValue.Trim();
                    if (mail.IndexOf("@") > 0)
                    {
                        excelRow.ListMail.Add(mail);
                    }
                }

                // 模板只有3列
                if (isTemplate)
                {
                    excelRow.Name  = cells.GetCell(row, 1).StringValue;  // 法定代表人
                    data           = cells.GetCell(row, 2).StringValue;
                    data           = data.Replace(";", ";");
                    data           = data.Replace(", ", ";");
                    excelRow.Phone = data.Trim();
                }
                else
                {
                    excelRow.Name      = cells.GetCell(row, 2).StringValue;  // 法定代表人
                    excelRow.Phone     = cells.GetCell(row, 11).StringValue;
                    excelRow.GSNB      = cells.GetCell(row, 12).StringValue; // 工商年报电话
                    excelRow.MorePhone = cells.GetCell(row, 13).StringValue;
                }

                excelRow.ParsePhone();
                excelRow.parsePhoneData();

                listRow.Add(excelRow);
            }

            return(listRow);
        }