private static void WriteBody(SLDocument sl, U2Report u2Report)
        {
            var rowStart = u2Report.Headers.Count + 2;

            for (var rowIndex = 1; rowIndex < u2Report.Body.Count; rowIndex++)
            {
                var rowContent = ReportReader.GetBodyCells(u2Report.Body[rowIndex]);



                for (var columnIndex = 1; columnIndex < rowContent.Count; columnIndex++)
                {
                    var content = rowContent[columnIndex - 1];


                    var rowPosition = rowStart + rowIndex;

                    if (u2Report.IsMoneyColumn(columnIndex))
                    {
                        PrintMoneyCell(sl, rowPosition, columnIndex, content);
                    }
                    else
                    {
                        sl.SetCellValue(rowPosition, columnIndex, content);
                        if (rowIndex % 2 == 0)
                        {
                            sl.SetCellStyle(rowPosition, columnIndex, U2ReportStyles.GetStripStyle(sl));
                        }
                    }
                }
            }
        }
 public void RefreshPath()
 {
     staticTimer.start("Total");
     if (System.IO.Directory.Exists(reportsPath))
     {
         reader = new ReportReader(reportsPath);
         if (reader.UnprocessedReports.Count != 0)
         {
             pathFeedback = $"Some report folders were names incorrectly ({reader.UnprocessedReports[0].GetReportDirectory()})";
         }
         else
         {
             pathFeedback = "";
         }
         NotifyOfPropertyChange(() => pathFeedback);
         actions.Clear();
         foreach (string action in reader.GetActionList())
         {
             actions.Add(action);
         }
         NotifyOfPropertyChange(() => actions);
         NotifyOfPropertyChange(() => reportsPath);
     }
     staticTimer.stop("Total");
     staticTimer.log("Total");
 }
 /// <summary>
 /// Desc:Method is used to Verify all the filled fields and after verified click on edit button.
 /// </summary>
 public void VerifyAllTheFiledsAndClickOnEdit(DataRow dataRow)
 {
     try
     {
         if (dataRow != null)
         {
             lst_detail = new List <string>();
             string name = dataRow["title"].ToString() + ' ' + dataRow["firstname"].ToString() + ' ' + dataRow["middlename"].ToString() + ' ' + dataRow["lastname"].ToString();
             status = AssertAreEqual((GeneralDonation_Locator.lbl_ctl00_content_ucDonationReview_ucProfile_lblName), name);
             MethodToAddDataInList("Verify the name-" + status);
             status = AssertAreEqual((GeneralDonation_Locator.lbl_ctl00_content_ucDonationReview_ucProfile_lblEmail), dataRow["emailid"].ToString());
             MethodToAddDataInList("Verify the email-" + status);
             status = AssertAreEqual((GeneralDonation_Locator.lbl_ctl00_content_ucDonationReview_ucProfile_lblCountry), dataRow["country"].ToString());
             MethodToAddDataInList("Verify the country-" + status);
             status = AssertAreEqual((GeneralDonation_Locator.lbl_ctl00_content_ucDonationReview_ucProfile_lblCity), dataRow["city"].ToString());
             MethodToAddDataInList("Verify the city-" + status);
             status = AssertAreEqual((GeneralDonation_Locator.lbl_ctl00_content_ucDonationReview_ucProfile_lblPostalCode), dataRow["postal"].ToString());
             MethodToAddDataInList("Verify the postal-" + status);
             status = AssertAreEqual((GeneralDonation_Locator.lbl_ctl00_content_ucDonationReview_ucPayment_ucCardPayment_lblCardHolder), dataRow["cardholdername"].ToString());
             MethodToAddDataInList("Verify the cardholdername-" + status);
             status = AssertAreEqual((GeneralDonation_Locator.lbl_ctl00_content_ucDonationReview_ucPayment_ucCardPayment_lblExpirationMonth), dataRow["expmonth"].ToString());
             MethodToAddDataInList("Verify the expmonth-" + status);
             status = AssertAreEqual((GeneralDonation_Locator.lbl_ctl00_content_ucDonationReview_ucPayment_ucCardPayment_lblExpirationYear), dataRow["expyear"].ToString());
             MethodToAddDataInList("Verify the expyear-" + status);
         }
         status = ClickOnElementWhenElementFound(GeneralDonation_Locator.btn_Edit);
         MethodToAddDataInList("Click on edit button-" + status);
         ReportReader.AfterTest(System.Reflection.MethodBase.GetCurrentMethod().Name, lst_detail);
     }
     catch (Exception e)
     {
         ReportFailure(e.Message, System.Reflection.MethodBase.GetCurrentMethod().Name);
     }
 }
        public IEnumerable <ParamsItem> GetBotParamsFromOptimisationPass(string botName, string optimisationName)
        {
            var files = workingDirectory.Reports.GetDirectory(optimisationName)?.GetFiles();

            if (!files.Any(x => x.Name == "Forward.xml"))
            {
                throw new Exception("Can`t find file named 'Forward.xml'");
            }
            var forwardOptimisations = files.First(x => x.Name == "Forward.xml");

            if (!files.Any(x => x.Name == "OptimisationSettings.set"))
            {
                throw new Exception("Can`t find 'OptimisationSettings.set' file");
            }
            var setFile = files.First(x => x.Name == "OptimisationSettings.set");

            using (ReportReader reader = new ReportReader(forwardOptimisations.FullName))
            {
                if (reader.RelativePathToBot != botName)
                {
                    throw new Exception($"Expected {reader.RelativePathToBot} expert, but selected {botName}");
                }
            }

            SetFileManager setFileReader = new SetFileManager(setFile.FullName, false);

            return(setFileReader.Params);
        }
        public XmlSerializer()
        {
            Configuration = new XmlSerializerConfiguration();
            var xmlAttributeInterpreter = new XmlAttributeInterpreter();

            reportReader = new ReportReader(new ContentReaderCollection(xmlAttributeInterpreter, Configuration.OnDeserialize));
            reportWriter = new ReportWriter(new ContentWriterCollection(xmlAttributeInterpreter));
        }
        private void bpaste_Click(object sender, EventArgs e)
        {
            // Paste
            if (subreportedit.SelectedSection == null)
            {
                MessageBox.Show("Select a destination section first");
                return;
            }
            if (!Clipboard.ContainsText())
            {
                MessageBox.Show("Clipboard data not valid");
                return;
            }
            string ntext = Clipboard.GetText().Trim();

            if (ntext.Length < 10)
            {
                MessageBox.Show("Clipboard content not valid");
                return;
            }
            if (ntext.Substring(0, 8) != "<SECTION")
            {
                MessageBox.Show("Clipboard content not valid");
                return;
            }
            Section sec     = subreportedit.SelectedSection;
            Report  nreport = new Report();
            {
                ReportReader rreader = new ReportReader(nreport);
                {
                    List <PrintPosItem> nlist = rreader.ReadFromString(ntext);
                    foreach (PrintPosItem xitem in nlist)
                    {
                        // Validate name
                        if (FReport.Components.IndexOfKey(xitem.Name) >= 0)
                        {
                            FReport.GenerateNewName(xitem);
                        }
                        FReport.Components.Add(xitem.Name, xitem);
                        sec.Components.Add(xitem);
                        xitem.Section = sec;
                    }
                    subreportedit.Redraw();
                    // Select recently added items
                    subreportedit.ClearSelection();
                    foreach (PrintPosItem xitem in nlist)
                    {
                        subreportedit.SelectedItems.Add(xitem.SelectionIndex, xitem);
                    }
                }
            }
            BandInfo nband = subreportedit.BandsList[sec.SelectionIndex];

            subreportedit.SelectedItemsBands.Add(sec.SelectionIndex, nband);
            subreportedit.SelectPosItem();
            AfterSelectDesign(this, null);
            subreportedit.parentcontrol.Invalidate();
        }
        public void SetUp()
        {
            var columns = "Debitos:Saldo:Creditos:Base";


            u2Report =
                ReportReader.Load(
                    @"C:\Users\zyghtadmin\source\repos\U2ToExcel\U2ToExcel\Resources\CP0220RU2.csv", columns);
        }
