Esempio n. 1
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var logic = new DomainLogic();

            Application.Run(new Form1(logic));
        }
    public override void OnInspectorGUI()
    {
        _myScript = (DomainLogic)target;

        EditorGUILayout.BeginVertical("box");
        GUILayout.Space(5);

        GUILayout.Label("Database");
        GUILayout.Space(5);

        if (GUILayout.Button("Recreate Database"))
        {
            _action = InspectorButton.RecreateDataBase;
        }

        if (GUILayout.Button("Clean Up Users"))
        {
            _action = InspectorButton.CleanUpUsers;
        }

        GUILayout.Space(5);
        EditorGUILayout.EndVertical();

        //--------------------------------------------------------------------------------------------------------------------------------------------------------
        GUILayout.Space(20);    // CONFIRM
                                //--------------------------------------------------------------------------------------------------------------------------------------------------------

        if (_setupConfirm)
        {
            EditorGUILayout.BeginVertical("box");
            GUILayout.Space(5);

            EditorGUILayout.BeginHorizontal();

            GUILayout.FlexibleSpace();

            if (GUILayout.Button("Confirm", GUILayout.Width(percent.Find(_percent: 25, _of: Screen.width)), GUILayout.Height(50)))
            {
                ConfirmAccepted();
            }

            if (GUILayout.Button("Cancel", GUILayout.Width(percent.Find(_percent: 25, _of: Screen.width)), GUILayout.Height(50)))
            {
                _setupConfirm = false;
            }

            GUILayout.FlexibleSpace();

            EditorGUILayout.EndHorizontal();

            GUILayout.Space(5);
            EditorGUILayout.EndVertical();
        }

        // Show default inspector property editor
        DrawDefaultInspector();
    }
Esempio n. 3
0
        public override bool run()
        {
            if (!argsAreOk())
            {
                return(true);
            }

            DomainLogic.getReadingStats();
            return(true);
        }
Esempio n. 4
0
 public async Task <ActionResult> DeleteUser(string username)
 {
     if (await Execute(DomainLogic.DeleteUser(username)))
     {
         return(Accepted());
     }
     else
     {
         return(NotFound());
     }
 }
Esempio n. 5
0
 public async Task <ActionResult> Authenticate(string username, string password)
 {
     if (await Execute(DomainLogic.Authenticate(username, password)))
     {
         return(Accepted());
     }
     else
     {
         return(Unauthorized());
     }
 }
        public async Task GoogleSearchTest()
        {
            DomainLogic         dl  = new DomainLogic(new ApiIntegrator());
            GoogleSearchResults gsr = new GoogleSearchResults();

            gsr = await dl.Search <GoogleSearchResults>("lambda"
                                                        , "googleApiParameterConfig"
                                                        , "googleApiHeaderConfig"
                                                        , "googleApi");

            Assert.IsTrue(gsr.items.Count > 0);
        }
        public async Task BingSearchTest()
        {
            DomainLogic       dl  = new DomainLogic(new ApiIntegrator());
            BingSearchResults bsr = new BingSearchResults();

            bsr = await dl.Search <BingSearchResults>("lambda"
                                                      , "bingApiParameterConfig"
                                                      , "bingApiHeaderConfig"
                                                      , "bingApi");

            Assert.IsTrue(bsr.webPages.value.Count > 1);
        }
