예제 #1
0
        public void TestOfficialXlsx()
        {
            ReportCardModel model = new ReportCardModel()
            {
                SettingParameters = new SettingParameters()
                {
                    TabelNumber = "7751-00-548", Year = 2021, IdDepartment = 8,
                    Type        = new Type()
                    {
                        IdType = 1, NameType = "Полный"
                    },
                    View = new View()
                    {
                        IdView = 0, NameView = "Первичный"
                    },
                    Mouth = new Mouth()
                    {
                        NumberMouthString = "09", NameMouth = "Сентябрь", NumberMouth = 9
                    }
                }
            };
            SqlConnectionType sql          = new SqlConnectionType();
            SelectImns        selectFrames = new SelectImns();
            XmlReadOrWrite    xml          = new XmlReadOrWrite();
            SelectSql         select       = new SelectSql();

            select.SelectCardModelLeader(ref model);
            var command        = string.Format(selectFrames.UserReportCard, model.SettingParameters.LeaderD.NameDepartment, $"{model.SettingParameters.Year}-{model.SettingParameters.Mouth.NumberMouthString}-01");
            var userReportCard = sql.XmlString("Data Source=i7751-app020;Initial Catalog=imns51;Integrated Security=True;MultipleActiveResultSets=True", command);

            userReportCard = string.Concat("<SettingParameters>", userReportCard, "</SettingParameters>");
            model.SettingParameters.UsersReportCard = ((SettingParameters)xml.ReadXmlText(userReportCard, typeof(SettingParameters))).UsersReportCard;
            foreach (var usersReportCard in model.SettingParameters.UsersReportCard)
            {
                var commandVacation = string.Format(selectFrames.ItemVacationNew, usersReportCard.Tab_num, $"{model.SettingParameters.Year}", $"{model.SettingParameters.Year}");
                var userVacation    = sql.XmlString("Data Source=i7751-app020;Initial Catalog=imns51;Integrated Security=True;MultipleActiveResultSets=True", commandVacation);
                userVacation = string.Concat("<UsersReportCard>", userVacation, "</UsersReportCard>");
                usersReportCard.ItemVacation = ((UsersReportCard)xml.ReadXmlText(userVacation, typeof(UsersReportCard))).ItemVacation;
                var commandDisability = string.Format(selectFrames.Disability, usersReportCard.Tab_num, $"{model.SettingParameters.Year}");
                var userDisability    = sql.XmlString("Data Source=i7751-app020;Initial Catalog=imns51;Integrated Security=True;MultipleActiveResultSets=True", commandDisability);
                userDisability             = string.Concat("<UsersReportCard>", userDisability, "</UsersReportCard>");
                usersReportCard.Disability = ((UsersReportCard)xml.ReadXmlText(userDisability, typeof(UsersReportCard))).Disability;
                var commandBusiness = string.Format(selectFrames.Business, usersReportCard.Tab_num, $"{model.SettingParameters.Year}");
                var userBusiness    = sql.XmlString("Data Source=i7751-app020;Initial Catalog=imns51;Integrated Security=True;MultipleActiveResultSets=True", commandBusiness);
                userBusiness             = string.Concat("<UsersReportCard>", userBusiness, "</UsersReportCard>");
                usersReportCard.Business = ((UsersReportCard)xml.ReadXmlText(userBusiness, typeof(UsersReportCard))).Business;
            }
            ReportCard report = new ReportCard();

            report.CreateDocument("D:\\Testing\\", model);
        }
예제 #2
0
        public void MemoGen()
        {
            MemoReport memo = new MemoReport();
            //   memo.CreateDocument("D:\\Testing\\",null,null);
            ModelMemoReport memoReport = new ModelMemoReport()
            {
                SelectParameterDocument = new SelectParameterDocument()
                {
                    IdUser = 33, NameDocument = "RR", NumberDocument = 4, TabelNumber = "7751-00-099", TypeDocument = 1
                }
            };
            SelectSql         select       = new SelectSql();
            SelectImns        selectFrames = new SelectImns();
            SqlConnectionType sql          = new SqlConnectionType();
            XmlReadOrWrite    xml          = new XmlReadOrWrite();

            select.SelectMemoReport(ref memoReport);
            var commandOrders = string.Format(selectFrames.LastOrder, memoReport.UserDepartment.SmallTabelNumber);
            var userOrder     = sql.XmlString("Data Source=i7751-app020;Initial Catalog=imns51;Integrated Security=True;MultipleActiveResultSets=True", commandOrders);

            if (userOrder != null)
            {
                userOrder = string.Concat("<Orders>", userOrder, "</Orders>");
                memoReport.UserDepartment.Orders = ((Orders)xml.ReadXmlText(userOrder, typeof(Orders)));
            }
            memo.CreateDocument("D:\\Testing\\", memoReport);
        }