コード例 #1
0
        public static Person[] SelectSortedStatic (People people, string sort)
        {
            if (people == null)
            {
                return new Person[0];
            }


            List<Person> pList = new List<Person>();
            Person[] foundPersons = SelectStatic((People)people);
            foreach (Person pers in foundPersons)
            {
                pList.Add(pers);
            }

            switch (sort)
            {
                case "PersonId": pList.Sort(PersonIdComparison); break;
                case "Name": pList.Sort(NameComparison); break;
                case "PostalCode": pList.Sort(PostalCodeComparison); break;
                case "CityName": pList.Sort(CityComparison); break;
                case "Birthdate": pList.Sort(BirthdateComparison); break;

                // New sortexpressions
                case "Email": pList.Sort(EmailComparison); break;
                case "Phone": pList.Sort(PhoneComparison); break;
            }

            return pList.ToArray();
        }
コード例 #2
0
	private void PopulatePeopleList(People peoples)
	{
		if (cellPrefab == null || tableView == null)
		{	
			return;
		}
		
		foreach (var item in peoples.data)
		{
			var go = (GameObject)Instantiate(cellPrefab);
			go.transform.parent = tableView.transform;
			go.transform.localScale = Vector3.one;
			go.transform.localRotation = Quaternion.identity;
			go.transform.localPosition = Vector3.zero;
			
			var info = go.GetComponent<UserInfo>();
			
			if (info != null)
			{
				info.SetLabel(item.fullname);
				info.FetchPicture(item.picture);
				info.SetUserObject(item);
				info.OnClicked = OnClicked;
				cells.Add(info);
			}
		}
		
		if (tableView != null)
		{
			tableView.repositionNow = true;
		}
	}
コード例 #3
0
    public void WritePerson(People p)
    {
        this.p = p;

        SqlTransaction tran = null;

        SqlCommand pCmd = WritePerson();
        SqlCommand aCmd = WriteAddress();

        connect.Open();
        try
        {
            tran = connect.BeginTransaction();
            pCmd.Transaction = tran;
            aCmd.Transaction = tran;
            pCmd.ExecuteNonQuery();
            aCmd.ExecuteNonQuery();

            tran.Commit();
        }
        catch (Exception ex)
        {
            tran.Rollback();
            throw ex;
        }
        finally
        {
            connect.Close();
        }
    }
コード例 #4
0
 public NewsletterTransmitter2 (string title, string htmlTemplateFile, string textTemplateFile, People sendList)
 {
     this.title = title;
     this.htmlTemplateFile = htmlTemplateFile;
     this.textTemplateFile = textTemplateFile;
     this.sendList = sendList;
 }
コード例 #5
0
    public void MakeDonation(People p)
    {
        this.p = p;
        SqlTransaction tran = null;

        SqlCommand mCmd = MakeDonations();

        connect.Open();

        try
        {
            tran = connect.BeginTransaction();
            mCmd.Transaction = tran;
            mCmd.ExecuteNonQuery();

            tran.Commit();
        }
        catch (Exception ex)
        {
            tran.Rollback();
            throw ex;
        }
        finally
        {
            connect.Close();
        }
    }
コード例 #6
0
        protected void Page_Load(object sender, EventArgs e)
        {
            Response.ContentType = "application/json";

            string pattern = Request.QueryString["namePattern"];

            People matches = People.FromNamePattern(pattern);

            matches = Authorization.FilterPeopleToMatchAuthority(matches, CurrentUser.GetAuthority());

            if (matches == null)
            {
                matches = new People();
            }

            if (matches.Count > 10)
            {
                matches.RemoveRange(10, matches.Count - 10);
            }

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

            foreach (Person person in matches)
            {
                string onePerson = '{' + String.Format("\"id\":\"{0}\",\"name\":\"{1}\",\"avatar16Url\":\"{2}\"", person.Identity, JsonSanitize(person.Canonical), person.GetSecureAvatarLink(16)) + '}';
                jsonPeople.Add(onePerson);
            }

            string result = '[' + String.Join(",", jsonPeople.ToArray()) + ']';

            Response.Output.WriteLine(result);

            Response.End();
        }
コード例 #7
0
 public PeopleResponse Get(People request)
 {
     return new PeopleResponse
     {
         People = _peopleRepository.GetPeople()
     };
 }
