public void init() { RawDataProvider = new ExcelDataProvider(); AllDataDataCubeProvider = new RawDataTransformer(); MainDataCubeProvider = new SliceTransformer(); YearDataCubeProvider = new YearVarTransformer(); KMeansDataCubeProvider = new KMeansDataTransformer(); KMeansForYearsProvider = new KMeansDataTransformer(); //read data from excel file RawDataProvider.HasIDColumn = true; RawDataProvider.Load(@"..\..\..\data\data.xls"); AllDataDataCubeProvider.Input = RawDataProvider; InterpolationCols = new List <int>(); InterpolationCols.Add(5); InterpolationCols.Add(11); AllDataDataCubeProvider.CollumnsForInterpolation = InterpolationCols; AllDataDataCubeProvider.UseInterpolation = true; AllDataDataCubeProvider.CommitChanges(); YearDataCubeProvider.Input = AllDataDataCubeProvider; MainDataCubeProvider.Input = AllDataDataCubeProvider; KMeansDataCubeProvider.Input = MainDataCubeProvider; KMeansForYearsProvider.Input = YearDataCubeProvider; // event listeners _mainWindow.interpolationCheckBox.CheckedChanged += new EventHandler(interpolationCheckBox_CheckedChanged); }
public void Test1() { ExcelDataProvider.PopulateInCollection(@"D:\Selenium_C#_PJT\NUnit_Flipkart_CS\NUnit_Flipkart_CS\TestData\FlipkartTestData.xlsx"); //Login to Filpkart test.Log(Status.Info, "Login to Filpkart"); HomePage homePage = new HomePage(driver); homePage.LoginToFlipkart_Step(ExcelDataProvider.ReadData(1, "UserName"), ExcelDataProvider.ReadData(1, "Password")); test.Log(Status.Info, "Logged in to Filpkart successsfully"); //Navigate to Electronics test.Log(Status.Info, "Navigate to Electronics"); LoggedInHomePage loggedInHomePage = new LoggedInHomePage(driver); loggedInHomePage.NavigateToElectronics(); test.Log(Status.Info, "Electronics popup displayed successfully"); //Navigate to MiMobile test.Log(Status.Info, "Navigate to MiMobile"); loggedInHomePage.NavigateToMiMobile(); test.Log(Status.Info, "MiMobile page is displayed successfully"); //Navigate to required mi mobile test.Log(Status.Info, "Navigate to required mi mobile"); MiMobilePage miMobilePage = new MiMobilePage(driver); miMobilePage.NaviagteToRequiredMobile(ExcelDataProvider.ReadData(1, "sProductName")); test.Log(Status.Info, "Required mi mobile selected successfully"); //Navigate to Add to cart test.Log(Status.Info, "Navigate to Add to cart"); AddToCartPage requiredMiMobilePage = new AddToCartPage(driver); requiredMiMobilePage.NavigateToAddToCart(); test.Log(Status.Info, "Add to cart page displayed sucessfully"); //Navigate to Place Order test.Log(Status.Info, "Navigate to Place Order"); PlaceOrderPage placeOrderPage = new PlaceOrderPage(driver); placeOrderPage.NavigateToPlaceOrder(); test.Log(Status.Info, "Place Order page displayed successfully"); //Add Details to Book the product test.Log(Status.Info, "Add Details to Book the product"); BookingPage addressBookingPage = new BookingPage(driver); addressBookingPage.AddDetailsToBookProduct(ExcelDataProvider.ReadData(1, "sName"), ExcelDataProvider.ReadData(1, "sMobileNumber"), ExcelDataProvider.ReadData(1, "sPincode"), ExcelDataProvider.ReadData(1, "sLocality"), ExcelDataProvider.ReadData(1, "sAddress"), ExcelDataProvider.ReadData(1, "sCity"), ExcelDataProvider.ReadData(1, "sLandmark"), ExcelDataProvider.ReadData(1, "sAlternativePhNum"), ExcelDataProvider.ReadData(1, "sCardNum"), ExcelDataProvider.ReadData(1, "sCVV")); test.Log(Status.Info, "Details added to Book the product successfully"); //Remove item from cart test.Log(Status.Info, "Remove item from cart"); requiredMiMobilePage.RemoveProductsFromCart(); test.Log(Status.Info, "Item removed from the cart successfully"); //Logout from flipkart test.Log(Status.Info, "Logout from flipkart"); homePage.LogoutFromFlipkart_Step(); test.Log(Status.Info, "Registered User logout from flipkart successfully"); }
public void Initialize() { _excelDataProvider = MockRepository.GenerateStub <ExcelDataProvider>(); _parser = new FormulaParser(_excelDataProvider); _package = new ExcelPackage(); _worksheet = _package.Workbook.Worksheets.Add("Test"); }
public void Setup() { _excelDataProvider = A.Fake <ExcelDataProvider>(); var parsingContext = ParsingContext.Create(); _graphBuilder = new ExpressionGraphBuilder(_excelDataProvider, parsingContext); }
private void _CheckForAndHandleExcelError(ExcelDataProvider.ICellInfo cell, ParsingContext context) { if (context.Scopes.Current.IsSubtotal) { CheckForAndHandleExcelError(cell); } }
private ParsingContext GetContext(ExcelDataProvider provider) { var ctx = ParsingContext.Create(); ctx.Scopes.NewScope(new RangeAddress(){Worksheet = WorksheetName, FromCol = 1, FromRow = 1}); ctx.ExcelDataProvider = provider; return ctx; }
public void Setup() { _excelDataProvider = MockRepository.GenerateStub <ExcelDataProvider>(); var parsingContext = ParsingContext.Create(); _graphBuilder = new ExpressionGraphBuilder(_excelDataProvider, parsingContext); }
private ParsingContext GetContext(ExcelDataProvider provider) { var ctx = ParsingContext.Create(); ctx.ExcelDataProvider = provider; return(ctx); }
public void Setup() { _parsingContext = ParsingContext.Create(); _excelDataProvider = MockRepository.GenerateStub <ExcelDataProvider>(); _parsingContext.ExcelDataProvider = _excelDataProvider; _builder = new CalculationChainBuilder(_parsingContext); }
public void Initialize() { _excelDataProvider = MockRepository.GenerateStub<ExcelDataProvider>(); _excelDataProvider.Stub(x => x.GetDimensionEnd(Arg<string>.Is.Anything)).Return(new ExcelCellAddress(10, 1)); _parser = new FormulaParser(_excelDataProvider); _package = new ExcelPackage(); _worksheet = _package.Workbook.Worksheets.Add("Test"); }
public void Initialize() { _excelDataProvider = MockRepository.GenerateStub <ExcelDataProvider>(); _excelDataProvider.Stub(x => x.GetDimensionEnd(Arg <string> .Is.Anything)).Return(new ExcelCellAddress(10, 1)); _parser = new FormulaParser(_excelDataProvider); _package = new ExcelPackage(); _worksheet = _package.Workbook.Worksheets.Add("Test"); }
public void Initialize() { _excelDataProvider = A.Fake <ExcelDataProvider>(); A.CallTo(() => _excelDataProvider.GetDimensionEnd(A <string> .Ignored)).Returns(new ExcelCellAddress(10, 1)); _parser = new FormulaParser(_excelDataProvider); _package = new ExcelPackage(); _worksheet = _package.Workbook.Worksheets.Add("Test"); }
public void GetDataNotNullTest() { var provider = new ExcelDataProvider(file); var data = provider.GetData(); Console.WriteLine(JsonConvert.SerializeObject(data)); Assert.AreNotEqual(null, data); }
private static bool IsSubTotal(ExcelDataProvider.ICellInfo c) { var tokens = c.Tokens; if (tokens == null) return false; return c.Tokens.Any(token => token.TokenType == LexicalAnalysis.TokenType.Function && token.Value.Equals("SUBTOTAL", StringComparison.InvariantCultureIgnoreCase) ); }
public RangeAddressFactory(ExcelDataProvider excelDataProvider, AddressTranslator addressTranslator, IndexToAddressTranslator indexToAddressTranslator) { Require.That(excelDataProvider).Named("excelDataProvider").IsNotNull(); Require.That(addressTranslator).Named("addressTranslator").IsNotNull(); Require.That(indexToAddressTranslator).Named("indexToAddressTranslator").IsNotNull(); _excelDataProvider = excelDataProvider; _addressTranslator = addressTranslator; _indexToAddressTranslator = indexToAddressTranslator; }
public ExcelDatabaseCriteria(ExcelDataProvider dataProvider, string range) { _dataProvider = dataProvider; var address = new ExcelAddressBase(range); _fromCol = address._fromCol; _toCol = address._toCol; _worksheet = address.WorkSheet; _fieldRow = address._fromRow; Initialize(); }
public ExcelAddressExpression(string expression, ExcelDataProvider excelDataProvider, ParsingContext parsingContext, RangeAddressFactory rangeAddressFactory) : base(expression) { Require.That(excelDataProvider).Named("excelDataProvider").IsNotNull(); Require.That(parsingContext).Named("parsingContext").IsNotNull(); Require.That(rangeAddressFactory).Named("rangeAddressFactory").IsNotNull(); _excelDataProvider = excelDataProvider; _parsingContext = parsingContext; _rangeAddressFactory = rangeAddressFactory; }
private static IEnumerable <object[]> getExcelData() { ExcelDataProvider testdata = new ExcelDataProvider(); //Iterate through retrieved spreadsheet rows foreach (Hashtable row in testdata.getExcelData()) { yield return(new object[] { row }); } }
private ParsingContext GetContext(ExcelDataProvider provider) { var ctx = ParsingContext.Create(); ctx.Scopes.NewScope(new RangeAddress() { Worksheet = WorksheetName, FromCol = 1, FromRow = 1 }); ctx.ExcelDataProvider = provider; return(ctx); }
public void GetDataNotSameTest() { var provider = new ExcelDataProvider(file); var data1 = provider.GetData(); var data2 = provider.GetData(); Console.WriteLine(JsonConvert.SerializeObject(data1)); Console.WriteLine(JsonConvert.SerializeObject(data2)); Assert.AreNotSame(data1, data2); }
public ExcelDatabaseCriteria(ExcelDataProvider dataProvider, string range) { _dataProvider = dataProvider; var address = new ExcelAddress(range); _fromCol = address._fromCol; _toCol = address._toCol; _worksheet = address.WorkSheet; _fieldRow = address._fromRow; Initialize(); }
static void TestAllVar() // Méthode pour calculer l'ensemble des VaR et de CVaR { DataProvider test = new ExcelDataProvider(@"C:\Users\baptc\VaR solution\VaR\Portfolio1.xlsx"); CalculVar[] tabCalculVar = new CalculVar[] { new VarHistorique(test), new VarMonteCarlo(test), new VarParametrique(test) }; foreach (CalculVar calculVar in tabCalculVar) { Tuple <double, double> resultat = calculVar.Calcul(); Console.WriteLine("VaR = " + resultat.Item1); Console.WriteLine("CVaR = " + resultat.Item2); } }
public ExcelDatabase(ExcelDataProvider dataProvider, string range) { _dataProvider = dataProvider; var address = new ExcelAddressBase(range); _fromCol = address._fromCol; _toCol = address._toCol; _fieldRow = address._fromRow; _endRow = address._toRow; _worksheet = address.WorkSheet; _rowIndex = _fieldRow; Initialize(); }
public void Setup() { _idProvider = new IntegerIdProvider(); _provider = MockRepository.GenerateStub <ExcelDataProvider>(); SetupExcelProvider(); _idProvider = new IntegerIdProvider(); _chainContext = CalcChainContext.Create(_idProvider); _builder = new CalcChainContextBuilder(); _parsingContext = ParsingContext.Create(); _parsingContext.RangeAddressFactory = new RangeAddressFactory(_provider); _parsingContext.Configuration.SetIdProvider(_idProvider); _parsingContext.Configuration.SetLexer(new Lexer(_parsingContext.Configuration.FunctionRepository, _parsingContext.NameValueProvider)); _parsingContext.ExcelDataProvider = _provider; }
public FormulaParser(ExcelDataProvider excelDataProvider, ParsingContext parsingContext) { parsingContext.Parser = this; parsingContext.ExcelDataProvider = excelDataProvider; parsingContext.NameValueProvider = new EpplusNameValueProvider(excelDataProvider); parsingContext.RangeAddressFactory = new RangeAddressFactory(excelDataProvider); _parsingContext = parsingContext; _excelDataProvider = excelDataProvider; Configure(configuration => { configuration .SetLexer(new Lexer(_parsingContext.Configuration.FunctionRepository, _parsingContext.NameValueProvider)) .SetGraphBuilder(new ExpressionGraphBuilder(excelDataProvider, _parsingContext)) .SetExpresionCompiler(new ExpressionCompiler()) .FunctionRepository.LoadModule(new BuiltInFunctions()); }); }
public static void Ex() { LearningPipeline pipeline = new LearningPipeline(); pipeline.Add(new TextLoader(@"C:\Users\Дарья\Desktop\AdverbNoun.csv").CreateFrom <Model>(useHeader: true, separator: ',')); pipeline.Add(new Dictionarizer(("Category", "Label"))); pipeline.Add(new TextFeaturizer("Features", "Word")); pipeline.Add(new StochasticDualCoordinateAscentClassifier()); //Vec < R4, 472 > pipeline.Add(new PredictedLabelColumnOriginalValueConverter() { PredictedLabelColumn = "PredictedLabel" }); var model = pipeline.Train <Model, CategoryPrediction>(); model.WriteAsync(@"C:\Users\Дарья\Desktop\NewModel.zip"); model = PredictionModel.ReadAsync <Model, CategoryPrediction>(@"C:\Users\Дарья\Desktop\NewModel.zip").Result; var testData = new TextLoader(@"C:\Users\Дарья\Desktop\TestAdverbNoun.csv").CreateFrom <Model>(useHeader: true, separator: ','); var evaluator = new ClassificationEvaluator(); var metrics = evaluator.Evaluate(model, testData); Console.WriteLine($"AccuracyMicro: {metrics.AccuracyMicro}\nAccuracyMacro: {metrics.AccuracyMacro}"); var data = ExcelDataProvider.GetData(@"C:\Users\Дарья\Desktop\TestAdverbNoun.xlsx", 0); List <Model> models = new List <Model>(); data.ForEach(x => models.Add(new Model() { Category = x.Category, Word = x.Word })); foreach (var sample in models) { var prediction = model.Predict(sample); Console.WriteLine($"Word: {sample.Word}"); Console.WriteLine($"\nActual Category: {sample.Category} \nPredicted Category: {prediction.Category}\nPredicted Category scores: [{String.Join(",", prediction.Score)}]\n\n"); } Console.ReadLine(); }
static void TestSimulation() // Méthode pour tester le taux d'erreur des VaR { DataProvider dp = new ExcelDataProvider(@"C:\Users\baptc\VaR solution\VaR\Portfolio1.xlsx"); Backtesting simulation = new Backtesting(dp); double errorRateHisto = simulation.StartSimulation(); Console.WriteLine("Ratio erreur VaR Historique = " + errorRateHisto); simulation = new BacktestingParametrique(dp); double errorRateParametrique = simulation.StartSimulation(); Console.WriteLine("Ratio erreur VaR Paramétrique = " + errorRateParametrique); simulation = new BacktestingMonteCarlo(dp); double errorRateMC = simulation.StartSimulation(); Console.WriteLine("Ratio erreur VaR MC = " + errorRateMC); }
protected List<int> GetMatchIndexes(ExcelDataProvider.IRangeInfo rangeInfo, object searched) { var result = new List<int>(); var internalIndex = 0; for (var row = rangeInfo.Address._fromRow; row <= rangeInfo.Address._toRow; row++) { for (var col = rangeInfo.Address._fromCol; col <= rangeInfo.Address._toCol; col++) { var candidate = rangeInfo.GetValue(row, col); if (Evaluate(candidate, searched)) { result.Add(internalIndex); } internalIndex++; } } return result; }
static void Main(string[] args) { DataTable data = new DataTable("Categories of words"); data.Columns.Add("Category", "Word"); List <InputData> words = ExcelDataProvider.GetData(@"C:\Users\Дарья\Desktop\AdverbNoun.xlsx", 0); foreach (var word in words) { data.Rows.Add(word.Category, word.Word); } Codification codebook = new Codification(data, "Category", "Word"); DataTable symbols = codebook.Apply(data); int[][] inputs = symbols.ToJagged <int>("Category"); int[] outputs = symbols.ToArray <int>("Word"); var learner = new NaiveBayesLearning(); NaiveBayes nb = learner.Learn(inputs, outputs); data = new DataTable("Categories of words"); data.Columns.Add("Category", "Word"); words = ExcelDataProvider.GetData(@"C:\Users\Дарья\Desktop\TestAdverbNoun.xlsx", 0); foreach (var word in words) { data.Rows.Add(word.Category, word.Word); } int[] instance = codebook.Translate("helpful"); int c = nb.Decide(instance); string result = codebook.Translate("Category", c); double[] probs = nb.Probabilities(instance); Console.WriteLine(0); }
public static void ShowPredictResults(string dataPath, string modelPath, int predictDataSheetNumber) { MLContext mlContext = new MLContext(); List <InputData> inputs = ExcelDataProvider.GetData(dataPath, predictDataSheetNumber); List <Input> input = new List <Input>(); inputs.ForEach(x => input.Add(new Input(x.Category, x.Word))); IDataView dataView = mlContext.Data.LoadFromEnumerable <Input>(input); IEnumerable <Input> samples = mlContext.Data.CreateEnumerable <Input>(dataView, false); Console.WriteLine("Predictions"); foreach (var sample in samples) { Output predictionResult = Predict(sample, modelPath); Console.WriteLine($"Word: {sample.Word}"); //Console.WriteLine($"\nActual Category: {sample.Category} \nPredicted Category: {predictionResult.Category}\nPredicted Category scores: [{String.Join(",", predictionResult.Score)}]\n\n"); Console.WriteLine($"\nActual Category: {sample.Category} \nPredicted Category: {predictionResult.Prediction}\nPredicted Category scores: [{String.Join(",", predictionResult.Score)}]\n\n"); } Console.ReadKey(); }
public EpplusNameValueProvider(ExcelDataProvider excelDataProvider) { _excelDataProvider = excelDataProvider; _values = _excelDataProvider.GetWorkbookNameValues(); }
public void Setup() { _excelDataProvider = MockRepository.GenerateStub<ExcelDataProvider>(); var parsingContext = ParsingContext.Create(); _graphBuilder = new ExpressionGraphBuilder(_excelDataProvider, parsingContext); }
public ExpressionGraphBuilder(ExcelDataProvider excelDataProvider, ParsingContext parsingContext) : this(new ExpressionFactory(excelDataProvider, parsingContext), parsingContext) { }
public ExpressionFactory(ExcelDataProvider excelDataProvider, ParsingContext context) { _excelDataProvider = excelDataProvider; _parsingContext = context; }
public void Zeenyx() { ExcelDataProvider.PopulateInCollection(@"D:\Selenium\seleniumPJTs\NewZeenyx_CSharp\TestData\ZeenyxTestData.xlsx"); IWebDriver driver = new FirefoxDriver(); var LaunchInfo = extent.CreateTest("Zeenyx Web Site", "Request information about Ascential Test Tool"); LaunchInfo.Log(Status.Info, "Browser is launched."); //Navigate to naukri website driver.Url = "https://www.zeenyx.com/"; Console.WriteLine("Zeenyx Website is displayed!"); LaunchInfo.Log(Status.Info, " Zeenyx Website is displayed!"); driver.Manage().Window.Maximize(); //Contact Link driver.FindElement(By.XPath("//ul[@class='navbar-nav ml-auto']//a[contains(text(),'Contact')]")).Click(); Thread.Sleep(2000); //Firstname text field driver.FindElement(By.XPath("//input[@placeholder='First Name']")).SendKeys(ExcelDataProvider.ReadData(1, "FirstName")); //Lastname text field driver.FindElement(By.XPath("//input[@placeholder='Last Name']")).SendKeys(ExcelDataProvider.ReadData(1, "LastName")); //Email text field driver.FindElement(By.XPath("//input[@placeholder='Email Address']")).SendKeys(ExcelDataProvider.ReadData(1, "EmailAddress")); //Drop down select Subject SelectElement DropdownSelect = new SelectElement(driver.FindElement(By.XPath("//select[@name='input_3']"))); DropdownSelect.SelectByText(ExcelDataProvider.ReadData(1, "RequestSubject")); //Request Textfield driver.FindElement(By.XPath("//textarea[@placeholder='Message']")).SendKeys(ExcelDataProvider.ReadData(1, "Message")); //Screenshot var test = extent.CreateTest("Screenshot", " Capture Screenshot "); //test.Log(Status.Info, "First Setup of Warning test methods."); //test.Log(Status.Info, " The Test Case is Executed."); Thread.Sleep(2000); //Screenshot string sScreenshotPath = Capture(driver, "ZeenyxSnap3"); test.AddScreenCaptureFromPath(sScreenshotPath); driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(3); driver.Close(); driver.Quit(); }
private double CalculateWithSumRange(ExcelDataProvider.IRangeInfo range, string criteria, ExcelDataProvider.IRangeInfo sumRange, ParsingContext context) { var retVal = 0d; foreach(var cell in range) { if (_evaluator.Evaluate(cell.Value, criteria)) { var or = cell.Row-range.Address._fromRow; var oc = cell.Column - range.Address._fromCol; if(sumRange.Address._fromRow+or <= sumRange.Address._toRow && sumRange.Address._fromCol+oc <= sumRange.Address._toCol) { var v = sumRange.GetOffset(or, oc); if (v is ExcelErrorValue) { throw (new ExcelErrorValueException((ExcelErrorValue)v)); } retVal += Util.ConvertUtil.GetValueDouble(v, true); } } } return retVal; }
private double CalculateSingleRange(ExcelDataProvider.IRangeInfo range, string expression, ParsingContext context) { var retVal = 0d; foreach (var candidate in range) { if (_evaluator.Evaluate(candidate.Value, expression)) { if (candidate.IsExcelError) { throw (new ExcelErrorValueException((ExcelErrorValue)candidate.Value)); } retVal += candidate.ValueDouble; } } return retVal; }
internal static bool ShouldIgnore(bool ignoreHiddenValues, ExcelDataProvider.ICellInfo c, ParsingContext context) { return (ignoreHiddenValues && c.IsHiddenRow) || (context.Scopes.Current.IsSubtotal && IsSubTotal(c)); }
public FormulaParser(ExcelDataProvider excelDataProvider) : this(excelDataProvider, ParsingContext.Create()) { }
public void Setup() { _excelDataProvider = MockRepository.GenerateStub<ExcelDataProvider>(); _excelDataProvider.Stub(x => x.ExcelMaxRows).Return(ExcelMaxRows); _addressTranslator = new AddressTranslator(_excelDataProvider); }
private List <InputData> GetDataFromExcel(int worksheetIndex) { return(ExcelDataProvider.GetData(data.DataPath, worksheetIndex)); }
private void InitializeData() { excelDataProvider = new ExcelDataProvider(); excelDataProvider.HasIDColumn = true; //here, i can not use my data, if so ,it will crash. so i comment you component //temporarily excelDataProvider.Load("world data.xls"); mapData = new MapData(); mapData = MapReader.Read("world5.map", "world.dbf"); //int i = mapData.GetRegionId(0.3f,0.4f); }
public ExcelAddressExpression(string expression, ExcelDataProvider excelDataProvider, ParsingContext parsingContext, bool negate) : this(expression, excelDataProvider, parsingContext, new RangeAddressFactory(excelDataProvider), negate) { }
public AddressTranslator(ExcelDataProvider excelDataProvider) { Require.That(excelDataProvider).Named("excelDataProvider").IsNotNull(); _excelDataProvider = excelDataProvider; }
public void Setup() { _provider = MockRepository.GenerateStub <ExcelDataProvider>(); _parser = new FormulaParser(_provider); }
public void Setup() { _excelDataProvider = A.Fake <ExcelDataProvider>(); A.CallTo(() => _excelDataProvider.ExcelMaxRows).Returns(ExcelMaxRows); _addressTranslator = new AddressTranslator(_excelDataProvider); }
public RangeAddressFactory(ExcelDataProvider excelDataProvider) : this(excelDataProvider, new AddressTranslator(excelDataProvider), new IndexToAddressTranslator(excelDataProvider, ExcelReferenceType.RelativeRowAndColumn)) { }
private void SetupTranslator(int maxRows, ExcelReferenceType refType) { _excelDataProvider = MockRepository.GenerateStub<ExcelDataProvider>(); _excelDataProvider.Stub(x => x.ExcelMaxRows).Return(maxRows); _indexToAddressTranslator = new IndexToAddressTranslator(_excelDataProvider, refType); }
public void Setup() { _provider = MockRepository.GenerateStub<ExcelDataProvider>(); _parser = new FormulaParser(_provider); }
public void GenerateChart(bool showBarCode, string extraData, Stream output) { var pageRect = new Rectangle((float) ConvertUtil.INToPdf(10.5), (float) ConvertUtil.INToPdf(12.48)); var maxElements = CalculateTotalPatchesPerPage(pageRect); var barSize = (float) maxElements.ColumnNumber * PatchSize; var dataProvider = new ExcelDataProvider(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Resources\pe34483.xls")); bool firstPage = true; using (var pdfDoc = new Document(pageRect)) { var writer = PdfWriter.GetInstance(pdfDoc, output); pdfDoc.Open(); using (var reader = dataProvider.GetDataReader()) { if (!reader.Read()) return; while (reader.Read()) { if (!firstPage) { pdfDoc.NewPage(); } var canvas = writer.DirectContent; var upBarPoint = DrawUpperRectangle(canvas, pageRect, barSize); var chartPoint = new Point(upBarPoint.X, (upBarPoint.Y - PosBar2Chart) + BarHeight); var endUpBarPoint = new Point(upBarPoint.X + barSize, upBarPoint.Y); DrawPatches(pageRect, canvas, chartPoint, endUpBarPoint, maxElements, reader); DrawPageBorder(writer, pdfDoc, canvas); if (showBarCode) { DrawBarCode(canvas, pageRect); } firstPage = false; } } pdfDoc.Close(); } }
/// <summary> /// If the supplied <paramref name="cell"/> contains an Excel error /// an <see cref="ExcelErrorValueException"/> with that errorcode will be thrown /// </summary> /// <param name="cell"></param> protected void CheckForAndHandleExcelError(ExcelDataProvider.ICellInfo cell) { if (cell.IsExcelError) { throw (new ExcelErrorValueException(ExcelErrorValue.Parse(cell.Value.ToString()))); } }
public IndexToAddressTranslator(ExcelDataProvider excelDataProvider) : this(excelDataProvider, ExcelReferenceType.AbsoluteRowAndColumn) { }
public IndexToAddressTranslator(ExcelDataProvider excelDataProvider, ExcelReferenceType referenceType) { Require.That(excelDataProvider).Named("excelDataProvider").IsNotNull(); _excelDataProvider = excelDataProvider; _excelReferenceType = referenceType; }
public void Setup() { _provider = MockRepository.GenerateStub<ExcelDataProvider>(); _provider.Stub(x => x.ExcelMaxRows).Return(5000); }
public TableLensEncapsulator(IDataCubeProvider data, ExcelDataProvider excelDataProvider) { this.excelDataProvider = excelDataProvider; this.data = data; // color map colorMapForTableLens = new ColorMap(); colorMapForTableLens.AddColorMapPart(new LinearRgbColorMapPart(Color.Blue, Color.Red)); // transpos List<int> selected = new List<int>(); selected.Add(SelectedIndex); lensDataTransformer = new TransposDataTransformer(); lensDataTransformer.Input = this.data; lensDataTransformer.SelectedCountry = selected; lensDataTransformer.SelectedIndicator = SelectedIndicator; lensDataTransformer.GetDataCube(); // table lens tablelens = new TableLens(); lensDataTransformer.SelectedCountry = new List<int>(){0}; tablelens.Input = lensDataTransformer.GetDataCube(); colorMapForTableLens.Input = tablelens.Input; tablelens.ColorMap = colorMapForTableLens; List<string> countrylist = new List<string>(); countrylist.Add(excelDataProvider.RowIds[SelectedIndex]); tablelens.HeadersList = countrylist; }
public Algo(string ExcelFilePath) { _provider = new Helpers.ExcelDataProvider(); _provider.Init(ExcelFilePath); }