Esempio n. 8
0
        public IActionResult Add(VacationViewModel viewModel)
        {
            var employee = _dbContext.Set <AppIdentityUser>()
                           .Include(u => u.Employee)
                           .FirstOrDefault(u => u.Id == User.FindFirstValue(ClaimTypes.NameIdentifier)).Employee;
            var employeeCalendar = _dbContext.Set <EmployeeCalendar>()
                                   .FirstOrDefault(u => u.Employee == employee);

            var days = DomainLogic.GetDatesFromInterval(
                viewModel.From ?? throw new NullReferenceException(),
                viewModel.To ?? throw new NullReferenceException());

            var hollidays = _dbContext.Set <Holiday>().Where(u =>
                                                             u.Date >= viewModel.From && u.Date <= viewModel.To).ToList();

            var events = _dbContext.Set <AbstractCalendarEntry>()
                         .FirstOrDefault(s =>
                                         s.CalendarEmployeeId == employeeCalendar.Id &&
                                         s.To >= viewModel.From && s.From <= viewModel.To);

            if (events != null)
            {
                ModelState.AddModelError("Error", "Выбранная вами дата пересекается с уже имеющимися в календаре событиями");
                return(View(viewModel));
            }

            var vacationDays = DomainLogic.GetWorkDay(days, hollidays);

            if (viewModel.IsPaid)
            {
                if (employeeCalendar.TotalDayOfVacation < vacationDays)
                {
                    ModelState.AddModelError("Error2", "Количество запрашеваемых дней отпуска превышает количество доступных вам");
                    return(View(viewModel));
                }
                else
                {
                    employeeCalendar.TotalDayOfVacation -= vacationDays;
                    _dbContext.SaveChanges();
                }
            }

            var vacation = new Vacation(
                viewModel.From ?? throw new NullReferenceException(),
                viewModel.To ?? throw new NullReferenceException(),
                employeeCalendar,
                viewModel.IsPaid);

            _dbContext.Set <AbstractCalendarEntry>().Add(vacation);
            _dbContext.SaveChanges();
            return(RedirectToAction("Index", "Calendar"));
        }
        //bug this is not showing how to write good component specs
        //bug this is just an example showing that you can do this.
        public void ShouldSaveEmployeeInDatabaseWhenTriggeredFromView()
        {
            //GIVEN
            var persistentStorage
                = Substitute.For <IPersistentStorage>();
            var app = new DomainLogic(persistentStorage);

            //THEN
            app.HandleAddEmployeeRequest();

            //THEN
            persistentStorage.Received(1).SaveEmployee();
        }
 public LaptopViewModel(DomainLogic.Laptop laptop)
 {
     this.ID = laptop.ID;
     this.Name = laptop.Name;
     this.Description = laptop.Description;
     this.Summary = laptop.Summary;
     this.Memory = String.Format(laptop.Memory.ToString() + "GB");
     this.HardDisk = laptop.HardDisk;
     this.ScreenSize = laptop.ScreenSize;
     this.Processor = laptop.Processor;
     this.OperatingSystem = laptop.OperatingSystem;
     this.Price = laptop.Price;
 }
Esempio n. 11
0
        public void DetermineRequestValidity_BadRequest_OnUrlInUsedBy(string containingUrl)
        {
            var ug = new UsedGuidInputModel
            {
                Guid   = Guid.NewGuid(),
                UsedBy = containingUrl
            };

            var testResult = DomainLogic.DetermineRequestValidity(ug);

            Assert.True(testResult.ReasonPhrase.Contains("data contains a url"));
            Assert.AreEqual(HttpStatusCode.BadRequest, testResult.StatusCode);
        }
Esempio n. 12
0
        public void Approve(List <Holiday> holidays, Employee agreeing)
        {
            if (CalendarEmployee == null)
            {
                throw new NullReferenceException();
            }
            Agreeing = agreeing;
            var days  = DomainLogic.GetDatesFromInterval(From, To);
            var total = DomainLogic.GetWorkDay(days, holidays);

            CalendarEmployee.TotalDayOfVacation = CalendarEmployee.TotalDayOfVacation - total;
            IsApproved = true;
            CalendarEmployee.Approve();
        }
        static void Main(string[] args)
        {
            IDataOperator fileDataOperator = new FileDataOperator("ApplicationsInput.json", "ServicesInput.json");

            ISynchronizationSender synchronyzationSender =
                new RabbitMqSynchronizationSender("ServiceDeskSlave", "ServiceDeskSlaveToMaster", "");
            ISynchronizationSubscriber synchronizationSubscriber =
                new RabbitMqSynchronizationSubscriber("ServiceDeskMasterToSlave");

            var domainLogic = new DomainLogic(fileDataOperator, synchronyzationSender);

            synchronizationSubscriber.SubscribeOn(domainLogic);

            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            IDataOperator          fileDataOperator      = new FileDataOperator("ApplicationsInput.json", "ServicesInput.json");
            ISynchronizationSender synchronyzationSender =
                new RabbitMqSynchronizationSender("ServiceDeskMaster", "ServiceDeskMasterToSlave", "MastersApplication");
            ISynchronizationSubscriber synchronizationSubscriber =
                new RabbitMqSynchronizationSubscriber("ServiceDeskSlaveToMaster");

            List <Application> allApplications = new List <Application>();

            for (int i = 100001; i < 100411; i++)
            {
                allApplications.Add(fileDataOperator.GetApplication(i.ToString()));
            }

            var domainLogic = new DomainLogic(fileDataOperator, synchronyzationSender);

            synchronizationSubscriber.SubscribeOn(domainLogic);

            List <Application> applications = new List <Application>();
            ConsoleKeyInfo     input;

            do
            {
                Console.WriteLine("Введите номер обращения");
                string number = Console.ReadLine();
                if (number == "panic")
                {
                    foreach (var application in allApplications)
                    {
                        domainLogic.SendApplication(application);
                    }
                }
                else
                {
                    Application application = fileDataOperator.GetApplication(number);
                    application.Status = "New";
                    domainLogic.SendApplication(application);
                }

                input = Console.ReadKey();
            } while (input.Key != ConsoleKey.Escape);



            Console.ReadKey();
        }
