Exemplo n.º 1
0
        public double DivisaExist(string divisa)
        {
            //Cargar datos de DataAccess
            xmlFile      = new XmlFileRepository();
            CurrencyList = xmlFile.GetAllCurrencies();

            c    = new Currency();
            c.To = divisa;

            double match = 0;

            //Busco en bucle un resultado
            foreach (Currency tempListItem in CurrencyList)
            {
                if (tempListItem.To.Equals(c.To))
                { //Resultado encontrado. Almaceno el resultado en match y rompo el bucle.
                    match = tempListItem.Rate;
                    break;
                }
                else //No se encontro ningún resultado. Devuelvo -1
                {
                    match = -1;
                }
            }

            return(match);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Check if the wanted Currency exits and return
        /// the value, otherwise return -1
        /// </summary>
        /// <param name="divisa"></param>
        /// <returns></returns>
        public double DivisaExist(string divisa)
        {
            //XML File
            xmlFile      = new XmlFileRepository();
            CurrencyList = xmlFile.GetAllCurrencies();

            //Temp currency
            Currency c = new Currency();

            c.To = divisa;

            double match = 0;

            //Check for a match
            foreach (Currency tempListItem in CurrencyList)
            {
                if (tempListItem.To.Equals(c.To))
                { //Math found. Return rate from list
                    match = tempListItem.Rate;
                    break;
                }
                else //No match
                {
                    match = -1;
                }
            }

            return(match);
        }
Exemplo n.º 3
0
        public void Setup()
        {
            _transactionScope  = new TransactionScope();
            _xmlFileRepository = new XmlFileRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);

            _manCo1    = BuildMeA.ManCo("description", "name");
            _manCo2    = BuildMeA.ManCo("description2", "name2");
            _manCo3    = BuildMeA.ManCo("description3", "name3");
            _docType1  = BuildMeA.DocType("code", "description");
            _domicile1 = BuildMeA.Domicile("code", "description");
            _gridRun1  = BuildMeA.GridRun("grid", false, DateTime.Now, null, 0);

            _xmlFile1 =
                BuildMeA.XmlFile("documentSetId", "file1.xml", "littleZip.xml", false, DateTime.Now, DateTime.Now)
                .WithDocType(_docType1)
                .WithManCo(_manCo1)
                .WithDomicile(_domicile1);

            _xmlFile2 =
                BuildMeA.XmlFile("documentSetId", "file2.xml", "littleZip.xml", false, DateTime.Now, DateTime.Now)
                .WithDocType(_docType1)
                .WithManCo(_manCo1)
                .WithDomicile(_domicile1);

            _xmlFile3 =
                BuildMeA.XmlFile("documentSetId", "name3.xml", "littleZip.xml", false, DateTime.Now, DateTime.Now)
                .WithDocType(_docType1)
                .WithManCo(_manCo1)
                .WithDomicile(_domicile1);
        }
Exemplo n.º 4
0
        public static void CreateScriptXml(int index = 0)
        {
            var cmdLet   = CreateCmdLet(index);
            var fileName = @"Files\Scripts.xml";
            var rep      = new XmlFileRepository <CmdLet, Guid>();

            rep.Initialize(fileName);
            rep.Create(cmdLet);
        }
Exemplo n.º 5
0
        public static CmdLet LoadScriptXml(string scriptName)
        {
            var fileName = @"Files\Scripts.xml";
            var rep      = new XmlFileRepository <CmdLet, Guid>();

            rep.Initialize(fileName);
            var cmdLet = rep.Filter(x => x.Name == scriptName).FirstOrDefault();

            return(cmdLet);
        }