Beispiel #8
0
        public static bool ReadFile(List <OptimisationResult> data,
                                    string pathToReportFile,
                                    string expectedCurecncy  = null,
                                    double?expectedBalance   = null,
                                    int?expectedLaverage     = null,
                                    string expectedPathToBot = null,
                                    bool deleteAfterReading  = true)
        {
            if (!File.Exists(pathToReportFile))
            {
                return(false);
            }

            bool ans = false;

            using (ReportReader reader = new ReportReader(pathToReportFile))
            {
                if (!string.IsNullOrEmpty(expectedCurecncy) &&
                    !string.IsNullOrWhiteSpace(expectedCurecncy) &&
                    reader.Currency != expectedCurecncy)
                {
                    throw new Exception("Currency is different");
                }
                if (!string.IsNullOrEmpty(expectedPathToBot) &&
                    !string.IsNullOrWhiteSpace(expectedPathToBot) &&
                    reader.RelativePathToBot != expectedPathToBot)
                {
                    throw new Exception("Path to bot is different");
                }
                if (expectedBalance.HasValue &&
                    reader.Balance != expectedBalance.Value)
                {
                    throw new Exception("Balance is different");
                }
                if (expectedLaverage.HasValue &&
                    reader.Laverage != expectedLaverage)
                {
                    throw new Exception("Laverage is different");
                }

                while (reader.Read())
                {
                    data.Add(reader.ReportItem.Value);
                    if (!ans)
                    {
                        ans = true;
                    }
                }
            }

            if (deleteAfterReading)
            {
                File.Delete(pathToReportFile);
            }

            return(ans);
        }
 public BaseWidget(XmlNode node)
 {
     this.Col         = Convert.ToInt32(ReportReader.GetValue(node, "col"));
     this.Row         = Convert.ToInt32(ReportReader.GetValue(node, "row"));
     this.Height      = Convert.ToInt32(ReportReader.GetValue(node, "height"));
     this.Casing      = (CasingEnum)Enum.Parse(typeof(CasingEnum), ReportReader.GetValue(node, "conversion"));
     this.Justify     = (JustifyEnum)Enum.Parse(typeof(JustifyEnum), ReportReader.GetValue(node, "justify"));
     this.IsBold      = ReportReader.GetValue(node, "bold") == "True";
     this.IsItalic    = ReportReader.GetValue(node, "italic") == "True";
     this.IsUnderline = ReportReader.GetValue(node, "underline") == "True";
 }