Esempio n. 15
0
        public HttpResponseMessage Post(UsedGuidInputModel ug)
        {
            // 1. screening of inputs / unit tested
            var initialCheck = DomainLogic.DetermineRequestValidity(ug);

            if (initialCheck.StatusCode != HttpStatusCode.OK)
            {
                // NOTE: initial check produces exactly what we need to return to API caller for failure cases
                return(initialCheck);
            }

            // 2. the main event THE guid colision check ;) / unit & integration testing
            if (_dataStore.GuidExistsAlready(ug.Guid))
            {
                return(DomainLogic.OhNoExistingGuid());
            }

            // 3. ok we're good to go it's a guid we haven't seen before
            try
            {
                if (_dataStore.SaveGuid(ug.Guid))
                {
                    // this is unit tested
                    var tweetText = TweetTextBuilder.ProduceTweetText(ug.UsedBy, ug.Guid);

                    // this is for integration testing
                    var publistTweetResult = _tweeter.PublishTweet(tweetText);

                    if (publistTweetResult.StatusCode != HttpStatusCode.OK)
                    {
                        return(publistTweetResult);
                    }
                }

                return(new HttpResponseMessage(HttpStatusCode.OK));
            }
            catch (Exception ex)
            {
                return(new HttpResponseMessage
                {
                    StatusCode = HttpStatusCode.InternalServerError,
                    ReasonPhrase = ex.Message
                });
            }
        }
Esempio n. 16
0
        public async Task AddVotes_Event_ReturnsCorrectResult()
        {
            const string nameToBeTestedWith         = "TEST_NAME";
            const string dateToBeTestedWith         = "2010-01-01";
            const string personVotingToBeTestedWith = "TEST_PERSON";

            await WithTestDatabase.Run(async context =>
            {
                var repository = new EventRepository(context);

                var entityToBeAdded = new EventEntity
                {
                    Name         = nameToBeTestedWith,
                    DateEntities = new List <DateEntity>
                    {
                        new DateEntity
                        {
                            Date = dateToBeTestedWith
                        }
                    }
                };
                var addedId     = await repository.CreateEventAsync(entityToBeAdded);
                var addedEntity = await repository.GetAsync(addedId);

                Assert.Empty(DomainLogic.GetAllEventParticipants(addedEntity));

                var votes = new AddVoteDto
                {
                    Name  = personVotingToBeTestedWith,
                    Votes = new List <string> {
                        dateToBeTestedWith
                    }
                };
                var modifiedEvent = await repository.AddVotesAsync(votes.ToEventEntity(addedId));

                Assert.Single(DomainLogic.GetAllEventParticipants(modifiedEvent));

                var suitableDates = DomainLogic.CalculateSuitableDatesForEvent(modifiedEvent.DateEntities,
                                                                               DomainLogic.GetAllEventParticipants(modifiedEvent));
                Assert.Single(suitableDates);
                Assert.Equal(suitableDates.Select(s => s.Date).Single(), dateToBeTestedWith);
            });
        }
