Esempio n. 1
0
        protected void lbGetAllUsersInfo_Click(object sender, EventArgs e)
        {
            var dm    = new DataManager();
            var month = DateTime.Now.Month.ToString();

            if (month.Length == 1)
            {
                month = String.Format("0{0}", month);
            }
            var date1   = Convert.ToDateTime(String.Format("01-{0}-{1}", month, DateTime.Now.Year)).ToString("yyyy-MM-dd");
            var date2   = DateTime.Now.AddDays(1).ToString("yyyy-MM-dd");
            var infoSet = dm.QueryWithReturnDataSet("SELECT " +
                                                    "U.`ID` as `UID`, " +
                                                    "U.`Family` as `Фамилия`, " +
                                                    "U.`Name` as `Имя`, " +
                                                    "U.`Phone` as `Телефон`, " +
                                                    "U.`Email` as `Емейл`, " +
                                                    "U.`Login` as `Логин`, " +
                                                    "U.`Status` as `Статус`, " +
                                                    "U.`CreateDate` as `Дата регистрации`, " +
                                                    "U.`Discount` as `Скидка`, " +
                                                    "U.`SpecialClient` as `Особый клиент`, " +
                                                    "U.`IsCourse` as `Может выставлять курсы`, " +
                                                    "U.`Note` as `Заметка`, " +
                                                    "CONCAT(UU.`Family`,\" \", UU.`Name`) as `Ответственный менеджер`, " +
                                                    "CONCAT(UUU.`Family`,\" \", UUU.`Name`) as `Ответств. мен. по прод.`, " +
                                                    "(SELECT COUNT(*) FROM `tickets` T WHERE T.`UserID` = U.ID AND (T.`CreateDate` BETWEEN '" + date1 + "' AND '" + date2 + "' )) as `Кол-во зявок за календ. месяц` " +
                                                    "FROM `users` U " +
                                                    "LEFT JOIN `users` UU ON U.`ManagerID` = UU.`ID` " +
                                                    "LEFT JOIN `users` UUU ON U.`SalesManagerID` = UUU.`ID` " +
                                                    "WHERE U.`Role` = 'User' AND U.`ID` <> 1 AND U.`Status` = 2;");
            const string fileName = "полная_информация_клиентов_с_которыми_работаем";

            ExportMethods.CreateXlsFile(Response, infoSet, fileName, "users");
        }
Esempio n. 2
0
        IGenerateAction ICodeGenerator.InitalizeSelection(CodeGenerationOptions options, TreeView treeView)
        {
            var exportMethods = new ExportMethods(this, options);

            exportMethods.Initialize(treeView);
            return(exportMethods);
        }