コード例 #8
0
ファイル: test.aspx.cs プロジェクト: kreeeeg/site
 protected void BtAddPeople(object sender, EventArgs e)
 {
     hfPeoplesViewState.Value = "";
     UpdateGrid();
     if (!string.IsNullOrEmpty(tbltype.Text) && !string.IsNullOrEmpty(tblsubtype.Text) && !string.IsNullOrEmpty(tbllastname.Text) && !string.IsNullOrEmpty(tblfirstname.Text) && !string.IsNullOrEmpty(tblmiddlename.Text) && !string.IsNullOrEmpty(tblpost.Text) && !string.IsNullOrEmpty(tblemail1.Text) && !string.IsNullOrEmpty(tblemail2.Text) && !string.IsNullOrEmpty(tblroom.Text) && !string.IsNullOrEmpty(tblphone1.Text) && !string.IsNullOrEmpty(tblphone2.Text) && !string.IsNullOrEmpty(tblphone3.Text))
     {
         var id = Peoples.Count > 0 ? Peoples.Max(x => x.p_Id) + 1 : 1;
         var p = new People
         {
             p_Id = id,
             p_type = tbltype.Text,
             p_subtype = tblsubtype.Text,
             p_lastname = tbllastname.Text,
             p_firstname = tblfirstname.Text,
             p_middlename = tblmiddlename.Text,
             p_post = tblpost.Text,
             p_email1 = tblemail1.Text,
             p_email2 = tblemail2.Text,
             p_room = tblroom.Text,
             p_phone1 = tblphone1.Text,
             p_phone2 = tblphone2.Text,
             p_phone3 = tblphone3.Text
         };
         Peoples.Add(p);
         comm_sqlDataContext mylinq = new comm_sqlDataContext();
         int bb = mylinq.addrow(tbltype.Text, tblsubtype.Text, tbllastname.Text, tblfirstname.Text, tblmiddlename.Text, tblpost.Text, tblemail1.Text, tblemail2.Text, tblroom.Text, tblphone1.Text, tblphone2.Text, tblphone3.Text);
         UpdateGrid();
         Button3.Style.Add("display", "none");
     }
 }
コード例 #9
0
ファイル: Chat.cs プロジェクト: leonsbuddydave/Backtalk
        private void PostMessage(string Message, People person)
        {
            Log.Debug (TAG, Message);
            ChatMessages.Add ( new ChatMessage( Message, person) );

            listAdapter = new ChatAdapter(this, ChatMessages.ToArray());
            listView.Adapter = listAdapter;
        }
コード例 #10
0
        public static Person[] SelectStatic (People people)
        {
            if (people == null)
            {
                return new Person[0];
            }

            return people.ToArray();
        }
コード例 #11
0
    protected void btnAddPerson_Click(object sender, EventArgs e)
    {
        string strForename = txtForename.Text;
        string strSurname = txtSurname.Text;
        if (string.IsNullOrEmpty(strSurname))
        {
            MessageLabel.Text = "The Surname must be provided";
        }
        else
        {
            MembershipUser userInfo = Membership.GetUser();
            Guid user_ID = (Guid)userInfo.ProviderUserKey;

            Person_Address_ID = Common.Person_Address_ID;
            if (!string.IsNullOrEmpty(Person_Address_ID))
            {
                Guid address_ID = new Guid(Person_Address_ID);

                People person = new People();
                person.Person_Title = txtTitle.Text;
                person.Person_Forename = txtForename.Text;
                person.Person_Surname = txtSurname.Text;
                person.Address_ID = address_ID;
                person.Person_Mobile = txtMobile.Text;
                person.Person_Landline = txtLandline.Text;
                person.Person_Email = txtEmail.Text;

                Guid? person_ID = person.Insert_Person(user_ID);

                if (person_ID != null)
                {
                    Person_ID = person_ID.ToString();
                    MessageLabel.Text = string.Format("{0} {1} {2} was added successfully", person.Person_Title, person.Person_Forename, person.Person_Surname);
                    //ClearEntryFields();
                    if (!string.IsNullOrEmpty(btnReturn.PostBackUrl))
                        DivReturn.Visible = true;

                    DivAddPerson.Visible = false;
                    divNewPerson.Visible = true;
                    divUpdatePerson.Visible = true;
                    PopulatePersonGridView(null, 1);
                    StoreCommon();
                }
                else
                {
                    DivAddPerson.Visible = true;
                    divNewPerson.Visible = false;
                    divUpdatePerson.Visible = false;
                }
            }
            else
            {
                MessageLabel.Text = "You must provide an Address for this person";
            }
        }
    }
コード例 #12
0
ファイル: Newsletter.cs プロジェクト: SwarmCorp/Swarmops
 public Newsletter (int templateId, string senderName, string senderAddress, string title, string body,
                    People recipients)
 {
     this.TemplateId = templateId;
     this.SenderName = senderName;
     this.SenderAddress = senderAddress;
     this.Title = title;
     this.Body = body;
     this.Recipients = recipients;
 }
コード例 #13
0
ファイル: MailTransmitter.cs プロジェクト: SwarmCorp/Swarmops
 public MailTransmitter (string fromName, string fromAddress, string subject, string bodyPlain, People recipients,
                         bool toOfficers)
 {
     this.fromName = fromName;
     this.fromAddress = fromAddress;
     this.subject = subject;
     this.bodyPlain = bodyPlain;
     this.recipients = recipients;
     this.toOfficers = toOfficers;
 }
コード例 #14
0
 private void CheckPeople(People p)
 {
     var amountPersons = p.Person.Length;
       Assert.AreEqual(amountPersons, people.Person.Length);
       for (var i = 0; i < amountPersons; i++)
       {
     Assert.AreEqual(p.Person[i].FIO, people.Person[i].FIO);
     Assert.AreEqual(p.Person[i].Salary, people.Person[i].Salary);
     Assert.AreEqual(p.Person[i].SalaryDate, people.Person[i].SalaryDate);
       }
 }
コード例 #15
0
	void OnTriggerEnter2D(Collider2D coll) {
		if (people == null) {
			people = gameObject.GetComponentInParent<People> ();
		}
		if (people.tag == "Player" && coll.gameObject.tag == "Gold") {
			goldCollector.collectGold();
			Destroy(coll.gameObject);
		} else if (people.tag == "Chaser" && coll.gameObject.tag == "Gold" && !coll.gameObject.GetComponent<Gold>().disableForChaser) {
			(people as Chaser).collectGold();
			Destroy(coll.gameObject);
		}
	}