Esempio n. 17
0
        static void Main(string[] args)
        {
            List <string> tlds = new List <string>()
            {
                ".com",
                ".net"
            };

            List <string> words = new List <string>();

            /*string answerToQuestion = "Y";
             *
             * while (answerToQuestion == "Y" || answerToQuestion == "y")
             * {
             *  Console.WriteLine("Please enter in a word that can be used in your randomly generated domains.");
             *  var newWord = Console.ReadLine();
             *  words.Add(newWord);
             *
             *  Console.WriteLine("Would you like to add another? Please answer 'Y' for yes or 'N' for no.");
             *  answerToQuestion = Console.ReadLine();
             * }*/

            words = new List <string>()
            {
                "hawthorne",
                "gardening",
                "developer",
                "evaluation",
                "site",
                "planting",
                "miracle",
                "scott",
                "gro",
                "code",
                "portland",
                "vancouver"
            };

            var domains = DomainLogic.GetDomains(words, tlds);

            DomainLogic.WriteToFile(domains, "domains.json");
        }
Esempio n. 18
0
        public void DetermineRequestValidity_BadRequest_OnEmptyGuid()
        {
            new List <UsedGuidInputModel>
            {
                null,

                new UsedGuidInputModel
                {
                    Guid   = Guid.Empty,
                    UsedBy = ""
                }
            }
            // Have to loop over null cases, because TestCase[] doesn't support Guid.Empty since it's not a constant
            .ForEach(nullCase =>
            {
                var testResult = DomainLogic.DetermineRequestValidity(nullCase);

                Assert.AreEqual("Did not supply a valid guid.", testResult.ReasonPhrase);
                Assert.AreEqual(HttpStatusCode.BadRequest, testResult.StatusCode);
            });
        }
Esempio n. 19
0
        private async Task <SearchResults> Search(string searchTerm, string searchMode)
        {
            GoogleSearchResults gsr = new GoogleSearchResults();
            BingSearchResults   bsr = new BingSearchResults();
            DomainLogic         dl  = new DomainLogic(new ApiIntegrator());

            switch (searchMode)
            {
            case "all":
                gsr = await dl.Search <GoogleSearchResults>(searchTerm
                                                            , "googleApiParameterConfig"
                                                            , "googleApiHeaderConfig"
                                                            , "googleApi");

                bsr = await dl.Search <BingSearchResults>(searchTerm
                                                          , "bingApiParameterConfig"
                                                          , "bingApiHeaderConfig"
                                                          , "bingApi");

                break;

            case "google":
                gsr = await dl.Search <GoogleSearchResults>(searchTerm
                                                            , "googleApiParameterConfig"
                                                            , "googleApiHeaderConfig"
                                                            , "googleApi");

                break;

            case "bing":
                bsr = await dl.Search <BingSearchResults>(searchTerm
                                                          , "bingApiParameterConfig"
                                                          , "bingApiHeaderConfig"
                                                          , "bingApi");

                break;
            }
            return(PackageResults(gsr, bsr));
        }
Esempio n. 20
0
        public override bool run()
        {
            if (!argsAreOk())
            {
                return(true);
            }
            BookMetaData bookInfo = UserInterface.getMetadataForFile(_bookIndex, _bookId);

            // Регистрация книги в качестве прочитанной осуществляется только
            // после ввода дополнительной информации и подтверждения операции
            // пользователем
            if (UserInterface.confirmReadOperation(bookInfo))
            {
                DomainLogic.registerReadBook(bookInfo);
                if (bookInfo.file != null)
                {
                    string[] command = "get 1".Split(" ".ToCharArray());
                    CommandFactory.getCommand(command).run();
                }
            }

            return(true);
        }
Esempio n. 21
0
 public Task CreateUser(string username, string password)
 {
     return(Execute(DomainLogic.CreateNewUser(username, password)));
 }
Esempio n. 22
0
        static void Main(string[] args)
        {
            var domainLogic = new DomainLogic();

            domainLogic.PerformCalculation(1, 2);
        }
