コード例 #1
0
        static public void CreatedataToLogin(
            string fullName, string personalNumb, string password
            )
        {
            var valuesToFill1 = new TemplateEngine.Docx.Content(
                new FieldContent("FIO", fullName),
                new FieldContent("tab", personalNumb),
                new FieldContent("pass", password)
                );

            string destinationFolderPath = @"D:\Documents\Сотрудники\" + fullName;
            string templatePath          = @"D:\Documents Templates\Данные для входа.docx";
            string newFilePath           = @"D:\Documents\Сотрудники\" + fullName + "\\Данные для входа.docx";

            if (!Directory.Exists(destinationFolderPath))
            {
                Directory.CreateDirectory(destinationFolderPath);
            }

            if (File.Exists(newFilePath))
            {
                File.Delete(newFilePath);
            }

            File.Copy(templatePath, newFilePath);

            using (var outputDocument = new TemplateProcessor(newFilePath)
                                        .SetRemoveContentControls(true))
            {
                outputDocument.FillContent(valuesToFill1);
                outputDocument.SaveChanges();
            }

            Process.Start(newFilePath);
        }
コード例 #2
0
ファイル: Report.cs プロジェクト: ilnur1/Test
        public void createreportsTest(List <string> names)
        {
            System.IO.File.Delete("C:\\Users\\aynur\\source\\repos\\Faradey\\Dis1\\wwwroot\\reports\\" + names[0] + ".docx");
            System.IO.File.Copy("C:\\Users\\aynur\\source\\repos\\Faradey\\Dis1\\wwwroot\\reports\\test.docx", "C:\\Users\\aynur\\source\\repos\\Faradey\\Dis1\\wwwroot\\reports\\" + names[0] + ".docx");

            var valuesToFill = new TemplateEngine.Docx.Content(
                new FieldContent("Objectname", names[1]),
                new FieldContent("drawing", names[2]),
                new FieldContent("data", names[3]),
                new FieldContent("CustomerCompany", names[4]),
                new FieldContent("CustomerNamePos", names[5]),
                new FieldContent("ConractorCompany", names[6]),
                new FieldContent("ConractorName", names[7]),
                new FieldContent("GenCustomerName", names[8]),
                new FieldContent("Work", names[9]),
                new FieldContent("ProjectName", names[10]));


            using (var outputDocument = new TemplateProcessor("C:\\Users\\aynur\\source\\repos\\Faradey\\Dis1\\wwwroot\\reports\\" + names[0] + ".docx")
                                        .SetRemoveContentControls(true))
            {
                outputDocument.FillContent(valuesToFill);
                outputDocument.SaveChanges();
            }
        }
コード例 #3
0
ファイル: Report.cs プロジェクト: ilnur1/Test
        public void createreportsVL(List <string> names)
        {
            System.IO.File.Delete("C:\\Users\\aynur\\source\\repos\\Faradey\\Dis1\\wwwroot\\reports\\" + names[0] + ".docx");
            //   System.IO.File.Delete("C:\\Users\\aynur\\Downloads\\Reportdoc2.docx");
            System.IO.File.Copy("C:\\Users\\aynur\\Downloads\\Reportdoc.docx", "C:\\Users\\aynur\\source\\repos\\Faradey\\Dis1\\wwwroot\\reports\\" + names[0] + ".docx");

            var valuesToFill = new TemplateEngine.Docx.Content(
                new FieldContent("ObjectName", names[1]),
                new FieldContent("drawing", names[2]),
                new FieldContent("data", names[3]),
                new FieldContent("CustomerName", names[4]),
                new FieldContent("CustomerNamePos", names[5]),
                new FieldContent("CustomerCompany", names[6]),
                new FieldContent("CustomerReq", names[7]),
                new FieldContent("ConractorName", names[8]),
                new FieldContent("ConractorNamePos", names[9]),
                new FieldContent("ConractorReq", names[10]),
                new FieldContent("ConractorCompany", names[11]),
                new FieldContent("ProjectName", names[12]),
                new FieldContent("ProjectReq", names[13]),
                new FieldContent("Prname", names[14]),
                new FieldContent("PrnamePos", names[15]),
                //   new FieldContent("BuildControlCmp", names[16]),
                new FieldContent("BuildControlPos", names[16]),
                new FieldContent("BuildControlName", names[17]),
                //   new FieldContent("BuildControlReq", names[19]),
                //    new FieldContent("EquipmentCompany", names[20]),
                //   new FieldContent("equipmentprovider", names[21]),
                new FieldContent("work", names[18]),
                new FieldContent("elinstall", names[19]),
                new FieldContent("trials", names[20]),
                new FieldContent("GenCustomerName", names[21]),
                new FieldContent("GenCustomerNamePos", names[22]),
                new FieldContent("GenCustomerCompany", names[23]),
                new FieldContent("num", names[24]),
                new FieldContent("datehidwork", names[25]),
                new FieldContent("hidework", names[26]),
                new FieldContent("material", names[27]),
                new FieldContent("date1", names[28]),
                new FieldContent("date2", names[29]),
                new FieldContent("datedraw", names[30]),
                new FieldContent("izarea", names[31]),
                new FieldContent("iztype", names[32]),
                new FieldContent("izcount", names[33]),
                new FieldContent("wire", names[34]),
                new FieldContent("wirecount", names[35]),
                new FieldContent("intermediate", names[36]),
                new FieldContent("anker", names[37]),
                new FieldContent("corn", names[38]),
                new FieldContent("other", names[39]));


            using (var outputDocument = new TemplateProcessor("C:\\Users\\aynur\\source\\repos\\Faradey\\Dis1\\wwwroot\\reports\\" + names[0] + ".docx")
                                        .SetRemoveContentControls(true))
            {
                outputDocument.FillContent(valuesToFill);
                outputDocument.SaveChanges();
            }
        }