コード例 #16
0
ファイル: PeopleServices.asmx.cs プロジェクト: alfaruq/WebSvc
        public string InsertPeople(string FullName, int Age)
        {
            var objPeople = new People();
            objPeople.FullName = FullName;
            objPeople.Age = Age;
            objPeople.CreatedDate = DateTime.Now;
            objPeople.ModifiedDate = DateTime.Now;

            PeopleProvider.InsertPeople(objPeople);

            return JsonConvert.SerializeObject(objPeople);
        }
コード例 #17
0
 public void execute()
 {
     PopulateList(10);
     People peopleList = new People(personList);
     var enumerator = peopleList.GetEnumerator();
     Console.WriteLine("NAME\tID\tLOCATION\n");
     while (enumerator.MoveNext())
     {
         Person per = (Person)enumerator.Current;
         Console.WriteLine(String.Format("{0}\t{1}\t{2}", per.name,per.id,per.location));
     }
 }
コード例 #18
0
        public BetegMainController(MungoSystem db, People people)
        {
            dbController = new DBController(db);

            betegAdatok = dbController.getBetegAdatok(people.PeopleID);
            betegAdatok.Kortortenet = dbController.getKortortenetekByBetegId(betegAdatok.betegekElem.BetegID);
            betegAdatok.idopontok = dbController.getAllIdopont();
            var p = dbController.getPossibleIdopont(betegAdatok.BetegID);
            betegAdatok.changed();
            idopontCreator = new IdopontCreator(betegAdatok.BetegID);
            SetView(ViewTypes.Idopont);
        }
コード例 #19
0
ファイル: SeeHeart.cs プロジェクト: RyotaRaven/LD29
 void OnTriggerExit(Collider stuff)
 {
     if(stuff.tag=="People")
     {
         close=false;
         person=null;
     }
     if(stuff.tag=="Holder")
     {
         CanPut=false;
         hold=null;
     }
 }
コード例 #20
0
	void OnTriggerEnter2D(Collider2D coll) {
		if (people == null) {
			people = gameObject.GetComponentInParent<People> ();
		}
		if (coll.gameObject.name == "LadderWhole") {
			people.onLadderCount ++;
		} if (coll.gameObject.name == "LadderWholeHidden" && coll.gameObject.GetComponentInParent<HiddenLadder> ().shown) {
			people.onLadderCount ++;	
		} else if (coll.gameObject.tag == "Chaser" && people.tag == "Player"
		           && !coll.gameObject.GetComponent<Chaser>().inPit) {
			people.die();
		}
	}
    public void Fill_Letter(People e)
    {
        lblName.Text = e.Name;
        lblName.Style.Apply(PrintSettingBLL.Envelope.Name);

        lblAddress.Text = e.ResidentAddress;
        lblAddress.Style.Apply(PrintSettingBLL.Envelope.Address);

        lblGeo.Text = e.FullResidentalGeo;
        lblGeo.Style.Apply(PrintSettingBLL.Envelope.Geo);

        DivUC.Style.Apply(PrintSettingBLL.Envelope.UCSize);
    }
コード例 #22
0
ファイル: SeeHeart.cs プロジェクト: RyotaRaven/LD29
 void OnTriggerEnter(Collider stuff)
 {
     if(stuff.tag=="People")
     {
         close=true;
         person=stuff.GetComponent<People>();
     }
     if(stuff.tag=="Holder")
     {
         CanPut=true;
         hold=stuff.GetComponent<Sparkles>();
     }
 }
コード例 #23
0
        private void CreateTestData()
        {
            person = new Person
              {
            FIO = MoqDataGenerator.GetRandomString(10),
            Salary = MoqDataGenerator.GetRandomNumber(1, 110),
            SalaryDate = MoqDataGenerator.GetRandomDate()
              };

              people = new People
              {
            Person = new[] { person, person }
              };
        }
コード例 #24
0
 /// <summary>
 /// Initializes a new instance of the NewPeopleExtension class.
 /// </summary>
 public void Create(People p)
 {
     this.Agility = p.Agility;
     this.Charisma = p.Charisma;
     this.DateOfBirth = p.DateOfBirth;
     this.Endurance = p.Endurance;
     this.FirstName = p.FirstName;
     this.Id = p.Id;
     this.Intelligence = p.Intelligence;
     this.LastName = p.LastName;
     this.Luck = p.Luck;
     this.Perception = p.Perception;
     this.Sex = p.Sex;
     this.Strength = p.Strength;
 }
コード例 #25
0
ファイル: Default.aspx.cs プロジェクト: Ravnsara/Assignment2
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        People p = new People();
        p.FirstName = txtFirstName.Text;
        p.LastName = txtLastName.Text;
        p.Email = txtEmail.Text;
        p.Address = txtAddress.Text;
        p.City = txtCity.Text;
        p.State = txtState.Text;
        p.Zip = txtZip.Text;
        p.Phone = txtPhone.Text;
        p.Password = txtPassword.Text;

        Session["People"] = p;
        Response.Redirect("Default2.aspx");
    }