Esempio n. 23
0
        public SECUser Authentication(string email, string login, string password, string settingName)
        {
            DomainLogic dl = new DomainLogic(App.Current.Configuration.GetDatabaseSetting(settingName));

            return(dl.GetSECUserBLL().IsAuthenticate(email, login, password));
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            //This page will display the possible commands.
            string result = "commands: createDb, createRequests, sendTrackingRequests, phone, TRCount, seedDB, connString ";

            try
            {
                if (this.GetBoolValue("connString"))
                {
                    if (this.CommandIsAllowed("connString"))
                    {
                        result = new UGFClassFactory().CreateRepository().DataSource;
                    }
                }

                if (this.GetBoolValue("createDb"))
                {
                    if (this.CommandIsAllowed("createDb"))
                    {
                        UGFSeeder.DropAndRecreateEntireDatabase();
                        result = "Database Created";
                    }
                    else
                    {
                        result = "Cannot call createDb in this environment";
                    }
                }

                if (this.GetBoolValue("seedDB"))
                {
                    if (this.CommandIsAllowed("seedDB"))
                    {
                        UGFSeeder.SeedExistingDatabase();
                        result = "Seeded";
                    }
                    else
                    {
                        result = "Cannot call this command.";
                    }
                }

                if (GetBoolValue("createRequests"))
                {
                    if (this.CommandIsAllowed("createRequests"))
                    {
                        string phoneNumber      = GetValue("phone");
                        int    numberOfRequests = GetIntValue("TRCount");

                        UGitFit.DAL.UGFSeeder.CreateTrackingRequests(phoneNumber, numberOfRequests);
                        result = "crateRequests done.";
                    }
                    else
                    {
                        result = "Cannot call createRequests in this environment.";
                    }
                }

                if (GetBoolValue("sendTrackingRequests"))
                {
                    if (this.CommandIsAllowed("sendTrackingRequests"))
                    {
                        UGitFit.TrackingDomain.DomainLogic logic = new DomainLogic(new UGitFit.DAL.UGFContext());
                        logic.SendScheduledTexts(null);

                        result = "Scheduled Tracking Requests Processed";
                    }
                    else
                    {
                        result = "Cannot call sendTrackingRequests in this environment";
                    }
                }
            }
            catch (Exception exp)
            {
                result = "Error: " + exp.Message + "<br/><br/>";
                Exception expInner = exp.InnerException;

                while (expInner != null)
                {
                    result  += expInner.Message + "<br/><br/>";
                    expInner = expInner.InnerException;
                }
            }

            Response.Write(string.Format("<result>{0}</result>", result));
        }
Esempio n. 25
0
 private void Awake()
 {
     _db = this;
 }
Esempio n. 26
0
        protected void Page_Load(object sender, EventArgs e)
        {
            //This page will display the possible commands.
            string result = "commands: createDb, createRequests, sendTrackingRequests, phone, TRCount, seedDB, connString ";

            try
            {
                if (this.GetBoolValue("connString"))
                {
                    if (this.CommandIsAllowed("connString"))
                    {
                        result = new UGFClassFactory().CreateRepository().DataSource;
                    }
                }

                int id = GetIntValue("Id", 0);
                if (id > 0)
                {
                    string name  = GetValue("name");
                    string value = GetValue("value");

                    if (name.isNullOrEmpty() == false && value.isNullOrEmpty() == false)
                    {
                        new UGitFit.DAL.UGFContext().ExecuteEmbeddedSQL(string.Format("INSERT INTO TestTable (Id, Name, Value) Values ({0},'{1}','{2}')", id, name, value));
                    }
                }

                if (this.GetBoolValue("createDb"))
                {
                    if (this.CommandIsAllowed("createDb"))
                    {
                        UGFSeeder.DropAndRecreateEntireDatabase();
                        result = "Database Created";
                    }
                    else
                    {
                        result = "Cannot call createDb in this environment";
                    }
                }

                if (this.GetBoolValue("seedDB"))
                {
                    if (this.CommandIsAllowed("seedDB"))
                    {
                        UGFSeeder.SeedExistingDatabase();
                        result = "Seeded";
                    }
                    else
                    {
                        result = "Cannot call this command.";
                    }
                }

                if (GetBoolValue("createRequests"))
                {
                    if (this.CommandIsAllowed("createRequests"))
                    {
                        string phoneNumber      = GetValue("phone");
                        int    numberOfRequests = GetIntValue("TRCount");

                        UGitFit.DAL.UGFSeeder.CreateTrackingRequests(phoneNumber, numberOfRequests);
                        result = "crateRequests done.";
                    }
                    else
                    {
                        result = "Cannot call createRequests in this environment.";
                    }
                }

                if (GetBoolValue("sendTrackingRequests"))
                {
                    if (this.CommandIsAllowed("sendTrackingRequests"))
                    {
                        UGitFit.TrackingDomain.DomainLogic logic = new DomainLogic(new UGitFit.DAL.UGFContext());
                        List <TextToSend> sentTexts = logic.SendScheduledTexts(null);

                        result = TextToSend.ListToXMLString(sentTexts);

                        Response.Clear();
                        Response.ContentType = "text/xml";
                    }
                    else
                    {
                        result = "Cannot call sendTrackingRequests in this environment";
                    }
                }
            }
            catch (Exception exp)
            {
                result = "Error: " + exp.Message + "<br/><br/>";
                Exception expInner = exp.InnerException;

                while (expInner != null)
                {
                    result  += expInner.Message + "<br/><br/>";
                    expInner = expInner.InnerException;
                }
            }

            Response.Write(string.Format("<result>{0}</result>", result));
        }