コード例 #4
0
        static public void CreateLeaveOrder(
            DateTime creationDate, DateTime dateLaborContract, DateTime whenKick,
            int personal_number, string fullName, string department, string position, string reason,
            string osn
            )
        {
            string formattedCreationDate = creationDate.Date.ToString("dd.MM.yyyy");
            //Labor
            string dLabor = dateLaborContract.Date.ToString("dd");
            string mLabor = dateLaborContract.Date.ToString("MMMM");
            string yLabor = dateLaborContract.Date.ToString("yy");

            //whenKick
            string dKick = dateLaborContract.Date.ToString("dd");
            string mKick = dateLaborContract.Date.ToString("MMMM");
            string yKick = dateLaborContract.Date.ToString("yy");

            var valuesToFill = new TemplateEngine.Docx.Content(
                new FieldContent("crdate", formattedCreationDate),
                new FieldContent("day1", dLabor),
                new FieldContent("m1", mLabor),
                new FieldContent("year1", yLabor),
                new FieldContent("day2", dKick),
                new FieldContent("m2", mKick),
                new FieldContent("year2", yKick),
                new FieldContent("tab", personal_number.ToString()),
                new FieldContent("FIO_S", fullName),
                new FieldContent("de", department),
                new FieldContent("po", position),
                new FieldContent("res", reason),
                new FieldContent("osn", osn)
                );

            string destinationFolderPath = @"D:\Documents\Сотрудники\" + fullName;
            string templatePath          = @"D:\Documents Templates\Приказ об увольнении.docx";
            string newFilePath           = @"D:\Documents\Сотрудники\" + fullName + "\\Приказ об увольнении.docx";

            if (!Directory.Exists(destinationFolderPath))
            {
                Directory.CreateDirectory(destinationFolderPath);
            }

            if (File.Exists(newFilePath))
            {
                File.Delete(newFilePath);
            }

            File.Copy(templatePath, newFilePath);

            using (var outputDocument = new TemplateProcessor(newFilePath)
                                        .SetRemoveContentControls(true))
            {
                outputDocument.FillContent(valuesToFill);
                outputDocument.SaveChanges();
            }

            Process.Start(newFilePath);
        }