コード例 #26
0
    protected void btnDonateSubmit_Click(object sender, EventArgs e)
    {
        int pk = (int)Session["person"];
        People p = new People();
        p.personKey = pk;
        p.Donation = txtMakeDonation.Text;
        ManagePeople mp = new ManagePeople();

        try
        {
            mp.MakeDonation(p);
            Response.Redirect("Donations.aspx");

        }
        catch (Exception ex)
        {
            lblError.Text = ex.Message;
        }
    }
コード例 #27
0
	void OnTriggerEnter2D(Collider2D coll) {
		if (people == null) {
			people = gameObject.GetComponentInParent<People> ();
		}
		if (coll.gameObject.tag == "HardFloor") {
			people.addFloor(coll.gameObject);
		} else if (coll.gameObject.tag == "Floor" && !coll.gameObject.GetComponent<Floor>().fallTrough()
		           && !coll.gameObject.GetComponent<Floor>().containPeople(people.gameObject)){
			people.addFloor(coll.gameObject);
		} else if ((coll.gameObject.tag == "ChaserDugFloor" && gameObject.GetComponentInParent<Chaser>() != null)) {
			Chaser chaser = gameObject.GetComponentInParent<Chaser>();
			chaser.dropToPit();
		} else if (coll.gameObject.name == "DropAllGoldFloorCollider" && people.tag == "Chaser") {
			(people as Chaser).dropAllGold();
		} else if (coll.gameObject.name == "ChaserTopCollider" 
		           && !coll.gameObject.GetComponentInParent<Chaser>().inPit) {
			coll.gameObject.GetComponentInParent<People>().registerDependantTrigger(people);
			people.addFloor(coll.gameObject);
		}

	}
コード例 #28
0
ファイル: Default.aspx.cs プロジェクト: rmalave/ITC172
    protected void Button1_Click(object sender, EventArgs e)
    {
        //on the button click we make an instance of our person
        //class and then write the values in the text boxes
        //to the class properties
        People person = new People();
        person.FirstName = txtFirstName.Text;
        person.LastName = txtLastName.Text;
        person.Phone = txtPhone.Text;
        person.Email = txtEmail.Text;
        person.City = txtCity.Text;
        person.State = txtState.Text;
        person.Zip = txtZip.Text;
        person.Password = txtPassword.Text;

        //we create a session variable to store our class
        //with all the values in it
        //so we can access it on other pages
        Session["donation"] = person;
        //then we redirect to the second page
        Response.Redirect("Default2.aspx");
    }
コード例 #29
0
ファイル: Program.cs プロジェクト: rogerlio/csharp-proj
        static void Main(string[] args)
        {
            People people = new People()
            {
                new Person("John", "Doe",  "132 Dr",    "305 456 7899"),
                new Person("Jane", "Doe",  "546 Road",  "786 789 8787"),
                new Person("John", "Doe",  "789 Ave",   "954 354 7982"),
                new Person("Jack", "Doe",  "467 St",    "954 342 7111"),
                new Person("John", "Deer", "123 Blvd",  "542 234 7982"),
            };

            Console.ForegroundColor = ConsoleColor.White;
            showList("  Entire List", people);

            Console.ForegroundColor = ConsoleColor.Green;
            showList("  Originals", people.Originals());

            Console.ForegroundColor = ConsoleColor.Red;
            showList("  Duplicates", people.Duplicates());

            Console.WriteLine("");
            Console.ReadLine();
        }
コード例 #30
0
ファイル: Create.aspx.cs プロジェクト: geoffritchey/cafeteria
 protected void btnFindId_Click(object sender, EventArgs e)
 {
     try
     {
         People people = new People();
         people.find("[people_id] = '" + this.tbID.Text + "'");
         this.Image1.ImageUrl = this.pictureLocation + this.pictureDefault;
         if (people.PeopleId != null)
         {
             string path = this.pictureLocation + this.tbID.Text + this.pictureFormat;
             if (MyFile.Exists(path))
             {
                 this.Image1.ImageUrl = path;
             }
             this.lblFirstName.Text = people.FirstName;
             this.lblLastName.Text = people.LastName;
         }
         else
         {
             this.lblFirstName.Text = "";
             this.lblLastName.Text = "";
             throw new Exception("Invalid ID");
         }
         Customer customer = new Customer();
         customer.find("(c.[PeopleID]='" + this.tbID.Text + "')");
         if (customer.PeopleID != null)
         {
             throw new Exception("Already Exists");
         }
         this.prepareError(null);
     }
     catch (Exception exception)
     {
         this.prepareError(exception.Message);
     }
     this.tbID.Focus();
 }
コード例 #31
0
 internal void RaiseOccupationRowClicked(People people)
 {
     OccupationRowClicked?.Invoke(people);
 }
コード例 #32
0
 public void AddPerson(PocoPerson person)
 {
     People.Add(person);
     OnPeopleChanged();
 }