Exemplo n.º 6
0
 public void Initalize()
 {
     _fileName   = Path.GetTempFileName();
     _repository = new XmlFileRepository(_fileName);
 }
        public void Setup()
        {
            _transactionScope          = new TransactionScope();
            _documentRepository        = new DocumentRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _gridRunRepository         = new GridRunRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _xmlFileRepository         = new XmlFileRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);
            _houseHoldingRunRepository = new HouseHoldingRunRepository(ConfigurationManager.ConnectionStrings["Unity"].ConnectionString);

            _domicile = BuildMeA.Domicile("code", "description");
            _manCo1   = BuildMeA.ManCo("description1", "code1").WithDomicile(_domicile);
            _manCo2   = BuildMeA.ManCo("description2", "code2").WithDomicile(_domicile);
            _manCo3   = BuildMeA.ManCo("description3", "code3").WithDomicile(_domicile);
            _docType  = BuildMeA.DocType("code", "description");
            _docType2 = BuildMeA.DocType("code2", "description2");
            _docType3 = BuildMeA.DocType("code3", "description3");

            _application1 = new Application("code", "description");

            _subDocType1     = BuildMeA.SubDocType("code 1", "description 1").WithDocType(_docType);
            _subDocType2     = BuildMeA.SubDocType("code 2", "description 3").WithDocType(_docType);
            _houseHoldingRun = BuildMeA.HouseHoldingRun(DateTime.Now.AddMinutes(-10), DateTime.Now.AddMinutes(-2), "grid");

            _approval1 = BuildMeA.Approval("name", DateTime.Now);
            _approval2 = BuildMeA.Approval("name", DateTime.Now);
            _approval3 = BuildMeA.Approval("name", DateTime.Now);
            _approval4 = BuildMeA.Approval("name", DateTime.Now);
            _approval5 = BuildMeA.Approval("name", DateTime.Now);
            _export    = BuildMeA.Export(DateTime.Now);

            _rejection = BuildMeA.Rejection("user", DateTime.Now);

            _document  = BuildMeA.Document("id").WithDocType(_docType).WithSubDocType(_subDocType1).WithManCo(_manCo1).WithApproval(_approval4);                       //.WithGridRun(_gridRun);
            _document2 = BuildMeA.Document("id2").WithDocType(_docType2).WithSubDocType(_subDocType2).WithManCo(_manCo2).WithApproval(_approval5);                     //.WithGridRun(_gridRun2);
            _document3 = BuildMeA.Document("id3").WithDocType(_docType2).WithSubDocType(_subDocType1).WithManCo(_manCo3);                                              //.WithGridRun(_gridRun3);
            _document4 = BuildMeA.Document("id4").WithDocType(_docType3).WithSubDocType(_subDocType2).WithManCo(_manCo2);                                              //.WithGridRun(_gridRun4);

            _document5 = BuildMeA.Document("id5").WithDocType(_docType2).WithSubDocType(_subDocType1).WithManCo(_manCo1).WithApproval(_approval1).WithExport(_export); //.WithGridRun(_gridRun);
            _document6 = BuildMeA.Document("id6").WithDocType(_docType3).WithSubDocType(_subDocType2).WithManCo(_manCo3);                                              //.WithGridRun(_gridRun2);
            _document7 = BuildMeA.Document("id7").WithDocType(_docType2).WithSubDocType(_subDocType2).WithManCo(_manCo3).WithApproval(_approval2);                     //.WithGridRun(_gridRun3);
            _document8 = BuildMeA.Document("id8").WithDocType(_docType2).WithSubDocType(_subDocType2).WithManCo(_manCo3).WithApproval(_approval3);                     //.WithGridRun(_gridRun4);
            _document9 = BuildMeA.Document("id9").WithDocType(_docType2).WithSubDocType(_subDocType2).WithManCo(_manCo3).WithRejection(_rejection);

            _grid  = BuildMeA.GridRun("grid", false, DateTime.Now, DateTime.Now, 1).WithApplication(_application1).WithDocument(_document).WithDocument(_document2).WithDocument(_document3);
            _grid1 = BuildMeA.GridRun("grid1", false, DateTime.Now, DateTime.Now, 1).WithApplication(_application1).WithDocument(_document4).WithDocument(_document5);
            _grid2 = BuildMeA.GridRun("grid2", false, DateTime.Now, DateTime.Now, 1).WithApplication(_application1).WithDocument(_document6).WithDocument(_document7).WithDocument(_document8);

            _gridRun  = BuildMeA.GridRun("grid1", true, new DateTime(2014, 3, 1), new DateTime(2014, 3, 1), 3).WithApplication(_application1).WithDocument(_document).WithDocument(_document5).WithDocument(_document6).WithDocument(_document9);
            _gridRun2 = BuildMeA.GridRun("grid2", true, new DateTime(2014, 3, 1), new DateTime(2014, 3, 1), 3).WithApplication(_application1).WithDocument(_document2).WithDocument(_document6);
            _gridRun3 = BuildMeA.GridRun("grid3", true, new DateTime(2014, 3, 1), new DateTime(2014, 3, 1), 3).WithApplication(_application1).WithDocument(_document3).WithDocument(_document7);
            _gridRun4 = BuildMeA.GridRun("grid4", true, new DateTime(2014, 1, 1), new DateTime(2014, 1, 1), 3).WithApplication(_application1).WithDocument(_document4);

            _xmlFileOffShore =
                BuildMeA.XmlFile("documentSetId 1", "fileName 1", "parentFileName 1", true, DateTime.Now, DateTime.Now)
                .WithGridRun(_grid)
                .WithDocType(_docType)
                .WithDomicile(_domicile)
                .WithManCo(_manCo1);;

            _xmlFileOnShore =
                BuildMeA.XmlFile("documentSetId 2", "fileName 2", "parentFileName 2", false, DateTime.Now, DateTime.Now)
                .WithGridRun(_grid1)
                .WithGridRun(_grid2)
                .WithDocType(_docType)
                .WithDomicile(_domicile)
                .WithManCo(_manCo1);;
        }