Beispiel #10
0
 // Autogenerated method
 //  public static org.xdef.XDInput createXDInput(org.xdef.sys.ReportReader);
 /// <summary>Creates XDInput from InputStream.</summary>
 /// <param name="value">ReportReader.</param>
 /// <returns>the XDInput object.</returns>
 public XDInput CreateXDInput(ReportReader value)
 {
     using (var builder = new BigEndianDataBuilder())
     {
         builder.Add(value.ObjectId);
         var res = SendRequestWithResponse(new Request(FUNCTION_CREATEXDINPUT_3, builder.Build(), ObjectId));
         using (var reader = res.Reader)
         {
             return(new XDInput(reader.ReadInt32(), _client));
         }
     }
 }
        public void Can_sucessfully_process_the_failing_tests()
        {
            ReportReader reader = new ReportReader(ExtractResourceAttribute.Stream);
            reader.ReadReport();

            // Count the resulting entries
            int failingTests = 0;
            foreach (TestResult test in reader.TestResults)
                failingTests++;

            Assert.AreEqual(4, failingTests);
        }
        public StrictXmlSerializer()
        {
            var xmlAttributeInterpreter = new XmlAttributeInterpreter();

            var onDeserializeConfiguration = new OnDeserializeConfiguration();

            onDeserializeConfiguration.OnUnexpectedElement   += OnUnexpectedElement;
            onDeserializeConfiguration.OnUnexpectedAttribute += OnUnexpectedAttribute;

            reportReader = new ReportReader(new ContentReaderCollection(xmlAttributeInterpreter, onDeserializeConfiguration));
            reportWriter = new ReportWriter(new ContentWriterCollection(xmlAttributeInterpreter));
        }
        public void WriteWalletTest()
        {
            var columns = "Plazo:Dias-V:Corriente:V 1-30:V 31-60:V 61-90:V 91-120:V 121-180:V 181-360:V 360-mas:TOTAL                                                                                                                   ";

            u2Report =
                ReportReader.Load($"{resourcesPath}CARTERA-U2.csv", columns);


            var destinationPath = $@"Catera.xlsx";

            U2ReportExcelWriter.WriteReport(u2Report, destinationPath);

            Assert.IsTrue(File.Exists(destinationPath));
        }
        private IEnumerable<TestResult> GetTestResults()
        {
            var reportPath = GetMostRecentReport();

            IEnumerable<TestResult> testResults;
            using (var fileStream = new FileStream(reportPath, FileMode.Open))
            {
                var reader = new ReportReader(fileStream);
                reader.ReadReport();
                testResults = reader.TestResults;
            }

            return testResults;
        }
 /// <summary>
 /// Desc:Method is used to Verify the transaction code is visible on the successful page.
 /// </summary>
 public void VerifyTheTransectionCodeVisible()
 {
     try
     {
         lst_detail = new List <string>();
         threadWait(3000);
         status = AssertIsTrue(GeneralDonation_Locator.lbl_TransactionCode);
         MethodToAddDataInList("Verify the TransectionCode is visible-" + status);
         status = ClickOnElementWhenElementFound(GeneralDonation_Locator.btn_PaymentStatus_Continue);
         MethodToAddDataInList("Click on continue button-" + status);
         ReportReader.AfterTest(System.Reflection.MethodBase.GetCurrentMethod().Name, lst_detail);
     }
     catch (Exception e)
     {
         ReportFailure(e.Message, System.Reflection.MethodBase.GetCurrentMethod().Name);
     }
 }