Esempio n. 3
0
        protected void lbGetAllUsersProfilesInfo_Click(object sender, EventArgs e)
        {
            var dm      = new DataManager();
            var infoSet = dm.QueryWithReturnDataSet("SELECT " +
                                                    "P.`ID` as `PID`, " +
                                                    "P.`UserID` as `UID`, " +
                                                    "CONCAT(U.`Family`, \" \", U.`Name`) as `Клиент`, " +
                                                    "P.`FirstName` as `Фамилия`, " +
                                                    "P.`LastName` as `Имя`, " +
                                                    "P.`ThirdName` as `Отчество`, " +
                                                    "P.`ContactPhoneNumbers` as `Контактный телефон`, " +
                                                    "P.`ContactPersonFIO` as `Контактное лицо`, " +
                                                    "P.`TypeID` as `Тип профиля` , " +
                                                    "P.`StatusID` as `Статус`, " +
                                                    "P.`RejectBlockedMessage` as `Расшифровка статуса` , " +
                                                    "CONCAT(P.`PassportSeria`,\" \", P.`PassportNumber`) as `Серия и номер паспорта`, " +
                                                    "P.`PassportData` as `Выда кем`," +
                                                    "P.`PassportDate` as `Выдан когда`, " +
                                                    "P.`Address` as `Адрес проживания`, " +
                                                    "P.`CompanyName` as `Имя компании`, " +
                                                    "P.`CompanyAddress` as `Юр. адрес компании`, " +
                                                    "P.`PostAddress` as `Контактный адрес компании`," +
                                                    "P.`RasShet` as `Расчетный счет`, " +
                                                    "P.`UNP` as `УНП`, " +
                                                    "P.`BankName` as `Имя банка`, " +
                                                    "P.`BankCode` as `Код банка`, " +
                                                    "P.`BankAddress` as `Адрес банка`, " +
                                                    "P.`CreateDate` as `Дата создания`, " +
                                                    "P.`IsDefault` as `Профиль по умолч.` " +
                                                    "FROM `usersprofiles` P " +
                                                    "LEFT JOIN `users` U ON P.`UserID` = U.`ID` U.`Status` = 2;");
            const string fileName = "полная_информация_профилей_клиентов";

            ExportMethods.CreateXlsFile(Response, infoSet, fileName, "profiles");
        }
        protected void btnExport_Click(object sender, EventArgs e)
        {
            var dm = new DataManager();

            GetSearchString();
            var          infoSet  = dm.QueryWithReturnDataSet(SelectToExcelFile);
            const string fileName = "касса-рассчет";

            ExportMethods.CreateXlsFile(Response, infoSet, fileName, "calculation");
        }
        public void FixSpacingTest()
        {
            List <Subject> subjects = new List <Subject>
            {
                new Subject("MAT4", "Mathematics", "A*", "C"),
                new Subject("PHY4", "Physics", "B", "A*"),
                new Subject("GEO4", "Geography", "C", "B")
            };

            Assert.AreEqual("", ExportMethods.FixSpacing(subjects, subjects[0], "name"));
            Assert.AreEqual(" ", ExportMethods.FixSpacing(subjects, subjects[1], "actualGrade"));
            Assert.AreEqual(" ", ExportMethods.FixSpacing(subjects, subjects[2], "expectedGrade"));
        }
Esempio n. 6
0
 /**
  * <summary>This method effectively stores student data from the model classes into individual reports.</summary>
  *
  * <param name="sl">The School object where the data will be retrieved from.</param>
  */
 public void StoreReportData(School sl)
 {
     // IF statement checks the School object supplied as a parameter is not null.
     if (sl != null)
     {
         // Iterates through each AcademicYear object within the School object.
         sl.GetYears.ForEach(year =>
         {
             //Invokes the 'GenerateOutput' method from the ExportMethods utility class.
             ExportMethods.GenerateOutput(sl, year);
         });
     }
 }
Esempio n. 7
0
        public static DataTable GetReportTable <T>(this List <T> items, ExportMethods Method) where T : class
        {
            var result = new DataTable();

            result.Columns.Add(RGlobal.TableIndex, typeof(string));
            foreach (var p in typeof(T).GetProperties().OrderBy(p => p.GetOrder()))
            {
                if ((Method == ExportMethods.PDF && p.GetIsExportedToPDF()) ||
                    (Method == ExportMethods.Excel && p.GetIsExportedToExcel()))
                {
                    result.Columns.Add(p.ToDisplayName(), typeof(string));
                }
            }

            var index = -1;

            foreach (var item in items)
            {
                index++;
                var values = new List <string>
                {
                    (index + 1).ToString()
                };
                foreach (var p in typeof(T).GetProperties().OrderBy(p => p.GetOrder()))
                {
                    if ((Method == ExportMethods.PDF && p.GetIsExportedToPDF()) ||
                        (Method == ExportMethods.Excel && p.GetIsExportedToExcel()))
                    {
                        var v = p.GetValue(item, null);
                        if (v == null)
                        {
                            v = "";
                        }
                        values.Add(v.ToString());
                    }
                }

                result.Rows.Add(values.ToArray());
            }

            return(result);
        }
