Пример #1
0
        public static void AddToHumanPointsTable(PointModel pointModel)
        {
            using (SQLiteConnection Connect = new SQLiteConnection($"Data Source={dbFileName}; Version=3;"))
            {
                Connect.Open();
                string commandText = $"INSERT INTO {humanPointsListTableName} ('coord_X', 'coord_Y', 'channel_number', 'side', 'point_name', 'human_model_id') " +
                                     $"VALUES({pointModel.coordX},{pointModel.coordY},{pointModel.channel},'{pointModel.side}','{pointModel.pointname}',{pointModel.id_human_model})";

                SQLiteCommand Command = new SQLiteCommand(commandText, Connect);
                Command.Parameters.AddWithValue("@coord_X", pointModel.coordX);
                Command.Parameters.AddWithValue("@coord_Y", pointModel.coordY);
                Command.Parameters.AddWithValue("@channel_number", pointModel.channel);
                Command.Parameters.AddWithValue("@side", pointModel.side);
                Command.Parameters.AddWithValue("@point_name", pointModel.pointname);
                Command.Parameters.AddWithValue("@human_model_id", pointModel.id_human_model);
                Command.ExecuteNonQuery();
                //Connect.Close();
            }
        }
Пример #2
0
        private void buttonOk_Click(object sender, EventArgs e)
        {
            PointModel pointModel = new PointModel(
                Convert.ToInt16(textBoxPointX.Text),
                Convert.ToInt16(textBoxPointY.Text),
                cbPointLink.SelectedIndex,
                0,
                0,
                comboBoxPointSide.Text,
                textBoxPointName.Text,
                0,
                _humanModelId,
                0);

            DataAccess.AddToHumanPointsTable(pointModel);

            _form.DrawPoint(x, y, _humanSide);

            this.Close();
        }