Beispiel #16
0
        public RulesView(ReportReader currentReport, IgnoreRuleGenerator ignorer, RowUpdater updater)
        {
            CurrentReport = currentReport;
            Ignorer       = ignorer;
            Updater       = updater;
            Modal         = true;

            var lblInitialSummary = new Label($"There are {ignorer.Rules.Count} ignore rules and {updater.Rules.Count} update rules.  Current report contains {CurrentReport.Failures.Length:N0} Failures");

            Add(lblInitialSummary);

            var lblEvaluate = new Label($"Evaluate:")
            {
                Y = Pos.Bottom(lblInitialSummary) + 1
            };

            Add(lblEvaluate);

            var ruleCollisions = new Button("Rule Coverage")
            {
                Y = Pos.Bottom(lblEvaluate)
            };

            ruleCollisions.Clicked += () => EvaluateRuleCoverage();
            Add(ruleCollisions);

            _treeView = new TreeView()
            {
                Y      = Pos.Bottom(ruleCollisions) + 1,
                Width  = Dim.Fill(),
                Height = Dim.Fill(1)
            };
            _treeView.KeyPress += _treeView_KeyPress;

            Add(_treeView);

            var close = new Button("Close", true)
            {
                Y = Pos.Bottom(_treeView)
            };

            close.Clicked += () => Quit();

            Add(close);
        }
        public MetaFile GetMetaFile()
        {
            // Execute the report and save the memory stream and
            // the mimetype on cache
            string cacheid = GetCacheId();
            // Check if there is a metafile
            MetaFile    meta     = (MetaFile)Page.Cache[cacheid + "MetaFile"];
            PrintOutNet prdriver = (PrintOutNet)Page.Cache[cacheid + "PrintOut"];

            if (prdriver == null)
            {
                meta = null;
            }
            if (meta == null)
            {
                Report rp = (Report)Page.Cache[cacheid + "Report"];
                if (rp == null)
                {
                    string filename = ReportFileName;
                    if (filename != "")
                    {
                        rp = new Report();
                        // Async execution
                        rp.AsyncExecution = AsyncExecution;
                        rp.AsyncPriority  = AsyncPriority;
                        ReportReader reader = new ReportReader(rp);
                        reader.LoadFromFile(Page.Server.MapPath(filename));
                        meta                 = rp.MetaFile;
                        meta.ForwardOnly     = false;
                        prdriver             = new PrintOutNet();
                        prdriver.OptimizeWMF = WMFOptimization.Gdiplus;
                        Page.Cache.Insert(cacheid + "Report", rp, null,
                                          DateTime.Now.AddMinutes(30), TimeSpan.Zero);
                        Page.Cache.Insert(cacheid + "MetaFile", meta, null,
                                          DateTime.Now.AddMinutes(30), TimeSpan.Zero);
                        Page.Cache.Insert(cacheid + "PrintOut", prdriver, null,
                                          DateTime.Now.AddMinutes(30), TimeSpan.Zero);
                        // Assign parameters to the report here
                        rp.BeginPrint(prdriver);
                    }
                }
            }
            return(meta);
        }
        public ValueWidget(XmlNode node) : base(node)
        {
            this.Width      = Convert.ToInt32(ReportReader.GetValue(node, "width"));
            this.Alignment  = (AlignmentEnum)Enum.Parse(typeof(AlignmentEnum), ReportReader.GetValue(node, "alignment"));
            this.CalcType   = (CalcEnum)Enum.Parse(typeof(CalcEnum), ReportReader.GetValue(node, "calc"));
            this.DataFormat = ReportReader.GetValue(node, "dataformat");
            this.DataType   = (TypeEnum)Enum.Parse(typeof(TypeEnum), ReportReader.GetValue(node, "datatype"));
            this.ResetType  = (ResetEnum)Enum.Parse(typeof(ResetEnum), ReportReader.GetValue(node, "reset"));
            this.ColumnName = ReportReader.GetValue(node, "datamember");
            this.TableName  = ReportReader.GetValue(node, "datasource");
            string arrIndex = ReportReader.GetValue(node, "arrayindex");

            if (arrIndex != "")
            {
                this.ArrayIndex = int.Parse(arrIndex);
            }
            this.NoDuplicates = bool.Parse(ReportReader.GetValue(node, "noduplicates"));
            m_calc            = FunctionFactory.Create(m_calcType);
        }
        public DonatePage ClickDonateButton()
        {
            DonatePage donatePage = null;

            try
            {
                lst_detail = new List <string>();
                EnumClasses.LogStatus status = ClickOnElementWhenElementFound(GeneralDonation_Locator.DonateButton);
                MethodToAddDataInList("Click on DonateButton-" + status);
                donatePage = new DonatePage(driver);
                PageFactory.InitElements(driver, donatePage);
                ReportReader.AfterTest(System.Reflection.MethodBase.GetCurrentMethod().Name, lst_detail);
                return(donatePage);
            }
            catch (Exception e)
            {
                Assert.Fail(e.Message);
                return(donatePage);
            }
        }
 /// <summary>
 /// Desc:Method used for fill Tribute Details
 /// </summary>
 /// <param name="datarow"></param>
 public void fillTributeDetails(DataRow datarow)
 {
     try
     {
         lst_detail = new List <string>();
         status     = SendKeysForElement(InHonourDonation_Locator.HonourFirstName, datarow["honourfirstname"].ToString());
         MethodToAddDataInList("Enter honourfirstname-" + status);
         status = SendKeysForElement(InHonourDonation_Locator.HonourLastName, datarow["honourlastname"].ToString());
         MethodToAddDataInList("Enter honourlastname-" + status);
         status = ClickOnElementWhenElementFound(InHonourDonation_Locator.eCardType);
         MethodToAddDataInList("Click on eCardType-" + status);
         status = ClickOnElementWhenElementFound(InHonourDonation_Locator.ContinueCardType);
         MethodToAddDataInList("Click on ContinueCardType-" + status);
         ReportReader.AfterTest(System.Reflection.MethodBase.GetCurrentMethod().Name, lst_detail);
     }
     catch (Exception e)
     {
         ReportFailure("TestFailure", System.Reflection.MethodBase.GetCurrentMethod().Name);
     }
 }
        private static void ProcessZipFiles()
        {
            using (var dbContext = new DealershipDbContext())
            {
                var data      = new DealershipData(dbContext);
                var employees = new DealershipRepository <Employee>(dbContext);
                var sales     = new DealershipRepository <Sale>(dbContext);
                var vehicles  = new DealershipRepository <Vehicle>(dbContext);
                var shops     = new DealershipRepository <Shop>(dbContext);

                SeedingSQLDBFromZip seedingSQLDBFromZip = new SeedingSQLDBFromZip(data, employees, shops, sales, vehicles);

                var processor = new ZipUnpacker();
                processor.Unpack(Constants.PathToZipFile, Constants.PathToUnzip);

                var          matchingDirectories = Utility.GetDirectoriesByPattern(Constants.PathToUnzippedFiles);
                ReportReader reportReader        = new ReportReader(seedingSQLDBFromZip, data);
                reportReader.ParseExcelData(matchingDirectories);
            }
        }
        private static void SetupColumnsFilter(SLDocument sl, U2Report u2Report)
        {
            var rowStart      = u2Report.Headers.Count + 2;
            var cellsContent  = ReportReader.GetBodyCells(u2Report.Body[0]);
            var columnCounter = 1;


            foreach (var line in cellsContent)
            {
                sl.SetCellValue(rowStart, columnCounter, line);
                sl.SetCellStyle(rowStart, columnCounter, U2ReportStyles.GetColumnsFilterStyle(sl));
                sl.SetColumnWidth(columnCounter, U2ReportStyles.ColumnWidth);

                columnCounter++;
            }

            var cellRef    = $"A{rowStart}";
            var cellRefEnd = $"XX{rowStart}";

            sl.Filter(cellRef, cellRefEnd);
        }