コード例 #5
0
ファイル: FormDocs.cs プロジェクト: Sevochka/staff-app
        private void btnReportAllEmployees_Click(object sender, EventArgs e)
        {
            string       mainDate   = getMainDate();
            DataTable    employees  = database.getEmployeesForReport();
            TableContent tableEvent = new TableContent("Team Members");
            int          length     = employees.Rows.Count;

            foreach (DataRow dtRow in employees.Rows)
            {
                string personalNumber = dtRow["personal_number"].ToString();
                string name           = dtRow["name"].ToString();
                string surname        = dtRow["surname"].ToString();
                //string patronymic = dtRow["patronymic"].ToString();
                string positionName   = dtRow["positionName"].ToString();
                string departmentName = dtRow["departmentName"].ToString();


                tableEvent.AddRow(
                    new FieldContent("personalNumber", personalNumber),
                    new FieldContent("Full Name", surname + " " + name),
                    new FieldContent("Role", positionName),
                    new FieldContent("department", departmentName)
                    );
            }

            string employeeWord = GetDeclension(length, "сотрудник", "сотрудника", "сотрудников");
            var    valuesToFill = new TemplateEngine.Docx.Content(
                tableEvent,
                new FieldContent("Report date", mainDate),
                new FieldContent("Count", length.ToString() + " " + employeeWord)
                );

            string destinationFolderPath = @"D:\Documents\Отчеты о составе команды";
            string templatePath          = @"D:\Documents Templates\Отчет о сотрудниках.docx";
            string newFilePath           = @"D:\Documents\Отчеты о составе команды\Отчет о составе команды от " + mainDate + ".docx";

            if (!Directory.Exists(destinationFolderPath))
            {
                Directory.CreateDirectory(destinationFolderPath);
            }

            File.Delete(newFilePath);
            File.Copy(templatePath, newFilePath);

            using (var outputDocument = new TemplateProcessor(newFilePath)
                                        .SetRemoveContentControls(true))
            {
                outputDocument.FillContent(valuesToFill);
                outputDocument.SaveChanges();
            }
            Process.Start(newFilePath);
        }
コード例 #6
0
        static public void CreateMoveOrder(
            DateTime currentDate,
            int personal_number,
            string fullName,
            string departmentOld,
            string positionOld,
            string departmentNew,
            string positionNew,
            string fullNameMain
            )
        {
            string formattedCreationDate = currentDate.Date.ToString("dd.MM.yyyy");


            var valuesToFill = new TemplateEngine.Docx.Content(
                new FieldContent("DATE", formattedCreationDate),
                new FieldContent("FIO", fullName),
                new FieldContent("NUMBER", personal_number.ToString()),
                new FieldContent("S_DEP", departmentOld),
                new FieldContent("POS", positionOld),
                new FieldContent("T_DEP", departmentNew),
                new FieldContent("POS2", positionNew),
                new FieldContent("FIO2", fullNameMain)
                );

            string destinationFolderPath = @"D:\Documents\Сотрудники\" + fullName;
            string templatePath          = @"D:\Documents Templates\Приказ о перемещении.docx";
            string newFilePath           = @"D:\Documents\Сотрудники\" + fullName + "\\Приказ о перемещении от " + formattedCreationDate + ".docx";

            if (!Directory.Exists(destinationFolderPath))
            {
                Directory.CreateDirectory(destinationFolderPath);
            }

            if (File.Exists(newFilePath))
            {
                File.Delete(newFilePath);
            }

            File.Copy(templatePath, newFilePath);

            using (var outputDocument = new TemplateProcessor(newFilePath)
                                        .SetRemoveContentControls(true))
            {
                outputDocument.FillContent(valuesToFill);
                outputDocument.SaveChanges();
            }

            Process.Start(newFilePath);
        }
コード例 #7
0
        static public void createСonsentProcessingOfPersonalData(
            DateTime date,
            string fullName,
            string registerAddress,
            string passSeries,
            string passNumber,
            DateTime passDate,
            string passExtradition
            )
        {
            string formattedDate     = date.Date.ToString("dd MMMM yyyy");
            string formattedPassDate = passDate.Date.ToString("dd.MM.yyyy");

            var valuesToFill1 = new TemplateEngine.Docx.Content(
                new FieldContent("Date", date.ToString(formattedDate)),
                new FieldContent("Full Name", date.ToString(fullName)),
                new FieldContent("Passport Number", date.ToString(passNumber)),
                new FieldContent("Passport Date", date.ToString(formattedPassDate)),
                new FieldContent("Passport Extradition", date.ToString(passExtradition)),
                new FieldContent("Reg", date.ToString(registerAddress)),
                new FieldContent("Pass", date.ToString(passSeries))
                );



            string destinationFolderPath = @"D:\Documents\Сотрудники\" + fullName;
            string templatePath          = @"D:\Documents Templates\Cогласие на обработку персональных данных.docx";
            string newFilePath           = @"D:\Documents\Сотрудники\" + fullName + "\\Cогласие на обработку персональных данных.docx";

            if (!Directory.Exists(destinationFolderPath))
            {
                Directory.CreateDirectory(destinationFolderPath);
            }

            if (File.Exists(newFilePath))
            {
                File.Delete(newFilePath);
            }

            File.Copy(templatePath, newFilePath);

            using (var outputDocument = new TemplateProcessor(newFilePath)
                                        .SetRemoveContentControls(true))
            {
                outputDocument.FillContent(valuesToFill1);
                outputDocument.SaveChanges();
            }

            Process.Start(newFilePath);
        }
