Ejemplo n.º 1
0
        protected override void Seed(PortalIswintContext context)
        {
            var orgs  = context.Set <Organizer>();
            var rooms = context.Set <Room>();

            if (orgs.Any())
            {
                return;
            }
            var org1 = new Organizer
            {
                FirstName  = "FN",
                LastName   = "LN",
                EMail      = "EMail",
                BadgeGiven = false
            };
            var org2 = new Organizer
            {
                FirstName  = "FN2",
                LastName   = "LN2",
                EMail      = "EMail2",
                BadgeGiven = true
            };

            orgs.Add(org1);
            orgs.Add(org2);
            rooms.Add(new Room
            {
                Name = "404A"
            });
            rooms.Add(new Room
            {
                Name = "504B"
            });
        }
Ejemplo n.º 2
0
        public async Task <Organizer> AddOrganizerAsync(Organizer organizer)
        {
            _context.Organizers.Add(organizer);
            await _context.SaveChangesAsync();

            return(organizer);
        }
Ejemplo n.º 3
0
        // To protect from overposting attacks, see https://aka.ms/RazorPagesCRUD
        public async Task <IActionResult> OnPostAsync()
        {
            List <string> removed = new List <string>();
            List <string> added   = new List <string>();

            if (!ModelState.IsValid)
            {
                return(Page());
            }

            foreach (var organizer in Organizer)
            {
                if (!PrevOrganizer.Contains(organizer))
                {
                    var user = await _context.Users.Where(u => u.UserName == organizer).FirstAsync();

                    await _userManager.AddToRoleAsync(user, "Organizer");

                    added.Add(user.UserName);
                }
            }
            foreach (var prevorg in PrevOrganizer)
            {
                if (!Organizer.Contains(prevorg))
                {
                    var user = _userManager.Users.Where(u => u.UserName == prevorg).First();
                    await _userManager.RemoveFromRoleAsync(user, "Organizer");

                    removed.Add(user.UserName);
                }
            }
            await _context.SaveChangesAsync();

            return(RedirectToPage("./AdminPage", new { Removed = removed, Added = added }));
        }
