예제 #1
0
파일: Debts.cs 프로젝트: 9045857/Pohod
 public void CorrectPersonNameAndListBox(Debt debt, string name)
 {
     if (TripDebts.Contains(debt))
     {
         debt.Person.Name = name == "" ? "Noname" : name;
     }
 }
예제 #2
0
파일: Debts.cs 프로젝트: 9045857/Pohod
 public void CorrectFactor(Debt debt, double factor)
 {
     if (TripDebts.Contains(debt))
     {
         trip.CorrectFactor(debt.Person, factor);
     }
 }
예제 #3
0
파일: Debts.cs 프로젝트: 9045857/Pohod
        public void AddDebtInListAndListBox(Person person)
        {
            Debt debt = new Debt(peopleOnPanel /*[Count]*/, person, Count);

            debt.PersonOnPanelMain.Visible = true;

            TripDebts.Add(debt);
            listBoxWithDebts.Items.Add(debt);
        }
예제 #4
0
파일: Debts.cs 프로젝트: 9045857/Pohod
        private void FillDebtsListFromTrip()
        {
            int debtId = 0;

            ClearPeoplesOnPanel();

            foreach (Person person in trip.People)
            {
                Debt debt = new Debt(peopleOnPanel /*peopleOnPanel[debtId]*/, person, debtId);

                TripDebts.Add(debt);

                debtId++;
            }
        }
예제 #5
0
        public PersonForm(Debts debts, Debt debt, ListBox listBoxPeople, Form1 main, int index)
        {
            Location = MousePosition;
            InitializeComponent();
            this.debt  = debt;
            this.debts = debts;

            this.listBoxPeople = listBoxPeople;
            this.main          = main;
            this.index         = index;

            textBoxPersonName.Text   = debt.Person.Name;
            textBoxPersonFactor.Text = debt.Person.DebtFactor.ToString();

            Show();
        }
예제 #6
0
        private void buttonDeletePerson_Click(object sender, EventArgs e)
        {
            if (listBoxPeople.SelectedItems.Count == 1)
            {
                Debt debt = listBoxPeople.SelectedItem as Debt;

                string dialogCaption = string.Format("Удаляем \"{0}\"", debt.Person.Name);
                if (MessageBox.Show("Вы уверены?", dialogCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Debts debts = listBoxTrips.SelectedItem as Debts;

                    debts.RemoveDebtAndPersonFromListAndTrip(debt);

                    textBoxPersonInfo.Text = "";

                    debt.PersonOnPanelMain.Clear();
                    debts.ReloadDebtsPanel();

                    ShowSelectedProductInfo();
                }
            }
            else if (listBoxPeople.SelectedItems.Count > 1)
            {
                string dialogCaption = string.Format("Удаляем людей.");
                if (MessageBox.Show("Вы уверены?", dialogCaption, MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    Debts debts = listBoxTrips.SelectedItem as Debts;

                    List <Debt> removingDebts = new List <Debt>();
                    foreach (Debt debt in listBoxPeople.SelectedItems)
                    {
                        removingDebts.Add(debt);
                    }

                    foreach (Debt debt in removingDebts)
                    {
                        debts.RemoveDebtAndPersonFromListAndTrip(debt);
                        debt.PersonOnPanelMain.Clear();
                    }

                    textBoxPersonInfo.Text = "";
                    debts.ReloadDebtsPanel();
                    ShowSelectedProductInfo();
                }
            }
        }
예제 #7
0
        private void listBoxPeople_MouseUp(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                listBoxPeople.ClearSelected();

                int index = this.listBoxPeople.IndexFromPoint(e.Location);
                if (index != ListBox.NoMatches)
                {
                    Debts debts = listBoxTrips.SelectedItem as Debts;

                    listBoxPeople.SelectedIndex = index;
                    Debt debt = listBoxPeople.Items[index] as Debt;

                    PersonForm personForm = new PersonForm(debts, debt, listBoxPeople, this, index);
                }
            }
        }
예제 #8
0
파일: Debts.cs 프로젝트: 9045857/Pohod
 public void RemoveDebtAndPersonFromListAndTrip(Debt debt)
 {
     TripDebts.Remove(debt);
     trip.RemovePerson(debt.Person);
     listBoxWithDebts.Items.Remove(debt);
 }
예제 #9
0
파일: Debts.cs 프로젝트: 9045857/Pohod
 public void AddDebt(Debt debt)
 {
     TripDebts.Add(debt);
 }