private void Form1_Load(object sender, EventArgs e) { bool flag=true; if (File.Exists(settingsFileName)) { StreamReader settingFile = new StreamReader(settingsFileName); string str = settingFile.ReadLine(); if (str == "") flag = false; else { dataBaseFileName = str; } settingFile.Close(); } else { flag = false; } if(!flag) { //Здесь добавить вызов окна настроек StreamWriter settingFile = new StreamWriter(settingsFileName); settingFile.WriteLine("dataBase.bdb"); settingFile.Close(); } dataManager = new DataManager(dataBaseFileName,pricelistFileName); dataGridView1.DataSource = dataManager.PrintOnTable(); }
public Redactor(OneString line, DataManager dataManager) { InitializeComponent(); number = line.number; tbNumber.Text = line.number.ToString(); this.dataManager = dataManager; groupBox1.Visible = false; dtpBirthDate.Value = line.client.birthDate; dtpBirthDate.Enabled = false; radioButton1.Checked = false; radioButton2.Checked = false; if (line.client.sex=='М') { radioButton1.Checked = true; } else { radioButton2.Checked = true; } radioButton1.Enabled = false; radioButton2.Enabled = false; tbFirstName.Text = line.client.firstName; tbFirstName.ReadOnly = true; tbSecondName.Text = line.client.secondName; tbSecondName.ReadOnly = true; tbPatronymic.Text = line.client.patronymic; tbPatronymic.ReadOnly = true; tbFirstPhone.Text = line.client.firstPhone; tbFirstPhone.ReadOnly = true; tbSecondPhone.Text = line.client.secondPhone; tbSecondPhone.ReadOnly = true; tbTotal.Text = line.GetSummPriceService().ToString(); tbTotal.ReadOnly = true; dataGridView1.Rows.Clear(); serviceList = line.serviceList; dataGridView1.DataSource = PrintOnTable(); //dataGridView1.Enabled = false; tbDiscountCardNumber.Text = line.client.discountCardNumber.ToString(); tbDiscountCardNumber.ReadOnly = true; cbDiscountCardValue.Items.Clear(); for (int i = 0; i <= 100; i++) { cbDiscountCardValue.Items.Add(i.ToString()); } cbDiscountCardValue.SelectedIndex = line.client.discountCardValue; cbDiscountCardValue.Enabled = false; buttonDeleteLine.Visible = true; buttonEditLine.Visible = true; buttonSaveLine.Visible = false; buttonAddLine.Visible = false; buttonCancel.Visible = false; buttonAddService.Enabled = false; }
public Filters(DataManager dataManager) { InitializeComponent(); this.dataManager=dataManager; ClearFilters(); }
public Redactor(int number, DataManager dataManager) { InitializeComponent(); this.number = number; tbNumber.Text = number.ToString(); this.dataManager = dataManager; dtpBirthDate.Value = DateTime.Now; dtpBirthDate.Enabled = true; radioButton1.Checked = false; radioButton1.Enabled = true; radioButton2.Checked = true; radioButton2.Enabled = true; tbFirstName.Text = ""; tbFirstName.ReadOnly = false; tbSecondName.Text = ""; tbSecondName.ReadOnly = false; tbPatronymic.Text = ""; tbPatronymic.ReadOnly = false; tbFirstPhone.Text = ""; tbFirstPhone.ReadOnly = false; tbSecondPhone.Text = ""; tbTotal.Text = ""; tbTotal.ReadOnly = true; dataGridView1.Rows.Clear(); serviceList = new List<Service>(); dataGridView1.DataSource = PrintOnTable(); dataGridView1.Enabled = true; tbDiscountCardNumber.Text = ""; tbDiscountCardNumber.ReadOnly = false; cbDiscountCardValue.Items.Clear(); for (int i = 0; i <= 100; i++) { cbDiscountCardValue.Items.Add(i.ToString()); } cbDiscountCardValue.SelectedIndex = 0; cbDiscountCardValue.Enabled = true; tbSecondPhone.ReadOnly = false; buttonDeleteLine.Visible = false; buttonEditLine.Visible = false; buttonSaveLine.Visible = false; buttonAddLine.Visible = true; buttonCancel.Visible = false; buttonAddService.Enabled = true; }