Ejemplo n.º 4
0
        public async Task <IActionResult> Create(AddUserViewModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new User
                {
                    Address     = model.Address,
                    Document    = model.Document,
                    Email       = model.Username,
                    FirstName   = model.FirstName,
                    LastName    = model.LastName,
                    PhoneNumber = model.PhoneNumber,
                    UserName    = model.Username
                };

                var response = await _userHelper.AddUserAsync(user, model.Password);

                if (response.Succeeded)
                {
                    var userInDB = await _userHelper.GetUserByEmailAsync(model.Username);

                    await _userHelper.AddUserToRoleAsync(userInDB, "Organizer");

                    var Organizer = new Organizer
                    {
                        User = userInDB
                    };

                    _dataContext.Organizers.Add(Organizer);

                    try
                    {
                        await _dataContext.SaveChangesAsync();

                        var myToken = await _userHelper.GenerateEmailConfirmationTokenAsync(user);

                        var tokenLink = Url.Action("ConfirmEmail", "Account", new
                        {
                            userid = user.Id,
                            token  = myToken
                        }, protocol: HttpContext.Request.Scheme);

                        _mailHelper.SendMail(model.Username, "Email confirmation", $"<h1>Email Confirmation</h1>" +
                                             $"To allow the user, " +
                                             $"please click in this link:</br></br><a href = \"{tokenLink}\">Confirm Email</a>");

                        return(RedirectToAction(nameof(Index)));
                    }
                    catch (Exception ex)
                    {
                        ModelState.AddModelError(string.Empty, ex.ToString());
                        return(View(model));
                    }
                }

                ModelState.AddModelError(string.Empty, response.Errors.FirstOrDefault().Description);
            }

            return(View(model));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Edit(int id, [Bind("orgID,orgName,orgPhone,orgEmail,orgPassword")] Organizer organizer)
        {
            if (id != organizer.orgID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(organizer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrganizerExists(organizer.orgID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(organizer));
        }
Ejemplo n.º 6
0
        public async Task <ActionResult> Register(RegisterEditModel model)
        {
            if (ModelState.IsValid)
            {
                var user = new IdentityUser {
                    UserName = model.UserName, Name = model.Name, Email = model.Email
                };

                var organizer = new Organizer
                {
                    OrganizerId = Guid.NewGuid(),
                    Name        = user.Name,
                    Description = string.Format("{0} kullanıcısının organizatör profili.", user.Name),
                    Image       = PlaceholderImagePath,
                    IsDefault   = true
                };
                organizer.Slug = string.Format("o-{0}", organizer.OrganizerId.ToString("N"));

                user.Organizers.Add(organizer);

                var result = await _userManager.CreateAsync(user, model.Password);

                if (result.Succeeded)
                {
                    await SignInAsync(user, false);

                    return(RedirectToAction("Index", "Home"));
                }
                AddErrors(result);
            }

            return(View(model));
        }
Ejemplo n.º 7
0
    protected void btnLogin_Click(object sender, EventArgs e)
    {
        //Calls the remember email method to save the user's email in a cookie if the remember email checkbox was checked.
        rememberEmail();

        //Read email and password from textboxes.
        string email    = txtEmail.Text;
        string password = txtPassword.Text;

        //If the user's account exists, then redirect him to a webpage and store his email as session, else display error message.
        if (Student.Authenticate(email, password))
        {
            Session["accType"] = "Student";
            Session["email"]   = email;
            Response.Redirect("Opportunities.aspx");
        }
        if (Organizer.Authenticate(email, password))
        {
            Session["accType"] = "Organizer";
            Session["email"]   = email;
            Response.Redirect("Opportunities.aspx");
        }
        else
        {
            displayMessage("Cannot find your account within DB.");
        }
    }
        public bool checkUserPass(Organizer org)
        {
            IDbConnection con = DBUtils.getConnection();

            using (var comm = con.CreateCommand()) {
                comm.CommandText = "SELECT COUNT(*) FROM Organizer WHERE Username=@id AND Password=@pass";
                IDbDataParameter paramId = comm.CreateParameter();
                paramId.ParameterName = "@id";
                paramId.Value         = org.Id;
                comm.Parameters.Add(paramId);
                IDbDataParameter paramPass = comm.CreateParameter();
                paramPass.ParameterName = "@pass";
                paramPass.Value         = org.Password;
                comm.Parameters.Add(paramPass);

                using (var dataR = comm.ExecuteReader()) {
                    if (dataR.Read())
                    {
                        int found = dataR.GetInt32(0);
                        if (found == 1)
                        {
                            return(true);
                        }
                        return(false);
                    }
                }
            }
            return(false);
        }
Ejemplo n.º 9
0
        static void Main(string[] args)
        {
            Organizer          org          = new Organizer();
            Menu               menu         = new Menu();
            Keyboard           key          = new Keyboard();
            ConsoleComunicator communicator = new ConsoleComunicator();

            Engine eng = new Engine(key, org, menu, communicator);

            List <Entry> entries = new List <Entry>()
            {
                new Anniversary("Anniversary event", "Does not expire event, hot when 15 are remaining or become 1 day old", DateTime.Now.AddDays(2)),
                new Meeting("Meeting event", "Expires on the scheduled date and hour + 2 hours, hot when 1 day is remaining", DateTime.Now.AddMinutes(200)),
                new Memo("Memo", "Just a Memo"),
                new ToDo("ToDo", "Expires on the scheduled date&time, hot when 2 hours are remaining", DateTime.Now.AddMinutes(100))
            };

            foreach (Entry entry in entries)
            {
                org.Add(entry);
            }



            eng.Run();


            //Entry newE = org.GetCurrent();

            //if (newE.EntryType ==  EntryType.Anniversary)
            //{
            //    Anniversary ani = newE as Anniversary;
            //    Console.WriteLine(ani.DateOfAnniversary);
            //}
        }
Ejemplo n.º 10
0
        public void Setup()
        {
            _consoleMock         = new Mock <IConsole>(MockBehavior.Loose);
            _configManagerMock   = new Mock <IConfigurationManager>(MockBehavior.Strict);
            _configValidatorMock = new Mock <IConfigurationValidator>(MockBehavior.Strict);
            _filesystemMock      = new Mock <IFileSystem>(MockBehavior.Strict);

            _config = new Configuration.Config
            {
                SourceDirectory = _sourceDir,
                Rules           = new Configuration.Rule[]
                {
                    new Configuration.Rule
                    {
                        Patterns        = new string[] { ".tst" },
                        TargetDirectory = _targetDir,
                    }
                }
            };

            _configManagerMock.Setup(x => x.WriteExampleConfig());
            _configManagerMock.SetupGet(x => x.IsConfigExisting).Returns(true);
            _configManagerMock.Setup(x => x.ReadConfigurationFile()).Returns(_config);

            _configValidatorMock.Setup(x => x.IsValid(_config)).Returns(true);

            _filesystemMock.Setup(x => x.GetFiles(_sourceDir)).Returns(_files);
            _filesystemMock.Setup(x => x.Move(It.IsAny <string>(), It.IsAny <string>()));


            _sut = new Organizer(_consoleMock.Object,
                                 _configManagerMock.Object,
                                 _configValidatorMock.Object,
                                 _filesystemMock.Object);
        }
 public Organizer Add(Organizer organizer)
 {
     // Adding the organizer object and returning it
     context.Organizers.Add(organizer);
     context.SaveChanges();
     return(organizer);
 }
Ejemplo n.º 12
0
        private void GridView_DragDrop(object sender, DragEventArgs e)
        {
            DataGridView grid        = (DataGridView)sender;
            Point        clientPoint = grid.PointToClient(new Point(e.X, e.Y));

            rowIndexOfItemUnderMouseToDrop = grid.HitTest(clientPoint.X, clientPoint.Y).RowIndex;

            if (rowIndexOfItemUnderMouseToDrop == -1)
            {
                return;
            }

            if (e.Effect == DragDropEffects.Move)
            {
                DataGridViewRow rowToMove = e.Data.GetData(typeof(DataGridViewRow)) as DataGridViewRow;

                if (rowIndexOfItemUnderMouseToDrop >= (grid.RowCount - 1))                 // Blocca il drag fuori dalle celle salvate
                {
                    return;
                }

                if (rowIndexFromMouseDown >= (grid.RowCount - 1))                 // Blocca il drag di una cella non salvata
                {
                    return;
                }

                grid.Rows.RemoveAt(rowIndexFromMouseDown);
                grid.Rows.Insert(rowIndexOfItemUnderMouseToDrop, rowToMove);
                switch (grid.Name)
                {
                case "autolootdataGridView":
                    AutoLoot.CopyTable();
                    break;

                case "scavengerdataGridView":
                    Scavenger.CopyTable();
                    break;

                case "organizerdataGridView":
                    Organizer.CopyTable();
                    break;

                case "vendorbuydataGridView":
                    BuyAgent.CopyTable();
                    break;

                case "vendorsellGridView":
                    SellAgent.CopyTable();
                    break;

                case "restockdataGridView":
                    Restock.CopyTable();
                    break;

                case "graphfilterdatagrid":
                    RazorEnhanced.Filters.CopyGraphTable();
                    break;
                }
            }
        }
Ejemplo n.º 13
0
        public async Task <OrganizerResponse> UpdateAsync(int id, Organizer organizer)
        {
            var existingOrganizer = await _organizerRepository.FindById(id);

            if (existingOrganizer == null)
            {
                return(new OrganizerResponse("Organizer not found"));
            }

            existingOrganizer.FirstName   = organizer.FirstName;
            existingOrganizer.LastName    = organizer.LastName;
            existingOrganizer.Phone       = organizer.Phone;
            existingOrganizer.PersonalWeb = organizer.PersonalWeb;
            existingOrganizer.BirthDate   = organizer.BirthDate;

            try
            {
                _organizerRepository.Update(existingOrganizer);
                await _unitOfWork.CompleteAsync();

                return(new OrganizerResponse(existingOrganizer));
            }
            catch (Exception ex)
            {
                return(new OrganizerResponse($"An error has ocurred while updating organizer: {ex.Message}"));
            }
        }
Ejemplo n.º 14
0
        static void Seed()
        {
            Customer customer1 = new Customer("1", "1", "1");
            Customer customer2 = new Customer("2", "2", "2");

            Organizer organizer1 = new Organizer("3", "3", "3");

            SocialEvent socialEvent1 = new SocialEvent(5, 133, organizer1, "Art", "Kristine og Ramona synger bæ bæ lille lam");
            SocialEvent socialEvent2 = new SocialEvent(7, 5643, organizer1, "Sports", "Stian og Jørgen Sjonglerer med datamus");
            SocialEvent socialEvent3 = new SocialEvent(9, 2312, organizer1, "TalentShow", "Juan kjører solo dukkeshow");
            SocialEvent socialEvent4 = new SocialEvent(5, 436, organizer1, "Sports", "Test event 1 (sports)");
            SocialEvent socialEvent5 = new SocialEvent(7, 12, organizer1, "Sports", "Test event 2 (sports)");
            SocialEvent socialEvent6 = new SocialEvent(9, 432, organizer1, "Concert", "Test event 3 (concert)");
            SocialEvent socialEvent7 = new SocialEvent(5, 768, organizer1, "Concert", "Test event 4 (concert)");
            SocialEvent socialEvent8 = new SocialEvent(7, 654, organizer1, "Art", "Test event 5 (art)");
            SocialEvent socialEvent9 = new SocialEvent(9, 564, organizer1, "TalentShow", "Test event 6 (talentShow)");

            Ticket ticket1 = new Ticket(socialEvent1);
            Ticket ticket2 = new Ticket(socialEvent1);
            Ticket ticket3 = new Ticket(socialEvent1);
            Ticket ticket4 = new Ticket(socialEvent1);
            Ticket ticket5 = new Ticket(socialEvent2);
            Ticket ticket6 = new Ticket(socialEvent2);
            Ticket ticket7 = new Ticket(socialEvent2);
            Ticket ticket8 = new Ticket(socialEvent3);
        }
Ejemplo n.º 15
0
        static void Main(string[] args)
        {
            Organizer org = new Organizer();
            Menu menu = new Menu();
            Keyboard key = new Keyboard();
            ConsoleComunicator communicator = new ConsoleComunicator();

            Engine eng = new Engine(key, org, menu, communicator);

            List<Entry> entries = new List<Entry>(){
                new Anniversary("Anniversary event","Does not expire event, hot when 15 are remaining or become 1 day old",DateTime.Now.AddDays(2)),
                new Meeting("Meeting event","Expires on the scheduled date and hour + 2 hours, hot when 1 day is remaining",DateTime.Now.AddMinutes(200)),
                new Memo("Memo","Just a Memo"),
                new ToDo("ToDo","Expires on the scheduled date&time, hot when 2 hours are remaining",DateTime.Now.AddMinutes(100))
            };

            foreach (Entry entry in entries)
            {
                org.Add(entry);
               }

            eng.Run();

            //Entry newE = org.GetCurrent();

            //if (newE.EntryType ==  EntryType.Anniversary)
            //{
            //    Anniversary ani = newE as Anniversary;
            //    Console.WriteLine(ani.DateOfAnniversary);
            //}
        }
Ejemplo n.º 16
0
        public void Handle(OrganizerRegistrationCommand message)
        {
            var organizer = new Organizer(message.Id, message.SIN, message.Name, message.Email);

            if (!organizer.IsValid())
            {
                NotifyValidationError(organizer.ValidationResult);
                return;
            }

            var existOrganizer = _organizerRepository.Find(o => o.SIN == organizer.SIN || o.Email == organizer.Email);

            if (existOrganizer.Any())
            {
                _bus.RaiseEvent(new DomainNotification(message.MessageType, "SIN or E-mail already exists"));
            }

            _organizerRepository.Add(organizer);

            //TODO: Add to repository

            if (Commit())
            {
                _bus.RaiseEvent(new OrganizerRegisteredEvent(organizer.Id, organizer.SIN, organizer.Name, organizer.Email));
            }
        }
        /// <summary>
        /// Проверяет, инициализирована ли память для дня
        /// </summary>
        /// <param name="dt">день для проверки</param>
        /// <returns>True - да, день инициализирован, хотя список записей в дне может быть пуст.
        /// False - день не инициализирован</returns>
        private bool IsDateActivated(SimpleDateTime dt)
        {
            short currYear = dt.Year;
            sbyte currMon  = dt.Month;
            sbyte currDay  = dt.Day;

            // Проверка, выделена ли память для этой даты
            // Инициализирован ли год?
            if (!Organizer.ContainsKey(currYear))
            {
                return(false);
            }

            // Инициализирован ли месяц для этой даты?
            if (Organizer[currYear][currMon] == null)
            {
                return(false);
            }

            // Инициализирован ли день?
            if (Organizer[currYear][currMon][currDay] == null)
            {
                return(false);
            }

            return(true);
        }
Ejemplo n.º 18
0
        public async Task <IActionResult> Edit(int id, [Bind("Id,OrganizerLastName,OrganizerFirstName,OrganizerContactNumber,OrganizerEmailAddress")] Organizer organizer)
        {
            if (id != organizer.Id)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(organizer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrganizerExists(organizer.Id))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(organizer));
        }
Ejemplo n.º 19
0
        static void Operate(string root, string backup, string operation)
        {
            var backupDI = Directory.CreateDirectory(Path.Combine(backup, DateTime.Now.ToBinary() + @"\"));
            using (var recovery = new Recovery(backupDI.FullName))
            {

                var scanner = new Scanner(root, recovery);
                foreach (var kvp in scanner.RemovePattern("thumbs.db", "pspbrwse.jbf", "*.tmp"))
                {
                    Console.WriteLine("Removing flotsam " + kvp.Key);
                    kvp.Value();
                }

                using (var org = new Organizer(scanner.ScanPattern("*.dds"), recovery))
                {
                    org.Completed.Wait();
                }
                Console.WriteLine("DXT Processing complete. Press any key to proceed to duplicate removal.");
                Console.ReadKey();

                foreach (var kvp in scanner.RemoveDuplicates("*.dds"))
                {
                    Console.WriteLine("Removing duplicates of " + kvp.Key);
                    kvp.Value();
                }
            }
            Console.WriteLine("Good.");
        }
Ejemplo n.º 20
0
        public void UserAddTwoMcAndCarTest()
        {
            Organizer organizer = new Organizer(new UserInput());

            AddVehicle(organizer, false, "MC123");
            Assert.AreEqual(true, organizer.vehicles[0].FillsWholeSpace == false);

            AddVehicle(organizer, false, "MC234");



            organizer.vehicles = new List <Vehicle>();

            organizer.RestoreFromFile();

            // And a car
            AddVehicle(organizer, true, "ABC123");

            Assert.AreEqual(true, organizer.vehicles[2].IsCar == true);
            Assert.AreEqual(true, organizer.vehicles[2].FillsWholeSpace == true);
            Assert.AreEqual(true, organizer.vehicles[2].RegNum == "ABC123");


            Assert.AreEqual(true, organizer.vehicles[0].IsCar == false);
            Assert.AreEqual(true, organizer.vehicles[1].IsCar == false);
            Assert.AreEqual(true, organizer.vehicles[0].FillsWholeSpace == true);
            Assert.AreEqual(true, organizer.vehicles[1].FillsWholeSpace == true);
            Assert.AreEqual(true, organizer.vehicles[0].RegNum == "MC123");
            Assert.AreEqual(true, organizer.vehicles[1].RegNum == "MC234");
        }
Ejemplo n.º 21
0
            private bool CheckConsistencyFromAssetBundleSide(StringBuilder logBuilder)
            {
                var everythingOkay = true;

                foreach (var kv in Organizer.ConfigCache.AssetBundleInfos)
                {
                    var assetBundleInfo = kv.Value;
                    foreach (var assetGuid in assetBundleInfo.AssetGuids)
                    {
                        var assetInfo = Organizer.GetAssetInfo(assetGuid);
                        if (assetInfo == null)
                        {
                            everythingOkay = false;
                            logBuilder.AppendLine(
                                $"Asset with GUID '{assetGuid}' not found in asset infos but is in asset bundle '{assetBundleInfo.AssetBundlePath}'");
                        }
                        else if (assetInfo.AssetBundlePath != assetBundleInfo.AssetBundlePath)
                        {
                            everythingOkay = false;
                            var assetPath = assetInfo.Path;
                            logBuilder.AppendLine(
                                $"Asset '{assetPath}' (GUID='{assetGuid}') thinks its in asset bundle '{assetInfo.AssetBundlePath}', " +
                                $"but asset bundle '{assetBundleInfo.AssetBundlePath}' claims to include it.");
                        }
                    }
                }

                return(everythingOkay);
            }
Ejemplo n.º 22
0
        private void ButtonVerify_Click(object sender, EventArgs e)
        {
            IVerificationMethod iVerificationMethod = (IVerificationMethod)ComboVerificationMethod.SelectedItem;
            bool result = iVerificationMethod.Verify();

            if (result == true)
            {
                if (currentUser.GetType() == typeof(Customer))
                {
                    Organizer upgradedCustomer = UserLogic.UpgradeCustomer((Customer)currentUser);

                    MessageBox.Show("Verification Success!");

                    LoginForm loginForm = new LoginForm()
                    {
                        StartPosition = FormStartPosition.Manual,
                        Location      = this.Location
                    };
                    loginForm.Show();
                }
            }
            else
            {
                MessageBox.Show("Verification Failed.");
                SocialEventListForm socialEventListForm = new SocialEventListForm(currentUser)
                {
                    StartPosition = FormStartPosition.Manual,
                    Location      = this.Location
                };
                socialEventListForm.Show();
            }
            this.Close();
        }
Ejemplo n.º 23
0
            private void TryEditingAssetBundle()
            {
                var oldABPath = m_EditorWindow.m_SelectedAssetBundleInfo.Path;

                if (oldABPath == m_InputAssetBundlePath)
                {
                    Organizer.RegroupAssetBundle(oldABPath, m_InputAssetBundleGroup);
                    Organizer.SetAssetBundleDontPack(oldABPath, m_InputDontContainDontPack);
                    ClearInput();
                    m_Status = Status.Normal;
                    return;
                }

                if (!CheckInputAssetBundleName())
                {
                    return;
                }

                Organizer.RegroupAssetBundle(oldABPath, m_InputAssetBundleGroup);
                Organizer.SetAssetBundleDontPack(oldABPath, m_InputDontContainDontPack);
                Organizer.RenameAssetBundle(oldABPath, m_InputAssetBundlePath);
                m_EditorWindow.m_AssetBundleInfoSatelliteDatas.Remove(oldABPath);
                EnsureSatelliteData(Organizer.GetAssetBundleInfo(m_InputAssetBundlePath));
                ClearInput();
                m_Status = Status.Normal;
            }
Ejemplo n.º 24
0
        public async Task <IActionResult> Edit(int id, [Bind("ID,OrgLastName,OrgFirstName,OrgGender,OrgDoB,OrgPhoneNumber,OrgEmail,OrgStreetAddress,OrgCity,OrgPostcode")] Organizer organizer)
        {
            if (id != organizer.ID)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(organizer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrganizerExists(organizer.ID))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(organizer));
        }
Ejemplo n.º 25
0
        public override object Deserialize(TextReader tr)
        {
            var value = tr.ReadToEnd();

            Organizer o = null;

            try
            {
                o = CreateAndAssociate() as Organizer;
                if (o != null)
                {
                    var uriString = Unescape(Decode(o, value));

                    uriString = DecodeUrlString(uriString); // in some iCal files the organizer e-mail address contains URL encoded special characters
                    uriString = HandleDualooCase(uriString);

                    // Prepend "mailto:" if necessary
                    if (!uriString.StartsWith("mailto:", StringComparison.OrdinalIgnoreCase) && AlmostPerfectEmailMatch.Match(uriString.ToLower()).Success)
                    {
                        uriString = "mailto:" + uriString;
                    }

                    o.Value = new Uri(uriString);
                }
            }
            catch {}

            return(o);
        }
Ejemplo n.º 26
0
        public async Task <ActionResult> CreateOrganizer()
        {
            var organizer = new Organizer
            {
                OrganizerId = Guid.NewGuid(),
                Name        = "İsimsiz organizatör",
                Image       = PlaceholderImagePath,
                IsDefault   = false,
                UserId      = GetGuid(User.Identity.GetUserId())
            };

            organizer.Slug = string.Format("o-{0}", organizer.OrganizerId.ToString("N"));

            try
            {
                UnitOfWork.OrganizerRepository.Add(organizer);
                await UnitOfWork.SaveChangesAsync();
            }
            catch
            {
                //TODO: Log error
            }

            return(RedirectToAction("UpdateOrganizer", "Account", new { id = organizer.OrganizerId }));
        }
Ejemplo n.º 27
0
        public IHttpActionResult PutOrganizer(int id, Organizer organizer)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != organizer.Id)
            {
                return(BadRequest());
            }

            db.Entry(organizer).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!OrganizerExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
Ejemplo n.º 28
0
        public async Task <IActionResult> Edit(int id, [Bind("OrganizerId,FullName,RegistrationDate,Occupation")] Organizer organizer)
        {
            if (id != organizer.OrganizerId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(organizer);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!OrganizerExists(organizer.OrganizerId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(organizer));
        }
Ejemplo n.º 29
0
        public override object Deserialize(TextReader tr)
        {
            var value = tr.ReadToEnd();

            Organizer o = null;

            try
            {
                o = CreateAndAssociate() as Organizer;
                if (o != null)
                {
                    var uriString = Unescape(Decode(o, value));

                    // Prepend "mailto:" if necessary
                    if (!uriString.StartsWith("mailto:", StringComparison.OrdinalIgnoreCase))
                    {
                        uriString = "mailto:" + uriString;
                    }

                    o.Value = new Uri(uriString);
                }
            }
            catch {}

            return(o);
        }
Ejemplo n.º 30
0
        public IActionResult RemoveOrginizer(int id, [FromBody] string User_Num)
        {
            Event eventModel = _repository.Events.GetById(id, true);

            if (eventModel == null)
            {
                return(NotFound());
            }

            User user = _repository.Users.GetByNumber(User_Num, true);

            if (user == null)
            {
                return(NotFound());
            }

            Organizer orginizer = eventModel.Organizers.Where(x => x.TelephoneNumber == User_Num).FirstOrDefault();

            if (orginizer == null)
            {
                return(NotFound());
            }

            eventModel.Organizers.Remove(orginizer);
            _repository.Save();

            return(NoContent());
        }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Student.IsAuthenticated(Session, Request))
        {
            Response.Redirect("Login.aspx");
        }

        //If orgainzation id exists, then get organization by ID, else redirect user to another page.
        if (Request.QueryString["id"] != null)
        {
            int organizationID = int.Parse(Request.QueryString["id"]);

            DataTable dtOrganizationDetails = Organization.GetOrgByID(organizationID);
            dlOrgDetails.DataSource = dtOrganizationDetails;
            dlOrgDetails.DataBind();

            DataTable dtOrganizers = Organizer.GetOrganizersByOrganizationID(organizationID);
            dlOrganizers.DataSource = dtOrganizers;
            dlOrganizers.DataBind();
        }
        else
        {
            Response.Redirect("Organizations.aspx");
        }
    }
