Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult dialogResult = MessageBox.Show("Сохранить данные?", "Сохранение", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
            if (dialogResult == DialogResult.Yes)
            {
                string temp1, temp2, temp3, temp4, temp5;

                if (checkBox1.Checked == true)
                    temp1 = "Да";
                else
                    temp1 = "Нет";

                if (checkBox2.Checked == true)
                    temp2 = "Да";
                else
                    temp2 = "Нет";

                if (checkBox3.Checked == true)
                    temp3 = "Да";
                else
                    temp3 = "Нет";

                if (checkBox4.Checked == true)
                    temp4 = "Да";
                else
                    temp4 = "Нет";

                if (checkBox5.Checked == true)
                    temp5 = "Да";
                else
                    temp5 = "Нет";

                MyClass newMyClass = new MyClass();
                newMyClass.City = comboBox1.Text;
                newMyClass.Street = textBox2.Text;
                newMyClass.FIO = textBox1.Text;
                newMyClass.HouseNum = Convert.ToInt32(textBox3.Text);
                newMyClass.FlatNum = Convert.ToInt32(textBox4.Text);
                newMyClass.Square = Convert.ToDouble(textBox5.Text);
                newMyClass.PeopleInside = Convert.ToInt32(textBox6.Text);
                newMyClass.SWater = temp1;
                newMyClass.Elevator = temp2;
                newMyClass.Watchman = temp3;
                newMyClass.Phone = temp4;
                newMyClass.Gas = temp5;
                list.AddMyClass(newMyClass);
                list.SaveList("base.xml");
                Close();
            }
            else if (dialogResult == DialogResult.No)
            {

            }
        }
Ejemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == "" || textBox2.Text == "" || textBox3.Text == "" || textBox4.Text == "" ||
                textBox5.Text == "" || textBox6.Text == "")
            {
                DialogResult dialogResult = MessageBox.Show("Не все поля заполнены!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                DialogResult dialogResult1 = MessageBox.Show("Вы точно хотите изменить эти данные?", "Изменение данных", MessageBoxButtons.YesNo,MessageBoxIcon.Warning);
                if (dialogResult1 == DialogResult.Yes)
                {
                    MyClass newMyClass = new MyClass();
                    list.RemoveMyClass(temp1, temp2, temp3);
                    string t1,t2,t3,t4,t5;

            if (checkBox1.Checked == true)
                t1 = "Да";
            else
                t1 = "Нет";

            if (checkBox2.Checked == true)
                t2 = "Да";
            else
                t2 = "Нет";

            if (checkBox3.Checked == true)
                t3 = "Да";
            else
                t3 = "Нет";

            if (checkBox4.Checked == true)
                t4 = "Да";
            else
                t4 = "Нет";

            if (checkBox5.Checked == true)
                t5 = "Да";
            else
                t5 = "Нет";
                    newMyClass.City = comboBox1.Text;
                    newMyClass.Street = textBox2.Text;
                    newMyClass.FIO = textBox1.Text;
                    newMyClass.HouseNum = Convert.ToInt32(textBox3.Text);
                    newMyClass.FlatNum = Convert.ToInt32(textBox4.Text);
                    newMyClass.Square = Convert.ToDouble(textBox5.Text);
                    newMyClass.PeopleInside = Convert.ToInt32(textBox6.Text);
                    newMyClass.SWater = t1;
                    newMyClass.Elevator = t2;
                    newMyClass.Watchman = t3;
                    newMyClass.Phone = t4;
                    newMyClass.Gas = t5;

                    list.AddMyClass(newMyClass);
                    list.SaveList("base.xml");
                    Close();
                }
                else if (dialogResult1 == DialogResult.No)
                {

                }
            }
        }
Ejemplo n.º 3
0
        private void calculate_Load(object sender, EventArgs e)
        {
            //
            toolTip1.SetToolTip(textBox1, "ФИО владельца");
            toolTip1.SetToolTip(textBox2, "Улица");
            toolTip1.SetToolTip(textBox3, "Номер дома");
            toolTip1.SetToolTip(textBox4, "Номер квартиры");
            toolTip1.SetToolTip(textBox5, "Площадь квартиры");
            toolTip1.SetToolTip(textBox6, "Прописано человек");
            toolTip1.SetToolTip(textBox7, "Наличие счетчиков");
            toolTip1.SetToolTip(textBox8, "Наличие лифта");
            toolTip1.SetToolTip(textBox9, "Наличие вахтера");
            toolTip1.SetToolTip(textBox10, "Наличие телефона");
            toolTip1.SetToolTip(textBox11, "Газ");
            toolTip1.IsBalloon = true;
            //
            list.LoadList("base.xml");
            MyClass obj = new MyClass();
            obj = list.FindCLass(temp1, temp2, temp3);
            textBox1.Text = obj.FIO;
            textBox2.Text = obj.Street;
            textBox3.Text = Convert.ToString(obj.HouseNum);
            textBox4.Text = Convert.ToString(obj.FlatNum);
            textBox5.Text = Convert.ToString(obj.Square);
            textBox6.Text = Convert.ToString(obj.PeopleInside);
            textBox7.Text = obj.SWater;
            textBox8.Text = obj.Elevator;
            textBox9.Text = obj.Watchman;
            textBox10.Text = obj.Phone;
            textBox11.Text = obj.Gas;

            if (textBox7.Text == "Нет")
            {
                textBox13.Enabled = false;
                textBox14.Enabled = false;
            }
            else
            {
                textBox13.Enabled = true;
                textBox14.Enabled = true;
            }

            if (textBox11.Text == "Нет")
            {
                textBox22.Enabled = false;
            }
            else
            {
                textBox22.Enabled = true;
            }
            fillTable();
        }
Ejemplo n.º 4
0
        private void Form3_Load(object sender, EventArgs e)
        {
            list.LoadList("base.xml");
            MyClass obj = new MyClass();
            obj = list.FindCLass(temp1, temp2, temp3);
            textBox1.Text = obj.FIO;
            comboBox1.Text = obj.City;
            textBox2.Text = obj.Street;
            textBox3.Text = Convert.ToString(obj.HouseNum);
            textBox4.Text = Convert.ToString(obj.FlatNum);
            textBox5.Text = Convert.ToString(obj.Square);
            textBox6.Text = Convert.ToString(obj.PeopleInside);
            if (obj.SWater == "Да")
                checkBox1.Checked = true;
            else
                checkBox1.Checked = false;

            if (obj.Elevator == "Да")
                checkBox2.Checked = true;
            else
                checkBox2.Checked = false;

            if (obj.Watchman == "Да")
                checkBox3.Checked = true;
            else
                checkBox3.Checked = false;

            if (obj.Phone == "Да")
                checkBox4.Checked = true;
            else
                checkBox4.Checked = false;

            if (obj.Gas == "Да")
                checkBox5.Checked = true;
            else
                checkBox5.Checked = false;
        }
Ejemplo n.º 5
0
 public void AddMyClass(MyClass myclass)
 {
     MyClassList.Add(myclass);
 }