public void ReturnNull_WithPaidLessThanPrice() { var price = 120D; var paid = 100D; var result = _changer.Change(price, paid); Assert.Null(result); }
private void HouseButton_Click(object sender, EventArgs e) { SimpleView HouseForm = new SimpleView(); Operations.cont.HouseSet.Load(); HouseForm.Text = "Дома"; HouseForm.CurrentEntity = EntityTypes.House; HouseForm.Source = Operations.cont.HouseSet.Local.ToBindingList(); Changer <OPHouse> changer = new Changer <OPHouse>(EntityTypes.House); changer.owner = this; HouseForm.Add += changer.Add; HouseForm.Change += (DataGridView dgv) => changer.Change(dgv, Program.FindTitle(dgv, "Идентификационный номер")); HouseForm.Remove += (DataGridView dgv) => { int index = dgv.SelectedRows[0].Index; int id = 0; bool ok = int.TryParse(dgv[Program.FindTitle(dgv, "Идентификационный номер"), index].Value.ToString(), out id); if (!ok) { return; } Operations.RemoveAddress(id, out string s); MessageBox.Show(s); }; HouseForm.SetButtonNames("Добавить дом", "Удалить дом", "Изменить дом"); HouseForm.CurrentUser = CurrentUser; HouseForm.Show(); }
private void StavkaButton_Click(object sender, EventArgs e) { SimpleView simpleView = new SimpleView(); Operations.cont.StavkaSet.Load(); simpleView.Text = "Ставки"; simpleView.CurrentEntity = EntityTypes.Stavka; simpleView.Source = Operations.cont.StavkaSet.Local.ToBindingList(); Changer <OPStavka> changer = new Changer <OPStavka>(EntityTypes.Stavka); changer.owner = this; simpleView.Add += changer.Add; simpleView.Change += (DataGridView dgv) => changer.Change(dgv, Program.FindTitle(dgv, "Идентификационный номер")); simpleView.Remove += (DataGridView dgv) => { int index = dgv.SelectedRows[0].Index; int id = 0; bool ok = int.TryParse(dgv[Program.FindTitle(dgv, "Идентификационный номер"), index].Value.ToString(), out id); if (!ok) { return; } Operations.RemoveStavka(id, out string s); MessageBox.Show(s); }; simpleView.SetButtonNames("Добавить ставку", "Удалить ставку", "Изменить ставку"); simpleView.CurrentUser = CurrentUser; simpleView.Show(); }
private void UsersButton_Click(object sender, EventArgs e) { SimpleView UserForm = new SimpleView(); Operations.cont.UserSet.Load(); UserForm.Text = "Пользователи"; UserForm.CurrentEntity = EntityTypes.User; UserForm.Source = Operations.cont.UserSet.Local.ToBindingList(); Changer <OPUser> changer = new Changer <OPUser>(EntityTypes.User); changer.owner = this; UserForm.Add += changer.Add; UserForm.Change += (DataGridView dgv) => changer.Change(dgv, Program.FindTitle(dgv, "Идентификационный номер")); UserForm.Remove += (DataGridView dgv) => { int index = dgv.SelectedRows[0].Index; int id = 0; bool ok = int.TryParse(dgv[Program.FindTitle(dgv, "Идентификационный номер"), index].Value.ToString(), out id); if (!ok) { return; } if (CurrentUser.Id == id) { MessageBox.Show("Невозможно удалить текущего пользователя"); return; } Operations.RemoveUser(id, out string s); MessageBox.Show(s); }; UserForm.SetButtonNames("Добавить пользователя", "Удалить пользователя", "Изменить пользователя"); UserForm.CurrentUser = CurrentUser; UserForm.Show(); }
private void CustomerButton_Click(object sender, EventArgs e) { SimpleView simpleView = new SimpleView(); simpleView.Text = "Заказчики"; Operations.cont.CustomerSet.Load(); simpleView.CurrentEntity = EntityTypes.Customer; simpleView.Source = Operations.cont.CustomerSet.Local.ToBindingList(); Changer <OPCustomer> changer = new Changer <OPCustomer>(EntityTypes.Customer); changer.owner = this; simpleView.Add += changer.Add; simpleView.Change += (DataGridView dgv) => changer.Change(dgv, Program.FindTitle(dgv, "Идентификационный номер")); simpleView.Remove += (DataGridView dgv) => { int index = dgv.SelectedRows[0].Index; int id = 0; bool ok = int.TryParse(dgv[Program.FindTitle(dgv, "Идентификационный номер"), index].Value.ToString(), out id); if (!ok) { return; } if (Operations.FindCustomer(id) is Company) { Operations.RemoveCompany(id, out string s); MessageBox.Show(s); } else { Operations.RemoveCustomer(id, out string s); MessageBox.Show(s); } }; simpleView.SetButtonNames("Добавить заказчика", "Удалить заказчика", "Изменить заказчика"); simpleView.CurrentUser = CurrentUser; simpleView.Show(); }