Exemple #1
0
 public void ExportZJD(IList <JSYD> jsyds, ZJDExportDataViewModel model)
 {
     foreach (JSYD jsyd in jsyds)
     {
         if (Utils.CheckListExists(jsyd.HZs) && Utils.CheckListExists(jsyd.NFs) && Utils.CheckListExists(jsyd.Floors))
         {
             ExportZJD(jsyd, model);
         }
     }
 }
Exemple #2
0
        public void AddFile(IList <string> files)
        {
            if (!Utils.CheckListExists(files))
            {
                return;
            }

            for (int a = 0; a < files.Count; a++)
            {
                FileNameCustom custom = new FileNameCustom(files[a]);
                model.FileNameCustoms.Add(custom);
            }
        }
Exemple #3
0
        private bool SaveZJDWorkbook(JSYD jsyd, ZJDDataSourceViewModel model)
        {
            bool          flag   = false;
            IList <NF>    nfs    = jsyd.NFs;
            IList <JTCY>  jtcys  = jsyd.HZs;
            IList <Floor> floors = jsyd.Floors;

            if (Utils.CheckListExists(nfs) && Utils.CheckListExists(jtcys) && Utils.CheckListExists(floors))
            {
                flag = true;
                ExcelManager.ExcelWrite.Save(jsyd.Row, model.JSYDTablePath);
                ExcelManager.ExcelWrite.Save(nfs[0].Row, model.NFTablePath);
                ExcelManager.ExcelWrite.Save(jtcys[0].Row, model.JTCYTablePath);
            }
            return(flag);
        }
Exemple #4
0
        /// <summary>
        /// 得到 分层表 与农房表 面积之差
        /// </summary>
        /// <returns></returns>
        private double GetNF_Floor_Area()
        {
            double area = 0;
            double tem  = 0;

            if (Utils.CheckListExists(ectypalJSYD.Floors) && Utils.CheckListExists(ectypalJSYD.NFs))
            {
                foreach (Floor floor in ectypalJSYD.Floors)
                {
                    area += Math.Round(floor.CJZMJ, 2);
                }
                tem = Math.Round(area - ectypalJSYD.NFs[0].JZMJ, 2);
                AreaDxTextEdit.Text = tem + "";
            }
            return(tem);
        }
Exemple #5
0
        private void OK_Click(object sender, RoutedEventArgs e)
        {
            SaveRedis_Click(null, null);

            //执行替换
            model.Files = filePagerPage.GetAllList();
            if (Utils.CheckListExists(model.Files))
            {
                WaitFormCustom.ShowCustom("运行中。。。");
                ExcelWrite.ReplaceText(model, model.Files);
                WaitFormCustom.CloseWaitForm("完成");
            }
            else
            {
                MessageBox.Show("没有选择任何的文件来替换");
            }
        }
Exemple #6
0
        private void ExportZJD(JSYD jsyd, ZJDExportDataViewModel model)
        {
            string saveDir = model.SaveDir;



            //档案袋
            if (model.IsDangAnDai)
            {
                //Type type = jsyd.JZXInfos.GetType();
                //Type typeA = Type.GetType(type.AssemblyQualifiedName);
                //Console.WriteLine(type.AssemblyQualifiedName);
                zjdDao.ExportZJD_DangAnDai(jsyd, saveDir);
            }
            //审批表
            if (model.IsSPB)
            {
                zjdDao.ExportZJD_SPB(jsyd, saveDir);
            }
            //委托书
            if (model.IsWTS)
            {
                zjdDao.ExportZJD_WTS(jsyd, saveDir);
            }
            //声明书
            if (model.IsSMS)
            {
                zjdDao.ExportZJD_SMS(jsyd, saveDir);
            }
            //权籍调查表
            if (model.IsQJDCB)
            {
                if (Utils.CheckListExists(jsyd.QZBs))
                {
                    if (Utils.CheckListExists(jsyd.JZXInfos))
                    {
                        zjdDao.ExportZJD_QJDCB(jsyd, saveDir);
                    }
                }
            }
            //测绘报告
            if (model.IsCHBG)
            {
                zjdDao.ExportZJD_CHBG(jsyd, saveDir);
            }
        }