コード例 #33
0
        public virtual void ViewDetailsSelector()
        {
            if (!NSThread.IsMain)
            {
                InvokeOnMainThread(ViewDetailsSelector);
                return;
            }
            NSTableColumn column = GetColumnID("IndividualID");

            if (column != null)
            {
                if (_tableView.Source.GetViewForItem(_tableView, column, _tableView.SelectedRow) is NSTableCellView cell)
                {
                    string     indID = cell.TextField.StringValue;
                    Individual ind   = FamilyTree.Instance.GetIndividual(indID);
                    RaiseFactRowClicked(ind);
                    return;
                }
            }
            column = GetColumnID("FamilyID");
            if (column != null)
            {
                if (_tableView.Source.GetViewForItem(_tableView, column, _tableView.SelectedRow) is NSTableCellView cell)
                {
                    string familyID = cell.TextField.StringValue;
                    Family family   = FamilyTree.Instance.GetFamily(familyID);
                    RaiseFactRowClicked(family);
                    return;
                }
            }
            column = GetColumnID("SourceID");
            if (column != null)
            {
                if (_tableView.Source.GetViewForItem(_tableView, column, _tableView.SelectedRow) is NSTableCellView cell)
                {
                    string     sourceID = cell.TextField.StringValue;
                    FactSource source   = FamilyTree.Instance.GetSource(sourceID);
                    RaiseFactRowClicked(source);
                    return;
                }
            }
            column = GetColumnID("Occupation");
            if (column != null)
            {
                if (_tableView.Source.GetViewForItem(_tableView, column, _tableView.SelectedRow) is NSTableCellView cell)
                {
                    string occupation = cell.TextField.StringValue;
                    People people     = new People();
                    people.SetWorkers(occupation, FamilyTree.Instance.AllWorkers(occupation));
                    RaiseOccupationRowClicked(people);
                    return;
                }
            }
            column = GetColumnID("ErrorType");
            if (column != null)
            {
                var source = _tableView.Source as BindingListTableSource <IDisplayDataError>;
                if (source.GetRowObject(_tableView.SelectedRow) is DataError error)
                {
                    if (error.IsFamily == "Yes")
                    {
                        Family family = FamilyTree.Instance.GetFamily(error.Reference);
                        RaiseDataErrorRowClicked(null, family);
                    }
                    else
                    {
                        Individual ind = FamilyTree.Instance.GetIndividual(error.Reference);
                        RaiseDataErrorRowClicked(ind, null);
                    }
                }
            }
        }
コード例 #34
0
 public void Dispose()
 {
     Context?.Dispose();
     People?.Dispose();
     Cities?.Dispose();
 }
コード例 #35
0
        public IActionResult Customer_Index(People p)
        {
            cmsDBContext db = new cmsDBContext();

            return(View(db.Projects.ToList()));
        }
コード例 #36
0
ファイル: TestCityApp.cs プロジェクト: Beia55/city_model
 public void removePerson(People p)
 {
     populationList.Remove(p);
 }
コード例 #37
0
ファイル: PeopleService.cs プロジェクト: Shturmon/MovieSearch
 public void Edit(People people)
 {
     _repo.Update(people);
     _repo.Save();
 }
コード例 #38
0
 public void Update(People obj)
 {
     PeopleRepository.Update(obj);
 }
コード例 #39
0
 public void SavePerson(People obj)
 {
     PeopleRepository.Insert(obj);
 }
コード例 #40
0
 public RRHHPeopleDialog(UserLogin _user, People _people)
 {
     user   = _user;
     people = _people;
 }
コード例 #41
0
 public void Insert(People obj)
 {
     PeopleRepository.Insert(obj);
 }
コード例 #42
0
 public IEnumerable <Person> GetPeople()
 {
     return(People.GetEveryone());
 }
コード例 #43
0
ファイル: ResetPassword.aspx.cs プロジェクト: mikran/Swarmops
        public static bool PerformReset(string mailAddress, string ticket, string newPassword)
        {
            People people = People.FromMail(mailAddress.Trim());

            if (people.Count != 1)
            {
                return(false);
            }

            Person resetPerson = people[0];

            string[] resetData = resetPerson.ResetPasswordTicket.Split(',');

            if (resetData.Length != 2)
            {
                return(false); // invalid data or no ticket
            }

            // This may throw on invalid data, which will give a slightly different error but that's fine too for now.
            DateTime ticketExpiresUtc = DateTime.Parse(resetData[0]);

            if (DateTime.UtcNow > ticketExpiresUtc)
            {
                // Ticket expired.
                return(false);
            }

            if (ticket != resetData[1])
            {
                // Bad ticket.
                return(false);
            }

            // When we get here, all checks to reset the password have completed. Change the password, log the change,
            // notify the user that the password was changed, set a new authentication cookie, and have the web page
            // redirect to Dashboard (by returning true).

            // Clear password reset ticket

            resetPerson.ResetPasswordTicket = string.Empty;

            // Create lockdown code, notify

            string lockdownTicket = SupportFunctions.GenerateSecureRandomKey(16);

            OutboundComm.CreateSecurityNotification(resetPerson, null, null, lockdownTicket,
                                                    NotificationResource.Password_Changed);
            resetPerson.AccountLockdownTicket = DateTime.UtcNow.AddDays(1).ToString(CultureInfo.InvariantCulture) + "," +
                                                lockdownTicket;

            // Set new password

            resetPerson.SetPassword(newPassword);

            // Log the password reset

            SwarmopsLog.CreateEntry(resetPerson,
                                    new PasswordResetLogEntry(resetPerson, SupportFunctions.GetRemoteIPAddressChain()));

            // Set authentication cookies

            int lastOrgId = resetPerson.LastLogonOrganizationId;

            if (lastOrgId == 0)
            {
                lastOrgId = Organization.SandboxIdentity;
            }

            if (!resetPerson.ParticipatesInOrganizationOrParent(lastOrgId))
            {
                // If the person doesn't have access to the last organization (anymore), log on to Sandbox

                lastOrgId = 1;
            }

            // Set cookies

            FormsAuthentication.SetAuthCookie(Authority.FromLogin(resetPerson).ToEncryptedXml(), true);
            DashboardMessage.Set(Resources.Pages.Security.ResetPassword_Success);

            return(true); // temp

            // do NOT NOT NOT trim password - this is deliberate. Passwords starting/ending in whitespace must be possible
        }