Beispiel #23
0
        //https://zyght.blob.core.windows.net/acorde-demo/net5.0.zip
        static void Main(string[] args)
        {
            var logRepository = LogManager.GetRepository(Assembly.GetEntryAssembly());

            XmlConfigurator.Configure(logRepository, new FileInfo("log4net.config"));


            Log.Info($"Start ------------------------");
            Log.Info($"Argumentos pasados {args.Length}: {args}");

            var reportArg = ArgumentHelper.GetArguments(args);


            if (string.IsNullOrWhiteSpace(reportArg.Origin) || string.IsNullOrWhiteSpace(reportArg.Destination))
            {
                Log.Error("Debe ingresar Nombre del informe origina (ruta), Nombre del informe final en el Excel ");

                return;
            }

            Log.Info($"Archivo origen: {reportArg.Origin}");
            Log.Info($"Archivo destino: {reportArg.Destination}");
            Log.Info($"Columnas numericas: {reportArg.MoneyColumns}");
            try
            {
                var u2Report = ReportReader.Load(reportArg.Origin, reportArg.MoneyColumns);
                Log.Info($"Lineas cargadas: {u2Report.Body.Count}");

                U2ReportExcelWriter.WriteReport(u2Report, reportArg.Destination);
            }
            catch (Exception e)
            {
                Log.Error(e);
            }



            Log.Info($"END ------------------------");
        }
 /// <summary>
 /// Desc:Method is used to verify all the filled fields and click on payment process button
 /// </summary>
 public void VerifyTheFieldsAndClickonPaymentProcess(DataRow dataRow)
 {
     try
     {
         lst_detail = new List <string>();
         string name = dataRow["title"].ToString() + ' ' + dataRow["ufirstname"].ToString() + ' ' + dataRow["umiddlename"].ToString() + ' ' + dataRow["ulastname"].ToString();
         status = AssertAreEqual((GeneralDonation_Locator.lbl_ctl00_content_ucDonationReview_ucProfile_lblName), name);
         MethodToAddDataInList("Verify the updated name-" + status);
         status = AssertAreEqual((GeneralDonation_Locator.lbl_ctl00_content_ucDonationReview_ucPayment_ucCardPayment_lblCardHolder), dataRow["ucardholdername"].ToString());
         MethodToAddDataInList("Verify the updated cardholdername-" + status);
         status = AssertAreEqual((GeneralDonation_Locator.lbl_ctl00_content_ucDonationReview_ucPayment_ucCardPayment_lblExpirationMonth), dataRow["expmonth"].ToString());
         MethodToAddDataInList("Verify the updated expmonth-" + status);
         status = AssertAreEqual((GeneralDonation_Locator.lbl_ctl00_content_ucDonationReview_ucPayment_ucCardPayment_lblExpirationYear), dataRow["expyear"].ToString());
         MethodToAddDataInList("Verify the updated expyear-" + status);
         status = ClickOnElementWhenElementFound(GeneralDonation_Locator.btn_ProcessPaymentNow);
         MethodToAddDataInList("Click on Process Payment button-" + status);
         ReportReader.AfterTest(System.Reflection.MethodBase.GetCurrentMethod().Name, lst_detail);
     }
     catch (Exception e)
     {
         ReportFailure(e.Message, System.Reflection.MethodBase.GetCurrentMethod().Name);
     }
 }
        /// <summary>
        /// Чтение файла с результатами оптимизаций
        /// </summary>
        /// <param name="file">Файл</param>
        /// <param name="expert">Имя жксперта</param>
        /// <param name="deposit">Депозит</param>
        /// <param name="currensy">Валюта депозита</param>
        /// <param name="laverage">Кредитное плечо</param>
        /// <returns>Список результатов оптимизации</returns>
        private List <OptimisationResult> GetItems(FileInfo file, out string expert,
                                                   out double deposit, out string currensy, out int laverage)
        {
            List <OptimisationResult> ans = new List <OptimisationResult>();

            using (ReportReader reader = new ReportReader(file.FullName))
            {
                expert   = reader.RelativePathToBot;
                deposit  = reader.Balance;
                currensy = reader.Currency;
                laverage = reader.Laverage;

                while (reader.Read())
                {
                    if (reader.ReportItem.HasValue)
                    {
                        ans.Add(reader.ReportItem.Value);
                    }
                }
            }

            return(ans);
        }
 /// <summary>
 /// Desc:Method is used to update some fileds and then click on continue button
 /// </summary>
 public void UpdateSomeFieldsAndContinue(DataRow dataRow)
 {
     try
     {
         lst_detail = new List <string>();
         status     = SendKeysForWebElement(GeneralDonation_Locator.txt_FirstName, dataRow["ufirstname"].ToString());
         MethodToAddDataInList("Enter the updated first name-" + status);
         status = SendKeysForWebElement(GeneralDonation_Locator.txt_MiddleName, dataRow["umiddlename"].ToString());
         MethodToAddDataInList("Enter the updated middle name-" + status);
         status = SendKeysForWebElement(GeneralDonation_Locator.txt_LastName, dataRow["ulastname"].ToString());
         MethodToAddDataInList("Enter the updated last name-" + status);
         status = SendKeysForWebElement(GeneralDonation_Locator.txt_EmailId, dataRow["uemailid"].ToString());
         MethodToAddDataInList("Enter the updated emailid-" + status);
         status = SendKeysForWebElement(GeneralDonation_Locator.txt_ConfirmEmailId, dataRow["uconfirmemailid"].ToString());
         MethodToAddDataInList("Enter the updated confirmemailid-" + status);
         explicitWait(GeneralDonation_Locator.txt_CreditCardNumber, 1000);
         status = SendKeysForWebElement(GeneralDonation_Locator.txt_CreditCardNumber, dataRow["creditcardnumber"].ToString());
         MethodToAddDataInList("Enter the creditcardnumber-" + status);
         explicitWait(GeneralDonation_Locator.txt_CardHolderName, 2000);
         status = SendKeysForWebElement(GeneralDonation_Locator.txt_CardHolderName, dataRow["ucardholdername"].ToString());
         MethodToAddDataInList("Enter the updated card holder name-" + status);
         explicitWait(GeneralDonation_Locator.ddl_ExpMonth, 2000);
         status = ClickOnElementWhenElementFound(GeneralDonation_Locator.ddl_ExpMonth);
         MethodToAddDataInList("Click on expmonth dropdown-" + status);
         selectValueFromDropdown(GeneralDonation_Locator.ddl_ExpMonth, dataRow["expmonth"].ToString());
         status = ClickOnElementWhenElementFound(GeneralDonation_Locator.ddl_ExpYear);
         selectValueFromDropdown(GeneralDonation_Locator.ddl_ExpYear, dataRow["expyear"].ToString());
         MethodToAddDataInList("Click on expyear dropdown-" + status);
         status = ClickOnElementWhenElementFound(GeneralDonation_Locator.btn_Main_Continue);
         MethodToAddDataInList("Click on continue button-" + status);
         ReportReader.AfterTest(System.Reflection.MethodBase.GetCurrentMethod().Name, lst_detail);
     }
     catch (Exception e)
     {
         ReportFailure(e.Message, System.Reflection.MethodBase.GetCurrentMethod().Name);
     }
 }
 /// <summary>
 /// Desc:Method used for verify In Honour Data
 /// </summary>
 /// <param name="datarow"></param>
 public void verifyInHonourData(DataRow dataRow)
 {
     try
     {
         if (dataRow != null)
         {
             lst_detail = new List <string>();
             status     = AssertAreEqual((InHonourDonation_Locator.FundAllocationText), dataRow["fundallocation"].ToString());
             MethodToAddDataInList("Verify the fundallocation-" + status);
             status = AssertAreEqual((InHonourDonation_Locator.CountryText), dataRow["country"].ToString());
             MethodToAddDataInList("Verify the country-" + status);
             status = AssertAreEqual((InHonourDonation_Locator.StateText), dataRow["state"].ToString());
             MethodToAddDataInList("Verify the state-" + status);
             status = AssertAreEqual((InHonourDonation_Locator.EmailText), dataRow["emailid"].ToString());
             MethodToAddDataInList("Verify the email-" + status);
             status = AssertAreEqual((InHonourDonation_Locator.CityText), dataRow["city"].ToString());
             MethodToAddDataInList("Verify the city-" + status);
             status = AssertAreEqual((InHonourDonation_Locator.Address1Text), dataRow["address1"].ToString());
             MethodToAddDataInList("Verify the address-" + status);
             status = AssertAreEqual((InHonourDonation_Locator.PostalText), dataRow["postal"].ToString());
             MethodToAddDataInList("Verify the postal-" + status);
             status = AssertAreEqual((InHonourDonation_Locator.CardHolderText), dataRow["cardholdername"].ToString());
             MethodToAddDataInList("Verify the CardHoldername-" + status);
             string tributeName = dataRow["honourfirstname"].ToString() + ' ' + dataRow["honourlastname"].ToString();
             status = AssertAreEqual((InHonourDonation_Locator.TributeHonourNameText), tributeName);
             MethodToAddDataInList("Verify the tributeName-" + status);
         }
         status = ClickOnElementWhenElementFound(InHonourDonation_Locator.ProcessPaymentButton);
         MethodToAddDataInList("Click on ProcessPaymentButton-" + status);
         ReportReader.AfterTest(System.Reflection.MethodBase.GetCurrentMethod().Name, lst_detail);
     }
     catch (Exception e)
     {
         ReportFailure("TestFailure", System.Reflection.MethodBase.GetCurrentMethod().Name);
     }
 }