Exemple #7
0
        public void AddFile(IList <string> files2)
        {
            IList <FileNameCustom> fileNameCustoms = new List <FileNameCustom>();

            if (!Utils.CheckListExists(files2))
            {
                return;
            }
            if (Utils.IsStrNull(Filter))
            {
                for (int a = 0; a < files2.Count; a++)
                {
                    FileNameCustom custom = new FileNameCustom(files2[a]);
                    fileNameCustoms.Add(custom);
                }
                addFilePagerPage.AddObject(fileNameCustoms);
                return;
            }
            IList <string> files = new List <string>();
            int            count = files2.Count;

            string[] filters = FileterToEndWith();
            for (int a = 0; a < count; a++)
            {
                string path = files2[a];
                string ex   = System.IO.Path.GetExtension(path);
                if (path != null && Array.IndexOf(filters, ex) != -1)
                {
                    files.Add(path);
                }
            }


            for (int a = 0; a < files.Count; a++)
            {
                FileNameCustom custom = new FileNameCustom(files[a]);
                fileNameCustoms.Add(custom);
            }
            addFilePagerPage.AddObject(fileNameCustoms);
        }
Exemple #8
0
        /// <summary>
        /// 内容,1为开始,2为包含,3结束,4相等,不填为相等
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void SelectRepalceFile_Click(object sender, RoutedEventArgs e)
        {
            IList <string> paths = FileUtils.SelectExcelFiles();

            if (Utils.CheckListExists(paths))
            {
                IList <ReplaceViewModel> list = new List <ReplaceViewModel>();
                foreach (string path in paths)
                {
                    if (Utils.CheckFileExists(path))
                    {
                        ISheet sheet = ExcelRead.ReadExcelSheet(path, 0);
                        foreach (IRow row in sheet)
                        {
                            var replaceModel = new ReplaceViewModel();
                            for (int a = 0; a < 3; a++)
                            {
                                ICell cell = row.GetCell(a);
                                if (cell == null || cell.CellType == CellType.Blank)
                                {
                                    if (a == 3)
                                    {
                                        cell = row.CreateCell(a);
                                        cell.SetCellValue(4);
                                    }
                                    break;
                                }
                                cell.SetCellType(CellType.String);
                                string value = cell.StringCellValue;
                                switch (a)
                                {
                                case 0:
                                    replaceModel.OldText = value;
                                    break;

                                case 1:
                                    replaceModel.NewText = value;
                                    break;

                                case 2:
                                    int gx;
                                    if (int.TryParse(value, out gx))
                                    {
                                        switch (gx)
                                        {
                                        case 0:
                                            replaceModel.StrRelation = MyUtils.StrRelation.StartsWith;
                                            break;

                                        case 1:
                                            replaceModel.StrRelation = MyUtils.StrRelation.Contains;
                                            break;

                                        case 2:
                                            replaceModel.StrRelation = MyUtils.StrRelation.EndsWith;
                                            break;

                                        case 3:
                                            replaceModel.StrRelation = MyUtils.StrRelation.Equals;
                                            break;
                                        }
                                    }
                                    else
                                    {
                                        replaceModel.StrRelation = MyUtils.StrRelation.Equals;
                                    }

                                    break;
                                }
                            }
                            list.Add(replaceModel);
                        }
                    }
                }
                replacePagerPage.AddObject(list);
            }
        }