Ejemplo n.º 32
0
        public void TestAlphabethTest()
        {
            Organizer organizer = new Organizer(new UserInput());
            string    regNum    = "ABC123";

            AddVehicle(organizer, true, regNum);

            Assert.AreEqual(0, organizer.SearchForReg(regNum));
            regNum = "АБЦABC123";
            AddVehicle(organizer, true, regNum);

            Assert.AreEqual(1, organizer.SearchForReg(regNum));
            regNum = "ŪŌĪ123";
            AddVehicle(organizer, true, regNum);

            Assert.AreEqual(2, organizer.SearchForReg(regNum));
            regNum = "としは123".ToUpper();
            AddVehicle(organizer, true, regNum);

            Assert.AreEqual(3, organizer.SearchForReg(regNum));
            regNum = "עִבְרִ123".ToUpper();
            AddVehicle(organizer, true, regNum);

            Assert.AreEqual(4, organizer.SearchForReg(regNum));
        }
Ejemplo n.º 33
0
        private static Organizer MakeOrganizer()
        {
            Organizer o = new Organizer();
            o.ClassCode = new CS<x_ActClassDocumentEntryOrganizer>(x_ActClassDocumentEntryOrganizer.BATTERY);
            o.TemplateId = new LIST<II>();
            o.TemplateId.Add(new II("2.16.840.1.113883.10.20.22.4.1"));
            o.Id = new SET<II>(new II(new Guid()));
            o.Code = new CD<string>(
                "11579-0",
                "2.16.840.1.113883.6.1",
                "LOINC",
                null,
                "Thyrotropin [Units/volume] in Serum or Plasma by Detection limit less than or equal to 0.05 mIU/L",
                null);
            o.StatusCode = new CS<ActStatus>(ActStatus.Completed);

            Observation obs = new Observation();
            //It automatically adds class code
            obs.MoodCode = new CS<x_ActMoodDocumentObservation>(x_ActMoodDocumentObservation.Eventoccurrence);
            obs.TemplateId = new LIST<II>();
            obs.TemplateId.Add(new II("2.16.840.1.113883.10.20.22.4.2"));
            obs.Id = new SET<II>(new II(new Guid()));
            obs.Code = new CD<string>(
                "3016-3",
                "2.16.840.1.113883.6.1",
                "LOINC",
                null,
                "Thyrotropin [Units/volume] in Serum or Plasma",
                null);
            obs.Text = new ED();
            obs.Text.Reference = new TEL("#result1");
            obs.StatusCode = new CS<ActStatus>(ActStatus.Completed);
            obs.EffectiveTime = new IVL<TS>();
            obs.EffectiveTime.Value = new TS(DateTime.Today);
            obs.Value = new PQ(6m, "mIU/L");
            obs.InterpretationCode = new SET<CE<string>>();
            obs.InterpretationCode.Add(
                 new CE<string>(
                     "A",
                     "2.16.840.1.113883.5.83",
                     "ObservationInterpretation",
                     null,
                     "abnormal",
                     null));
            obs.InterpretationCode.Add(
                 new CE<string>(
                     "H",
                     "2.16.840.1.113883.5.83",
                     "ObservationInterpretation",
                     null,
                     "high",
                     null));
            obs.ReferenceRange = new List<ReferenceRange>();
            obs.ReferenceRange.Add(new ReferenceRange(
                new ObservationRange(
                    null,
                    new ED("normal: 0.29–5.11 mIU/L"),
                    null,
                    null)));

            Component4 comp = new Component4();
            comp.SetClinicalStatement(obs);

            o.Component = new List<Component4>();
            o.Component.Add(comp);

            return o;
        }