コード例 #44
0
 public void DeletePerson(PocoPerson person)
 {
     People.Remove(person);
     OnPeopleChanged();
 }
コード例 #45
0
 public NameController()
 {
     this._people = new People();
 }
コード例 #46
0
 public List <IPerson> SortByLastName()
 {
     return(People.OrderBy(m => m.LastName).ToList());
 }
コード例 #47
0
ファイル: TestCityApp.cs プロジェクト: Beia55/city_model
 public void addPeople(People p)
 {
     populationList.Add(p);
 }
コード例 #48
0
ファイル: People.cs プロジェクト: kevinwall1992/Sol
 public float GetMarginalUtilityOfPurchase(People people, float credits)
 {
     return(people.GetPopulationChange(this, credits) -
            people.GetPopulationChange());
 }
コード例 #49
0
ファイル: PeopleService.cs プロジェクト: Shturmon/MovieSearch
 public void AddPeople(People people)
 {
     _repo.Insert(people);
     _repo.Save();
 }
コード例 #50
0
            private void GoToPerson(GoToPageMessage obj)
            {
                var person = People.First(p => p.Id == obj.PersonId);

                SelectedPerson = person;
            }
コード例 #51
0
 public List <ReportTemplatePersonModel> GetPeople()
 {
     return(People.Select(x => new ReportTemplatePersonModel(x)).ToList());
 }
コード例 #52
0
        public IActionResult Delete(int id)
        {
            People thisPeople = db.People.FirstOrDefault(people => people.PeopleId == id);

            return(View(thisPeople));
        }
