формы сервиса и частично формы иастера и специализации подкорректировала и доделала

This commit is contained in:
Елена Бакальская 2024-05-08 12:37:48 +04:00
parent 15d644a6bc
commit 2026569f00
6 changed files with 12 additions and 27 deletions

View File

@ -15,7 +15,8 @@ namespace BeautySalon
private readonly AbstractWorkWithStorage<Specialisation> specialisationStorage;
private readonly List<Specialisation> specialisations;
public FormMaster(AbstractWorkWithStorage<Master> masterStorage, AbstractWorkWithStorage<Specialisation> specialisationStorage)
public FormMaster(AbstractWorkWithStorage<Master> masterStorage,
AbstractWorkWithStorage<Specialisation> specialisationStorage)
{
this.masterStorage = masterStorage;
this.specialisationStorage = specialisationStorage;

View File

@ -95,6 +95,7 @@
// numericUpDownPrice
//
numericUpDownPrice.Location = new Point(177, 140);
numericUpDownPrice.Maximum = new decimal(new int[] { 100000, 0, 0, 0 });
numericUpDownPrice.Name = "numericUpDownPrice";
numericUpDownPrice.Size = new Size(290, 27);
numericUpDownPrice.TabIndex = 12;

View File

@ -77,7 +77,6 @@ namespace BeautySalon
var serviceObject = serviceStorage.GetObject(_id.Value);
if (serviceObject != null)
{
comboBoxSpecialisation.SelectedItem = serviceObject;
textBoxName.Text = serviceObject.ServiceName;
numericUpDownPrice.Value = (decimal)serviceObject.Price;
}

View File

@ -37,6 +37,7 @@
//
// dataGridView
//
dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.Fill;
dataGridView.BackgroundColor = SystemColors.ActiveCaption;
dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize;
dataGridView.Dock = DockStyle.Left;

View File

@ -1,14 +1,5 @@
using BeautySalonDBModels.Models;
using BeautySalonDBModels;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using BeautySalonDBModels.Implements;
namespace BeautySalon
@ -40,6 +31,7 @@ namespace BeautySalon
if (dataGridView.ColumnCount == 0)
{
dataGridView.Columns.Add("ServiceId", "ID");
dataGridView.Columns.Add("ServiceName", "Название");
dataGridView.Columns.Add("Specialisation", "Специализация");
dataGridView.Columns.Add("Price", "Цена");
@ -48,8 +40,9 @@ namespace BeautySalon
foreach (Service service in services)
{
string specialisationName = mdb.GetNameSpecialisation(service);
dataGridView.Rows.Add(service.ServiceName, specialisationName, service.Price);
dataGridView.Rows.Add(service.ServiceId, service.ServiceName, specialisationName, service.Price);
}
dataGridView.Columns["ServiceId"].Visible = false;
}
private void buttonCreate_Click(object sender, EventArgs e)
@ -69,10 +62,10 @@ namespace BeautySalon
var service = Program.ServiceProvider?.GetService(typeof(FormService));
if (service is FormService form)
{
int rowIndex = dataGridView.CurrentCell.RowIndex;
form.Id = (int)dataGridView.Rows[rowIndex].Cells["ServiceId"].Value;
if (form.ShowDialog() == DialogResult.OK)
{
int rowIndex = dataGridView.CurrentCell.RowIndex;
form.Id = (int)dataGridView.Rows[rowIndex].Cells["ServiceId"].Value;
LoadData();
}
}
@ -80,10 +73,10 @@ namespace BeautySalon
private void buttonDelete_Click(object sender, EventArgs e)
{
if(dataGridView.SelectedRows.Count == 1)
if (dataGridView.SelectedRows.Count == 1)
{
int rowIndex = dataGridView.CurrentCell.RowIndex;
serviceStorage.Remove(rowIndex);
int id = Convert.ToInt32(dataGridView.SelectedRows[0].Cells["ServiceId"].Value);
serviceStorage.Remove(id);
LoadData();
}
}

View File

@ -1,15 +1,5 @@
using BeautySalonDBModels;
using BeautySalonDBModels.Implements;
using BeautySalonDBModels.Models;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BeautySalon
{