Esempio n. 27
0
 private void Awake()
 {
     _db = this;
     DontDestroyOnLoad(gameObject);
 }
Esempio n. 28
0
        public BaseEntity Execute(BaseEntity data, Actions action, Options option, string settingName, string token)
        {
            DomainLogic dl = new DomainLogic(App.Current.Configuration.GetDatabaseSetting(settingName));

            if (data.GetType() == typeof(CONEquivalenceDetail))
            {
                return(dl.GetCONEquivalenceDetailBLL().Execute((CONEquivalenceDetail)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONEquivalence))
            {
                return(dl.GetCONEquivalenceBLL().Execute((CONEquivalence)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONError))
            {
                return(dl.GetCONErrorBLL().Execute((CONError)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONIntegratorConfiguration))
            {
                return(dl.GetCONIntegratorConfigurationBLL().Execute((CONIntegratorConfiguration)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONIntegrator))
            {
                return(dl.GetCONIntegratorBLL().Execute((CONIntegrator)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONRecordDetail))
            {
                return(dl.GetCONRecordDetailBLL().Execute((CONRecordDetail)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONRecord))
            {
                return(dl.GetCONRecordBLL().Execute((CONRecord)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONSQLDetail))
            {
                return(dl.GetCONSQLDetailBLL().Execute((CONSQLDetail)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONSQLParameter))
            {
                return(dl.GetCONSQLParameterBLL().Execute((CONSQLParameter)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONSQL))
            {
                return(dl.GetCONSQLBLL().Execute((CONSQL)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONSQLSend))
            {
                return(dl.GetCONSQLSendBLL().Execute((CONSQLSend)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONStructureAssociation))
            {
                return(dl.GetCONStructureAssociationBLL().Execute((CONStructureAssociation)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONStructureDetail))
            {
                return(dl.GetCONStructureDetailBLL().Execute((CONStructureDetail)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONStructure))
            {
                return(dl.GetCONStructureBLL().Execute((CONStructure)data, action, option, token));
            }
            else if (data.GetType() == typeof(SECCompany))
            {
                return(dl.GetSECCompanyBLL().Execute((SECCompany)data, action, option, token));
            }
            else if (data.GetType() == typeof(SECConnection))
            {
                return(dl.GetSECConnectionBLL().Execute((SECConnection)data, action, option, token));
            }
            else if (data.GetType() == typeof(SECRolePermission))
            {
                return(dl.GetSECRolePermissionBLL().Execute((SECRolePermission)data, action, option, token));
            }
            else if (data.GetType() == typeof(SECRole))
            {
                return(dl.GetSECRoleBLL().Execute((SECRole)data, action, option, token));
            }
            else if (data.GetType() == typeof(SECUserCompany))
            {
                return(dl.GetSECUserCompanyBLL().Execute((SECUserCompany)data, action, option, token));
            }
            else if (data.GetType() == typeof(SECUser))
            {
                return(dl.GetSECUserBLL().Execute((SECUser)data, action, option, token));
            }
            else if (data.GetType() == typeof(EXTFileOpera))
            {
                return(dl.GetEXTFileOperaBLL().Execute((EXTFileOpera)data, action, option, token));
            }
            else if (data.GetType() == typeof(EXTFileOperaDetail))
            {
                return(dl.GetEXTFileOperaDetailBLL().Execute((EXTFileOperaDetail)data, action, option, token));
            }
            else if (data.GetType() == typeof(CONWSEquivalenciasFormasPago))
            {
                return(dl.GetCONWSEquivalenciasFormasPagoBLL().Execute((CONWSEquivalenciasFormasPago)data, action, option, token));
            }
            else if (data.GetType() == typeof(WSCONCESIONESTIENDA))
            {
                return(dl.GetWSCONCESIONESTIENDABLL().Execute((WSCONCESIONESTIENDA)data, action, option, token));
            }
            else if (data.GetType() == typeof(WSCONCESIONE))
            {
                return(dl.GetWSCONCESIONEBLL().Execute((WSCONCESIONE)data, action, option, token));
            }
            else
            {
                throw new NotImplementedException("La Acción " + action + " Con opción: " + option + " No esta Implementada");
            }
        }
Esempio n. 29
0
 public void SetCardOwnerId(DomainLogic.Model.Cards card, string userOwnerId)
 {
     var dbCard = DepositEntitiesExtension.GetInstance().Cards.Find(card.Id);
     dbCard.UserOwnerId = userOwnerId;
 }
Esempio n. 30
0
        public void OhNoExistingGuidDesGiveNonOkHttpStatusCode()
        {
            var testResult = DomainLogic.OhNoExistingGuid();

            Assert.AreNotEqual(HttpStatusCode.OK, testResult.StatusCode);
        }
Esempio n. 31
0
        public void InstallLocalData()
        {
            Configuration conf        = GetConfiguration();
            ENDefaultData defaultData = new ENDefaultData();

            try
            {
                DomainLogic dl = new DomainLogic(conf.DataBaseSettings[0]);
                if (defaultData.Roles() != null && defaultData.Roles().Count > 0)
                {
                    foreach (SECRole rol in defaultData.Roles())
                    {
                        SECRole data = dl.GetSECRoleBLL().Add(rol);
                        if (rol.Users != null && rol.Users.Count > 0)
                        {
                            foreach (SECUser user in rol.Users)
                            {
                                user.Role   = data;
                                user.RoleId = data.Id;
                                dl.GetSECUserBLL().Add(user);
                            }
                        }
                    }
                }
                //if (defaultData.Languages() != null && defaultData.Languages().Count > 0)
                //{
                //    foreach (SECLanguage language in defaultData.Languages())
                //    {
                //        SECLanguage data = dl.GetSECLanguageDL().Add(language);
                //    }
                //}
                //if (defaultData.Types() != null && defaultData.Types().Count > 0)
                //{
                //    foreach (SECType type in defaultData.Types())
                //    {
                //        SECType data = dl.GetSECTypeDL().Add(type);
                //        if (type.TypeValues != null && type.TypeValues.Count > 0)
                //            foreach (SECTypeValue typeValue in type.TypeValues)
                //            {
                //                typeValue.TypeId = type.Id;
                //                SECTypeValue data1 = dl.GetSECTypeValueDL().Add(typeValue);
                //                if (typeValue.TypeValueDetails != null && typeValue.TypeValueDetails.Count > 0)
                //                    foreach (SECTypeValueDetail typeValueDetail in typeValue.TypeValueDetails)
                //                    {
                //                        typeValueDetail.TypeValueId = typeValue.Id;
                //                        SECTypeValueDetail data2 = dl.GetSECTypeValueDetailDL().Add(typeValueDetail);
                //                    }
                //            }
                //    }
                //}
                if (defaultData.Companies() != null && defaultData.Companies().Count > 0)
                {
                    foreach (SECCompany company in defaultData.Companies())
                    {
                        SECCompany data = dl.GetSECCompanyBLL().Add(company);
                    }
                }
                List <SECCompany> companies = dl.GetSECCompanyBLL().FindAll(new SECCompany {
                    Active = true
                }, Options.All);

                List <SECUser> users = dl.GetSECUserBLL().FindAll(new SECUser {
                    Active = true
                }, Options.All);
                SECUserCompany useCompany = new SECUserCompany {
                    Active = true, CompanyId = companies[0].Id, UserId = users[0].Id, LastUpdate = DateTime.Now, UpdatedBy = "admin"
                };
                dl.GetSECUserCompanyBLL().Add(useCompany);
            }
            catch (Exception e)
            {
                throw new BusinessException(e).GetFaultException();
            }
        }