Ejemplo n.º 34
0
 public void AddOrganizer(Organizer organizerRound)
 {
     this.organizer.Add(organizerRound);
 }
Ejemplo n.º 35
0
 private static int AddOrganizer(MyEventsContext context)
 {
     var organizer = new Organizer();
     organizer.Name = Guid.NewGuid().ToString();
     context.Organizers.Add(organizer);
     context.SaveChanges();
     return organizer.OrganizerId;
 }
Ejemplo n.º 36
0
 private void bttn_Organize_Click(object sender, EventArgs e)
 {
     Organizer o = new Organizer();
     o.OrganizeWithDisplay(30, 30);
     this.Invoke((MethodInvoker)delegate
     {
         this.Controls.Add(o.panel);
         o.panel.BringToFront();
         (o.panel.Controls["lstLeft"] as ListView).Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
         (o.panel.Controls["lstRight"] as ListView).Columns[0].AutoResize(ColumnHeaderAutoResizeStyle.ColumnContent);
     });
 }
Ejemplo n.º 37
0
 /// <summary>
 /// Determines whether the specified <see cref="Cronofy.Organizer"/> is
 /// equal to the current <see cref="Cronofy.Organizer"/>.
 /// </summary>
 /// <param name="other">
 /// The <see cref="Cronofy.Organizer"/> to compare with the current
 /// <see cref="Cronofy.Organizer"/>.
 /// </param>
 /// <returns>
 /// <c>true</c> if the specified <see cref="Cronofy.Organizer"/> is equal
 /// to the current <see cref="Cronofy.Organizer"/>; otherwise,
 /// <c>false</c>.
 /// </returns>
 public bool Equals(Organizer other)
 {
     return other != null
         && this.Email == other.Email
         && this.DisplayName == other.DisplayName;
 }