コード例 #53
0
        public static void Initialize(KinoContext ctx)
        {
            ctx.Database.EnsureCreated();

            if (ctx.movies.Any())
            {
                return;   // DB has been seeded
            }

            var genres = new Genre[] {
                new Genre {
                    GenreName = "Action"
                },
                new Genre {
                    GenreName = "Horror"
                },
                new Genre {
                    GenreName = "Drama"
                },
                new Genre {
                    GenreName = "Comedy"
                },
                new Genre {
                    GenreName = "Animation"
                },
                new Genre {
                    GenreName = "Science fiction"
                },
                new Genre {
                    GenreName = "Romance"
                },
                new Genre {
                    GenreName = "Musical"
                },
                new Genre {
                    GenreName = "Thriller"
                },
                new Genre {
                    GenreName = "Horror"
                }
            };

            ctx.genres.AddRange(genres);
            ctx.SaveChanges();

            var people = new People[] {
                // The Fast and the Furious: Tokyo Drif
                new People {
                    Name = "Justin Lin"
                },
                new People {
                    Name = "Lucas Black"
                },
                new People {
                    Name = "Bow Wow"
                },
                // Godzilla: King of the Monsters
                new People {
                    Name = "Michael Dougherty"
                },
                new People {
                    Name = "Kyle Chandler"
                },
                new People {
                    Name = "Vera Farmiga"
                },
                new People {
                    Name = "Millie Bobby Brown"
                },
                // Anchorman 2: The Legend Continues
                new People {
                    Name = "Adam McKay"
                },
                new People {
                    Name = "Will Ferrell"
                },
                new People {
                    Name = "Steve Carell"
                },
                // The Hateful Eight
                new People {
                    Name = "Quentin Tarantino"
                },
                new People {
                    Name = "Samuel L. Jackson"
                },
                new People {
                    Name = "Kurt Russell"
                },
                // Creed
                new People {
                    Name = "Ryan Coogler"
                },
                new People {
                    Name = "Michael B. Jordan"
                },
                new People {
                    Name = "Sylvester Stallone"
                },
                // Jurassic World
                new People {
                    Name = "Colin Trevorrow"
                },
                new People {
                    Name = "Chris Pratt"
                },
                new People {
                    Name = "Bryce Dallas Howard"
                },
                // Inside Out
                new People {
                    Name = "Pete Docter"
                },
                new People {
                    Name = "Amy Poehler"
                },
                new People {
                    Name = "Phyllis Smith"
                }
            };

            ctx.people.AddRange(people);
            ctx.SaveChanges();

            Room[] rooms = new Room[] {
                new Room {
                    Name = "Room 1"
                },
                new Room {
                    Name = "Room 2"
                },
                new Room {
                    Name = "Room 3"
                },
                new Room {
                    Name = "Room 4"
                }
            };
            ctx.rooms.AddRange(rooms);
            ctx.SaveChanges();

            var seats = new Seat[4 * 12 * 30];
            int c     = 0;

            for (int room = 0; room <= 3; room++)
            {
                for (int row = 1; row <= 12; row++)
                {
                    for (int number = 1; number <= 30; number++)
                    {
                        seats[c++] = new Seat {
                            Room = rooms[room], Row = row, Number = number
                        };
                    }
                }
            }
            ctx.seats.AddRange(seats);
            ctx.SaveChanges();

            var movies = new Movie[] {
                new Movie {
                    Title = "Fast and Furious: Tokyo Drift", Rating = "PG-13", Length = "122", StartDate = new DateTime(2020, 9, 30), EndDate = new DateTime(2021, 1, 23)
                },
                new Movie {
                    Title = "Godzilla: King of the monsters", Rating = "PG-13", Length = "134", StartDate = new DateTime(2020, 9, 21), EndDate = new DateTime(2021, 1, 15)
                },
                new Movie {
                    Title = "Anchorman 2", Rating = "PG-13", Length = "119", StartDate = new DateTime(2020, 8, 3), EndDate = new DateTime(2020, 12, 30)
                },
                new Movie {
                    Title = "Hateful eight", Rating = "R", Length = "168", StartDate = new DateTime(2020, 7, 5), EndDate = new DateTime(2020, 12, 15)
                },
                new Movie {
                    Title = "Creed", Rating = "PG-13", Length = "133", StartDate = new DateTime(2020, 7, 17), EndDate = new DateTime(2020, 12, 11)
                },
                new Movie {
                    Title = "Jurassic World", Rating = "PG-13", Length = "124", StartDate = new DateTime(2020, 6, 9), EndDate = new DateTime(2020, 12, 1)
                },
                new Movie {
                    Title = "Inside Out", Rating = "PG", Length = "95", StartDate = new DateTime(2020, 8, 12), EndDate = new DateTime(2020, 12, 25)
                }
            };

            ctx.movies.AddRange(movies);
            ctx.SaveChanges();

            // added genres to movies
            var movieGenres = new GenreMovie[]
            {
                new GenreMovie {
                    MovieID = movies.Single(m => m.Title == "Inside Out").MovieID,
                    GenreID = genres.Single(i => i.GenreName == "Action").GenreID
                },
                new GenreMovie {
                    MovieID = movies.Single(m => m.Title == "Fast and Furious: Tokyo Drift").MovieID,
                    GenreID = genres.Single(i => i.GenreName == "Action").GenreID
                },
                new GenreMovie {
                    MovieID = movies.Single(m => m.Title == "Fast and Furious: Tokyo Drift").MovieID,
                    GenreID = genres.Single(i => i.GenreName == "Drama").GenreID
                },
                new GenreMovie {
                    MovieID = movies.Single(m => m.Title == "Godzilla: King of the monsters").MovieID,
                    GenreID = genres.Single(i => i.GenreName == "Science fiction").GenreID
                },
                new GenreMovie {
                    MovieID = movies.Single(m => m.Title == "Godzilla: King of the monsters").MovieID,
                    GenreID = genres.Single(i => i.GenreName == "Action").GenreID
                },
                new GenreMovie {
                    MovieID = movies.Single(m => m.Title == "Anchorman 2").MovieID,
                    GenreID = genres.Single(i => i.GenreName == "Comedy").GenreID
                },
                new GenreMovie {
                    MovieID = movies.Single(m => m.Title == "Hateful eight").MovieID,
                    GenreID = genres.Single(i => i.GenreName == "Drama").GenreID
                },
                new GenreMovie {
                    MovieID = movies.Single(m => m.Title == "Creed").MovieID,
                    GenreID = genres.Single(i => i.GenreName == "Drama").GenreID
                },
                new GenreMovie {
                    MovieID = movies.Single(m => m.Title == "Jurassic World").MovieID,
                    GenreID = genres.Single(i => i.GenreName == "Action").GenreID
                },
                new GenreMovie {
                    MovieID = movies.Single(m => m.Title == "Inside Out").MovieID,
                    GenreID = genres.Single(i => i.GenreName == "Animation").GenreID
                }
            };

            foreach (GenreMovie gm in movieGenres)
            {
                ctx.GenreMovies.Add(gm);
            }
            ctx.SaveChanges();

            // added actors to movies
            var actors = new Actors[] {
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Fast and Furious: Tokyo Drift").MovieID,
                    PeopleID = people.Single(p => p.Name == "Lucas Black").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Fast and Furious: Tokyo Drift").MovieID,
                    PeopleID = people.Single(p => p.Name == "Bow Wow").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Godzilla: King of the monsters").MovieID,
                    PeopleID = people.Single(p => p.Name == "Kyle Chandler").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Godzilla: King of the monsters").MovieID,
                    PeopleID = people.Single(p => p.Name == "Vera Farmiga").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Godzilla: King of the monsters").MovieID,
                    PeopleID = people.Single(p => p.Name == "Millie Bobby Brown").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Anchorman 2").MovieID,
                    PeopleID = people.Single(p => p.Name == "Will Ferrell").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Anchorman 2").MovieID,
                    PeopleID = people.Single(p => p.Name == "Steve Carell").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Hateful eight").MovieID,
                    PeopleID = people.Single(p => p.Name == "Samuel L. Jackson").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Hateful eight").MovieID,
                    PeopleID = people.Single(p => p.Name == "Kurt Russell").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Creed").MovieID,
                    PeopleID = people.Single(p => p.Name == "Michael B. Jordan").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Creed").MovieID,
                    PeopleID = people.Single(p => p.Name == "Sylvester Stallone").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Jurassic World").MovieID,
                    PeopleID = people.Single(p => p.Name == "Chris Pratt").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Jurassic World").MovieID,
                    PeopleID = people.Single(p => p.Name == "Bryce Dallas Howard").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Inside Out").MovieID,
                    PeopleID = people.Single(p => p.Name == "Amy Poehler").PeopleID
                },
                new Actors {
                    MovieID  = movies.Single(m => m.Title == "Inside Out").MovieID,
                    PeopleID = people.Single(p => p.Name == "Phyllis Smith").PeopleID
                }
            };

            foreach (Actors a in actors)
            {
                ctx.Actors.Add(a);
            }
            ctx.SaveChanges();

            // added directors to movies
            var directors = new Directors[] {
                new Directors {
                    MovieID  = movies.Single(m => m.Title == "Fast and Furious: Tokyo Drift").MovieID,
                    PeopleID = people.Single(p => p.Name == "Justin Lin").PeopleID
                },
                new Directors {
                    MovieID  = movies.Single(m => m.Title == "Godzilla: King of the monsters").MovieID,
                    PeopleID = people.Single(p => p.Name == "Michael Dougherty").PeopleID
                },
                new Directors {
                    MovieID  = movies.Single(m => m.Title == "Anchorman 2").MovieID,
                    PeopleID = people.Single(p => p.Name == "Adam McKay").PeopleID
                },
                new Directors {
                    MovieID  = movies.Single(m => m.Title == "Hateful eight").MovieID,
                    PeopleID = people.Single(p => p.Name == "Quentin Tarantino").PeopleID
                },
                new Directors {
                    MovieID  = movies.Single(m => m.Title == "Creed").MovieID,
                    PeopleID = people.Single(p => p.Name == "Ryan Coogler").PeopleID
                },
                new Directors {
                    MovieID  = movies.Single(m => m.Title == "Jurassic World").MovieID,
                    PeopleID = people.Single(p => p.Name == "Colin Trevorrow").PeopleID
                },
                new Directors {
                    MovieID  = movies.Single(m => m.Title == "Inside Out").MovieID,
                    PeopleID = people.Single(p => p.Name == "Pete Docter").PeopleID
                },
            };

            foreach (Directors d in directors)
            {
                ctx.Directors.Add(d);
            }
            ctx.SaveChanges();

            /* Admin role */
            ctx.Roles.Add(new IdentityRole {
                Id = "1", Name = "Administrator"
            });

            /* Admin user */
            var userAdmin = new AppUser
            {
                FirstName            = "Gospod",
                LastName             = "Admin",
                NormalizedEmail      = "*****@*****.**",
                Email                = "*****@*****.**",
                UserName             = "******",
                NormalizedUserName   = "******",
                PhoneNumber          = "+111111111111",
                EmailConfirmed       = true,
                PhoneNumberConfirmed = true,
                SecurityStamp        = Guid.NewGuid().ToString("D")
            };

            if (!ctx.Users.Any(u => u.UserName == userAdmin.UserName))
            {
                var password = new PasswordHasher <AppUser>();
                var hashed   = password.HashPassword(userAdmin, "Geslogeslo1!");
                userAdmin.PasswordHash = hashed;
                ctx.Users.Add(userAdmin);
            }

            ctx.SaveChanges();

            /* Add user role */
            ctx.UserRoles.Add(new IdentityUserRole <string> {
                RoleId = "1", UserId = userAdmin.Id
            });
            ctx.SaveChanges();

            /* Normal user */
            var userNormal = new AppUser
            {
                FirstName            = "Gospod",
                LastName             = "Navadnik",
                NormalizedEmail      = "*****@*****.**",
                Email                = "*****@*****.**",
                UserName             = "******",
                NormalizedUserName   = "******",
                PhoneNumber          = "+111111111111",
                EmailConfirmed       = true,
                PhoneNumberConfirmed = true,
                SecurityStamp        = Guid.NewGuid().ToString("D")
            };

            if (!ctx.Users.Any(u => u.UserName == userNormal.UserName))
            {
                var password = new PasswordHasher <AppUser>();
                var hashed   = password.HashPassword(userNormal, "Geslogeslo1!");
                userNormal.PasswordHash = hashed;
                ctx.Users.Add(userNormal);
            }

            ctx.SaveChanges();
        }
コード例 #54
0
 public PersonController(IPersonRepository personRepository)
 {
     _PersonRepository = personRepository;
     People.AddRange(personRepository.List().Select(entity => new PersonDisplay(entity)));
 }
コード例 #55
0
 public List <IPerson> FirstNameStartWith(char firstChar)
 {
     return(People
            .Where(p => p.FirstName[0] == firstChar)
            .OrderBy(m => m.LastName).ToList());
 }
コード例 #56
0
 public IActionResult Create(People people)
 {
     db.People.Add(people);
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }
コード例 #57
0
 public List <IPerson> LastNameLongerThen(int length)
 {
     return(People
            .Where(p => p.LastName.Length > length)
            .OrderBy(m => m.LastName).ToList());
 }
コード例 #58
0
 public List <IPerson> SortByLastNameLength()
 {
     return(People.OrderBy(p => p.LastName.Length).ToList());
 }
コード例 #59
0
 public void DeletePeople(People entity)
 {
     context.Peoples.Remove(entity);
     context.SaveChanges();
 }
コード例 #60
0
 public IActionResult Edit(People people)
 {
     db.Entry(people).State = EntityState.Modified;
     db.SaveChanges();
     return(RedirectToAction("Index"));
 }