Exemplo n.º 1
0
        public phones[] getMultiPhone()
        {
            phones[] request_phone = new phones[getCountMultiPhone()];

            SQLiteConnection connection = openConnection();

            string        query   = "SELECT * FROM phone ORDER BY id_notebook;";
            SQLiteCommand Command = new SQLiteCommand(query, connection);

            SQLiteDataReader reader = Command.ExecuteReader();
            int i = 0;

            while (reader.Read())
            {
                request_phone[i].id          = Convert.ToInt32(reader["id"]);
                request_phone[i].id_notebook = Convert.ToInt32(reader["id_notebook"]);
                request_phone[i].phone       = reader["phone"].ToString();
                request_phone[i].note        = reader["note"].ToString();
                i++;
            }
            reader.Close();

            closeConnection(ref connection);

            return(request_phone);
        }
Exemplo n.º 2
0
        public phones[] getSinglePhone(int id)
        {
            // Получаем номера текущей записи


            phones[] request_phone = new phones[getCountPhone(id)];;

            request_phone[0].id          = 0;
            request_phone[0].id_notebook = id;
            request_phone[0].phone       = "";
            request_phone[0].note        = "";

            SQLiteConnection connection = openConnection();

            string        query   = "SELECT * FROM phone WHERE id_notebook =" + id + " limit 4;";
            SQLiteCommand Command = new SQLiteCommand(query, connection);

            SQLiteDataReader reader = Command.ExecuteReader();
            int i = 0;

            while (reader.Read())
            {
                request_phone[i].id    = Convert.ToInt32(reader["id"]);
                request_phone[i].phone = reader["phone"].ToString();
                request_phone[i].note  = reader["note"].ToString();
                i++;
            }
            reader.Close();

            closeConnection(ref connection);

            return(request_phone);
        }
Exemplo n.º 3
0
        private void edit_Click(object sender, EventArgs e)
        {
            notebooks request;

            request.id         = id;
            request.firstname  = firstname.Text;
            request.secondname = secondname.Text;
            request.lastname   = lastname.Text;
            request.sex        = sex;
            request.date       = date.Value;
            request.job        = job.Text;
            request.position   = position.Text;
            request.more       = more.Text;

            addresss addressRequest;

            addressRequest.id          = 0;
            addressRequest.id_notebook = id;
            addressRequest.address     = address.Text;
            addressRequest.city        = city.Text;
            addressRequest.state       = state.Text;
            addressRequest.country     = country.Text;
            addressRequest.postal      = postal.Text;

            phones[] phoneRequest = new phones[4];

            for (int i = 0; i < 4; i++)
            {
                Control[] temp = phone.Controls.Find("phone" + (i + 1), true);
                phoneRequest[i].id_notebook = id;
                phoneRequest[i].phone       = temp[0].Text;
                temp = phone.Controls.Find("note" + (i + 1), true);
                phoneRequest[i].note = temp[0].Text;
            }


            if (id > 0)
            {
                note.setSingleNote(request); // Изменить текущую запись
                note.setSingleNote(addressRequest);
                note.setSingleNote(phoneRequest);
            }
            else
            {
                note.addSingleNote(request); // Добавить новую запись
                addressRequest.id_notebook = note.getLastId();
                for (int i = 0; i < 4; i++)
                {
                    phoneRequest[i].id_notebook = addressRequest.id_notebook;
                }

                note.addSingleNote(addressRequest);
                note.setSingleNote(phoneRequest);
            }

            Form1.refresh = true;
            this.Close();
        }
Exemplo n.º 4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            int size = note.getCountNote();

            notebooks[] answer      = new notebooks[size];
            phones[]    phoneAnswer = new phones[note.getCountMultiPhone()];


            answer      = note.getMultiNote(size);
            phoneAnswer = note.getMultiPhone();

            createFormObject(size, answer, phoneAnswer);
        }
Exemplo n.º 5
0
        private void refreshForm()
        {
            if (refresh == true)
            {
                notes.Controls.Clear();
                int         size        = note.getCountNote();
                notebooks[] answer      = new notebooks[size];
                phones[]    phoneAnswer = new phones[note.getCountMultiPhone()];


                answer      = note.getMultiNote(size);
                phoneAnswer = note.getMultiPhone();

                createFormObject(size, answer, phoneAnswer);

                refresh = false;
            }
        }