Esempio n. 8
0
        static async Task RunSimulationAsync(string csvOutputFile, AppSettings appSettings)
        {
            SimulatorConfiguration           simConfig;
            SimulatorEngine                  simEngine;
            IList <SimulatorEmployeeContact> allEmployeeContacts;
            SimulatorResult                  simulatorResult;

            try
            {
                simConfig = await CreateConfiguration(appSettings);

                simEngine           = new SimulatorEngine(simConfig);
                allEmployeeContacts = new List <SimulatorEmployeeContact>();
                simulatorResult     = new SimulatorResult();
                simEngine.InitializeSimulation();
            }
            catch (Exception exc)
            {
                LogMessage("ERROR", "Unable to configure and initialize the simulation: " + exc.ToString());
                throw exc;
            }

            try
            {
                LogMessage("INFO", "Starting simulation.");
                do
                {
                    simulatorResult = simEngine.RunNext();
                    allEmployeeContacts.AddRange(simulatorResult.EmployeeContacts);
                }while (!simulatorResult.IsSimulatorComplete && !simulatorResult.HasError);
                LogMessage("DEBUG", "Simulation complete. Creating output CSV file.");
                await ExportMethods.CreateSimulatorCsvLogAsync(allEmployeeContacts, simConfig.Employees, simConfig.WorkplaceRooms, simConfig.VirusStages, csvOutputFile);
            }
            catch (Exception exc)
            {
                LogMessage("ERROR", "Unable to complete simulation: " + exc.ToString());
                throw exc;
            }
        }
 public ExportDataFacade()
 {
     exportMeth = new ExportMethods();
 }
Esempio n. 10
0
		IGenerateAction ICodeGenerator.InitalizeSelection (CodeGenerationOptions options, TreeView treeView)
		{
			var exportMethods = new ExportMethods (this, options);
			exportMethods.Initialize (treeView);
			return exportMethods;
		}
Esempio n. 11
0
 public ExportMethod(Export Cdo, ExportMethods Method, Export_Parameters Parameters)
 {
     this.Cdo           = Cdo;
     this.ServiceMethod = Method;
     this.Parameters    = Parameters;
 }
 public void GetCurrentTimeTest()
 {
     Assert.AreEqual("18:22:00", ExportMethods.GetCurrentTime());
 }
 public void GetCurrentDateTest()
 {
     Assert.AreEqual("06/01/2020", ExportMethods.GetCurrentDate());
 }
 public void AddSpacesTest()
 {
     Assert.AreEqual("     ".Length, ExportMethods.AddSpaces(5).Length);
 }
        public void OutputFeedbackTest()
        {
            Assert.AreEqual("Julia Walters is outstanding, as they are exceeding their target grades for all of their subjects!", ExportMethods.OutputFeedback("Julia Walters", 4, 0, 0));
            Assert.AreEqual("Julia Walters is performing excellently, as they are exceeding their target grades for the majority of their subjects!", ExportMethods.OutputFeedback("Julia Walters", 3, 1, 0));
            Assert.AreEqual("Julia Walters is performing well, as they are exceeding their target grades for some of their subjects!", ExportMethods.OutputFeedback("Julia Walters", 2, 1, 1));

            Assert.AreEqual("Gareth Keenan is performing really well, as they are meeting their target grades for all of their subjects!", ExportMethods.OutputFeedback("Gareth Keenan", 0, 9, 0));
            Assert.AreEqual("Gareth Keenan is performing well, as they are meeting their target grades for most of their subjects!", ExportMethods.OutputFeedback("Gareth Keenan", 2, 6, 1));
            Assert.AreEqual("Gareth Keenan is performing okay, as they are meeting their target grades for some of their subjects!", ExportMethods.OutputFeedback("Gareth Keenan", 2, 4, 3));

            Assert.AreEqual("Brent Pritchard is performing adequately, however they could do more to achieve or exceed their target grades for more subjects!", ExportMethods.OutputFeedback("Brent Pritchard", 1, 1, 1));

            Assert.AreEqual("Mike Riley is performing horribly, as they are below their target grades for all of their subjects!", ExportMethods.OutputFeedback("Mike Riley", 0, 0, 14));
            Assert.AreEqual("Mike Riley is performing very poorly, as they are below their target grades for most of their subjects!", ExportMethods.OutputFeedback("Mike Riley", 2, 4, 8));
            Assert.AreEqual("Mike Riley is performing rather poorly, as they are below their target grades for some of their subjects!", ExportMethods.OutputFeedback("Mike Riley", 4, 3, 7));
            Assert.AreEqual("Mike Riley is performing a bit poorly, as they are below their target grades for a few of their subjects!", ExportMethods.OutputFeedback("Mike Riley", 5, 3, 6));
        }