コード例 #8
0
        static public void CreateLeave(
            string fullName, string position, string department, DateTime date_when, string reason,
            DateTime currentDate
            )
        {
            string formattedWhen    = date_when.Date.ToString("dd.MM.yyyy");
            string formattedCurrent = currentDate.Date.ToString("dd.MM.yyyy");

            var valuesToFill = new TemplateEngine.Docx.Content(
                new FieldContent("POS", position),
                new FieldContent("de", department),
                new FieldContent("FIO", fullName),
                new FieldContent("DATE_WHEN", formattedWhen),
                new FieldContent("re", reason),
                new FieldContent("CURR_DATE", formattedCurrent)
                );

            string destinationFolderPath = @"D:\Documents\Сотрудники\" + fullName;
            string templatePath          = @"D:\Documents Templates\Заявление об увольнении.docx";
            string newFilePath           = @"D:\Documents\Сотрудники\" + fullName + "\\Заявление об увольнении.docx";

            if (!Directory.Exists(destinationFolderPath))
            {
                Directory.CreateDirectory(destinationFolderPath);
            }

            if (File.Exists(newFilePath))
            {
                File.Delete(newFilePath);
            }

            File.Copy(templatePath, newFilePath);

            using (var outputDocument = new TemplateProcessor(newFilePath)
                                        .SetRemoveContentControls(true))
            {
                outputDocument.FillContent(valuesToFill);
                outputDocument.SaveChanges();
            }

            Process.Start(newFilePath);
        }
コード例 #9
0
        static public void createLaborContract(
            string empFullName,
            string newFullName,
            string department,
            string position,
            string type,
            string type2,
            DateTime start,
            DateTime finish,
            string duty,
            string mode,
            string days,
            string series,
            string number,
            string body,
            string register,
            DateTime passDate
            )
        {
            string formattedStart    = start.Date.ToString("dd.MM.yyyy");
            string formattedFinish   = finish.Date.ToString("dd.MM.yyyy");
            string formattedPassDate = passDate.Date.ToString("dd.MM.yyyy");

            var valuesToFill1 = new TemplateEngine.Docx.Content(
                new FieldContent("EMP_FIO", empFullName),
                new FieldContent("NEW_FIO", newFullName),
                new FieldContent("NEW_FIO2", newFullName),
                new FieldContent("NEW_DEP", department),
                new FieldContent("NEW_POSITION", position),
                new FieldContent("TYPE", type),
                new FieldContent("TYPE2", type2),
                new FieldContent("START", formattedStart),
                new FieldContent("FINISH", formattedFinish),
                new FieldContent("DUTY", duty),
                new FieldContent("MODE", mode),
                new FieldContent("DAYS", days),
                new FieldContent("EMP2", empFullName),
                new FieldContent("NEW2", newFullName),
                new FieldContent("SERIES", series),
                new FieldContent("NUM", number),
                new FieldContent("BODY", body),
                new FieldContent("REG", register)
                );



            string destinationFolderPath = @"D:\Documents\Сотрудники\" + newFullName;
            string templatePath          = @"D:\Documents Templates\Трудовой договор.docx";
            string newFilePath           = @"D:\Documents\Сотрудники\" + newFullName + "\\Трудовой договор.docx";

            if (!Directory.Exists(destinationFolderPath))
            {
                Directory.CreateDirectory(destinationFolderPath);
            }

            if (File.Exists(newFilePath))
            {
                File.Delete(newFilePath);
            }

            File.Copy(templatePath, newFilePath);

            using (var outputDocument = new TemplateProcessor(newFilePath)
                                        .SetRemoveContentControls(true))
            {
                outputDocument.FillContent(valuesToFill1);
                outputDocument.SaveChanges();
            }

            Process.Start(newFilePath);
        }