Exemple #9
0
        /// <summary>
        /// 导出 农村土地家庭承包农户基本情况信息表(一)
        /// </summary>
        /// <param name="hzs"></param>
        public static bool ExportBsicInformationExcel(IList <JTCY> hzs, string saveDir)
        {
            Dictionary <string, string> dklbDic = new Dictionary <string, string>();

            dklbDic.Add("10", "承包地");
            dklbDic.Add("21", "自留地");
            dklbDic.Add("22", "机动地");
            dklbDic.Add("23", "开荒地");
            dklbDic.Add("99", "其他集体土地");


            if (Utils.IsStrNull(saveDir))
            {
                return(false);
            }
            string basicInformationExxcelTemplete       = System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\农村土地家庭承包农户基本情况信息表(一)模板.xls";
            Dictionary <int, XMLTable>     ClazzDic     = XMLRead.GetXmlToXMLTabl(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\WriteJTCYBaicInformationExcel.xml");
            Dictionary <string, XMLObject> xmlObjectDic = XMLRead.XmlToObjects(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\WriteJTCYBaicInformationExcel.xml");



            string basicInformationExxcelTemplete2       = System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\农村土地承包经营权(家庭承包)台帐(二)模板.xls";
            Dictionary <int, XMLTable>     ClazzDic2     = XMLRead.GetXmlToXMLTabl(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\WriteDKBaicInformationExcel.xml");
            Dictionary <string, XMLObject> xmlObjectDic2 = XMLRead.XmlToObjects(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\WriteDKBaicInformationExcel.xml");


            string cbfbm;

            if (Utils.CheckListExists(hzs))
            {
                DMToText(hzs);
                foreach (JTCY hz in hzs)
                {
                    string cbfdz = hz.DZ;
                    if (!cbfdz.EndsWith("组"))
                    {
                        cbfdz = cbfdz.Substring(0, cbfdz.LastIndexOf("组")) + "组";
                    }
                    int index = cbfdz.IndexOf("镇");
                    if (index == -1)
                    {
                        index = cbfdz.IndexOf("乡");
                    }
                    hz.DZ = cbfdz.Substring(index + 1, cbfdz.Length - index - 1);
                    XMLTable  xmlTable = ClazzDic[0];
                    IWorkbook workbook = ExcelRead.ReadExcel(basicInformationExxcelTemplete);
                    ISheet    sheet    = workbook.GetSheetAt(0);
                    //家庭成员表行数据插入
                    ExcelWrite.WriteObjects(sheet, xmlTable, hz.jTCies);
                    //家庭成员表 文字替换
                    ExcelWrite.ReplaceTextByXMLObject(sheet, hz, xmlObjectDic);
                    ExcelWrite.Save(workbook, saveDir + "//TZ-" + hz.CBFBM.Substring(0, 14) + " " + cbfdz + "\\TZ4 -" + hz.CBFBM + "-1农村土地家庭承包农户基本情况信息表(一).xls");

                    //写地块表
                    Dictionary <string, string> tdlylxDic = ExcelRead.ReadExcelToDic(System.AppDomain.CurrentDomain.BaseDirectory + "CBDTemplete\\土地利用类型映射表.xlsx", 0);
                    IList <DK> dks = hz.DKs;
                    if (dks == null)
                    {
                        continue;
                    }
                    foreach (DK dk in dks)
                    {
                        if (dk.DKLB == "21")
                        {
                            dk.ZLDMJ = Math.Round(dk.HTMJ, 2).ToString("f2");
                        }
                        else
                        {
                            dk.ELCBMJ = Math.Round(dk.HTMJ, 2).ToString("f2");
                        }


                        string dklb = dk.DKLB;
                        if (dklb != null)
                        {
                            if (dklbDic.TryGetValue(dklb, out dklb))
                            {
                                //地块类别无法识别的情况
                                dk.DKLB = dklb;
                            }
                        }
                        string tdlylx = dk.TDLYLX;
                        if (tdlylx != null)
                        {
                            if (tdlylxDic.TryGetValue(tdlylx, out tdlylx))
                            {
                                dk.TDLYLX = tdlylx;
                            }
                        }
                    }
                    IWorkbook workbook2 = ExcelRead.ReadExcel(basicInformationExxcelTemplete2);
                    ISheet    sheet2    = workbook2.GetSheetAt(0);
                    ExcelWrite.ReplaceTextByXMLObject(sheet2, hz, xmlObjectDic);
                    ExcelWrite.WriteObjects(sheet2, ClazzDic2[0], hz.DKs);


                    for (int a = 0; a < dks.Count; a++)
                    {
                        IRow row = sheet.GetRow(a + 5);
                    }

                    ExcelWrite.Save(workbook2, saveDir + "//TZ-" + hz.CBFBM.Substring(0, 14) + " " + cbfdz + "\\TZ4 -" + hz.CBFBM + "-2农村土地承包经营权(家庭承包)台帐(二).xls");
                }
                return(true);
            }
            return(false);
        }