コード例 #1
0
        private void Button_SendInfo_Click(object sender, RoutedEventArgs e)
        {
            if (LocalConnector.Connect())
            {
                new MySqlCommand(
                    "UPDATE `sp_13` SET `first_name` = '" + FirstName.Text +
                    "' , `last_name` = '" + LastName.Text +
                    "' , `password` = '" + Password.Text +
                    "' , `mobile_number` = '" + Mobile_Number.Text +
                    "' , `email` = '" + Email.Text +
                    "' WHERE `login` = '" + Login.Text + "'",
                    LocalConnector.SP13Connection).ExecuteNonQuery();

                LocalConnector.Disconnect();
            }
            UpdatedMember = new Member(new Person(
                                           Login.Text,
                                           FirstName.Text,
                                           LastName.Text,
                                           Password.Text,
                                           MyMember.Person.Personal_Info,
                                           Mobile_Number.Text,
                                           Email.Text,
                                           MyMember.Person.Message
                                           ));
            UpdatedMember.SaveToFile(@"bin/storage.bin");
        }
コード例 #2
0
        public static void PostNews(NewsNode x)
        {
            if (LocalConnector.Connect())
            {
                new MySqlCommand("INSERT INTO `datainfo` (`name`, `content`, `date`, `author`, `imgsrc`, `tag`) VALUES ('" + x.Name + "', '" + x.NewsContent + "', CURRENT_TIMESTAMP, '" + x.Author + "','" + x.ImgSource + "', 'Tag')", LocalConnector.SP13Connection).ExecuteNonQuery();

                LocalConnector.Disconnect();
            }
        }
コード例 #3
0
ファイル: Member.cs プロジェクト: maximtis/DataBaseTest-1.0.2
 public void SendMessage(string Message)
 {
     if (LocalConnector.Connect())
     {
         var Send = new MySqlCommand("UPDATE `sp_13` SET `message` = '" + Message + "' WHERE `sp_13`.`login` = \"" + Person.Login + "\"",
                                     LocalConnector.SP13Connection).ExecuteNonQuery();
         LocalConnector.Disconnect();
     }
 }
コード例 #4
0
 private void Button_UpdateInfo_Click(object sender, RoutedEventArgs e)
 {
     if (LocalConnector.Connect())
     {
         MySqlDataReader Reader = new MySqlCommand("SELECT `personal_info` FROM sp_13 WHERE `login` = \"" + MyMember.Person.Login + "\"", LocalConnector.SP13Connection).ExecuteReader();
         if (Reader.Read())
         {
             TextBlock_Informator.Text = Reader["personal_info"].ToString();
         }
         LocalConnector.Disconnect();
     }
 }
コード例 #5
0
        private void Button_Update_PersonalInfo_Click(object sender, RoutedEventArgs e)
        {
            if (LocalConnector.Connect())
            {
                new MySqlCommand(
                    "UPDATE `sp_13` SET `personal_info` = '" + TextBlock_Informator.Text +
                    "' WHERE `login` = '" + MyMember.Person.Login + "'",
                    LocalConnector.SP13Connection).ExecuteNonQuery();

                LocalConnector.Disconnect();
                MessageBox.Show("Отправлено!");
            }
        }
コード例 #6
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     if (LocalConnector.Connect())
     {
         new MySqlCommand(
             "UPDATE `sp_13` SET `report_message` = '" + TextBox_ReportMessage.Text +
             "' WHERE `login` = '" + MyMember.Person.Login + "'",
             LocalConnector.SP13Connection).ExecuteNonQuery();
         LocalConnector.Disconnect();
     }
     else
     {
         MessageBox.Show("Ошибка подключения");
     }
     Close();
 }
コード例 #7
0
 public void UpdateInfo()
 {
     if (LocalConnector.Connect())
     {
         NewsFeed.Clear();
         MySqlDataReader Reader = new MySqlCommand("SELECT * FROM datainfo", LocalConnector.SP13Connection).ExecuteReader();
         while (Reader.Read())
         {
             NewsFeed.Add(
                 new NewsNode(Reader["name"].ToString(),
                              Reader["content"].ToString(),
                              Reader["author"].ToString(),
                              Reader["date"].ToString(),
                              Reader["imgsrc"].ToString())
                 );
         }
         LocalConnector.Disconnect();
     }
 }
コード例 #8
0
 public void InitializeFromBase()
 {
     if (LocalConnector.Connect())
     {
         MySqlDataReader Reader = new MySqlCommand("SELECT * FROM sp_13", LocalConnector.SP13Connection).ExecuteReader();
         while (Reader.Read())
         {
             MyGroupMembers.Add(new Member(new Person(
                                               Reader["login"].ToString(),
                                               Reader["first_name"].ToString(),
                                               Reader["last_name"].ToString(),
                                               Reader["password"].ToString(),
                                               Reader["personal_info"].ToString(),
                                               Reader["mobile_number"].ToString(),
                                               Reader["email"].ToString(),
                                               Reader["message"].ToString()
                                               )));
         }
         LocalConnector.Disconnect();
     }
 }
コード例 #9
0
ファイル: Member.cs プロジェクト: maximtis/DataBaseTest-1.0.2
        public bool Autorization()
        {
            bool Result = false;

            if (LocalConnector.Connect())
            {
                MySqlDataReader Reader =
                    new MySqlCommand("SELECT `password` FROM `sp_13` WHERE `login` = \"" + Person.Login + "\"",
                                     LocalConnector.SP13Connection).ExecuteReader();
                if (Reader.Read())
                {
                    Result = Reader["password"].ToString() == Person.Password;
                }
                LocalConnector.Disconnect();
            }
            if (Result)
            {
                Authorized = true;
                return(true);
            }
            return(false);
        }
コード例 #10
0
ファイル: Member.cs プロジェクト: maximtis/DataBaseTest-1.0.2
 public void LoadFromBase()
 {
     if (Person.Login != string.Empty && Person.Password != string.Empty)
     {
         if (LocalConnector.Connect())
         {
             MySqlDataReader Reader =
                 new MySqlCommand("SELECT * FROM `sp_13` WHERE `login` = \"" + Person.Login + "\"",
                                  LocalConnector.SP13Connection).ExecuteReader();
             if (Reader.Read())
             {
                 Person.FirstName     = Reader["first_name"].ToString();
                 Person.LastName      = Reader["last_name"].ToString();
                 Person.Personal_Info = Reader["personal_info"].ToString();
                 Person.Mobile_Number = Reader["Mobile_Number"].ToString();
                 Person.Email         = Reader["email"].ToString();
                 Person.Message       = Reader["message"].ToString();
             }
             Loaded = true;
         }
     }
     LocalConnector.Disconnect();
 }