Beispiel #28
0
 public HorizontalLineWidget(XmlNode node) : base(node)
 {
     this.Char  = Convert.ToChar(ReportReader.GetValue(node, "char"));
     this.Width = Convert.ToInt32(ReportReader.GetValue(node, "width"));
 }
 public void SetUp()
 {
     u2Report =
         ReportReader.Load(
            @"C:\Users\zyghtadmin\source\repos\U2ToExcel\U2ToExcel\Resources\REP-ORIGINAL-Short.csv");
 }
        public ActionResult Upload()
        {
            var u = InternalAttribute.GetUser();

            if (u != null)
            {
                HttpPostedFileBase file         = Request.Files["file"];
                string             guid         = Guid.NewGuid().ToString();
                string             path         = HttpContext.Server.MapPath("/Report1/Temp");
                string             backupPath   = HttpContext.Server.MapPath("/Report1/Backup");
                string             reportFolder = HttpContext.Server.MapPath("/Report1/ReportFiles");

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

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

                string fileName = Path.Combine(path, guid + "_" + file.FileName.Split('\\').Last());
                string type     = file.ContentType;
                file.SaveAs(fileName);
                FileInfo fi = new FileInfo(fileName);
                int      atId;
                try
                {
                    if (string.Compare(fi.Extension, ".zip", true) == 0 && int.TryParse(Request.Form["asset"], out atId) && atId > 0)
                    {
                        ZipFile.ExtractToDirectory(fileName, Path.Combine(reportFolder, guid));
                        string reportFile = Path.Combine(reportFolder, guid, "report.xml");
                        if (System.IO.File.Exists(reportFile))
                        {
                            XmlDocument xDoc = new XmlDocument();
                            xDoc.Load(reportFile);
                            Report rp = ReportReader.ReadReport(xDoc);
                            rp.Executor = User.Identity.Name;
                            rp.Uid      = u.Id;
                            using (var db = new SAPTestContext())
                            {
                                rp.Url = guid;
                                // "/Report1/ReportFiles/" + guid + "/report.xml";
                                Asset at = db.Assets.Find(atId);
                                if (at != null)
                                {
                                    rp.Asset = at;
                                }
                                db.Reports.Add(rp);
                                db.SaveChanges();
                            }
                            ViewBag.Flag = true;
                        }
                        else
                        {
                            Directory.Delete(Path.Combine(reportFolder, guid), true);
                            ViewBag.Flag = false;
                        }
                    }
                    else
                    {
                        ViewBag.Flag = false;
                    }
                    System.IO.File.Move(fileName, Path.Combine(backupPath, guid + ".zip"));
                }
                catch (Exception ex)
                {
                    ViewBag.ErrorMsg = ex.Message;
                    fi.Delete();
                    if (Directory.Exists(Path.Combine(reportFolder, guid)))
                    {
                        Directory.Delete(Path.Combine(reportFolder, guid), true);
                    }
                    throw new Exception();
                }
                MyReportFilter filter = new MyReportFilter();
                filter.isMyReport = true;
                return(RedirectToAction("Index", filter));
            }
            return(RedirectToAction("Index"));
        }
Beispiel #31
0
 public TextWidget(System.Xml.XmlNode node) : base(node)
 {
     this.Text = ReportReader.GetValue(node, "text");
 }