예제 #1
0
파일: MainForm.cs 프로젝트: ArtYomDa/MP
 private void initUserParam()
 {
     if (UsersAvatar.UserImage != null)
     {
         pictureBox2.Image = UsersAvatar.UserImage;
     }
     countLab.Text = OrdersForHistory.getUserOrders().Count.ToString();
 }
예제 #2
0
파일: OrderHisrory.cs 프로젝트: ArtYomDa/MP
 private void OrderHisrory_Load(object sender, EventArgs e)
 {
     if (UsersAvatar.UserImage != null)
     {
         pictureBox1.Image = UsersAvatar.UserImage;
     }
     dataGridView1.Rows.Clear();
     orders = OrdersForHistory.getUserOrders();
     initDataUser();
     foreach (OrdersForHistory order in orders)
     {
         string[] data = { order.products, order.date, order.price.ToString(), order.status };
         dataGridView1.Rows.Add(data);
     }
 }
예제 #3
0
파일: BasketForm.cs 프로젝트: ArtYomDa/MP
        private void button2_Click(object sender, EventArgs e)
        {
            string   arhiv   = "";
            DateTime dateNow = DateTime.Now;
            string   date    = dateNow.Year.ToString() + "-" + dateNow.Month.ToString() + "-" + dateNow.Day.ToString();

            foreach (var i in ClientsOrder.loadOrder)
            {
                arhiv += (i.idProd + "-" + i.countProd + ";");
            }
            MySqlCommand command = new MySqlCommand();
            string       connectionString, commandString;

            connectionString = "Data source=localhost;UserId=myuser;Password=123;database=products;";
            MySqlConnection connection = new MySqlConnection(connectionString);

            commandString = "INSERT INTO `products`.`orders` (`clientName`, `date`, `adress`, `arhiv`) VALUES ('" + Clients.user.Login
                            + "', '" + date + "', '" + Clients.user.Adress + "', '" + arhiv + "');";
            command.CommandText = commandString;
            command.Connection  = connection;
            MySqlDataReader reader;

            try
            {
                command.Connection.Open();
                reader = command.ExecuteReader();
                MainForm mainForm = this.Owner as MainForm;
                mainForm.countLab.Text = OrdersForHistory.getUserOrders().Count.ToString();
                reader.Close();
                string message =
                    "Ваш заказ был успешно отправлен. Спасибо, что пользуютесь нашими услугами.";
                string caption = "Заказ отправлен";
                var    result  = MessageBox.Show(message, caption,
                                                 MessageBoxButtons.OK,
                                                 MessageBoxIcon.Information);
            }
            catch (MySqlException ex)
            {
                Console.WriteLine("Error: \r\n{0}", ex.ToString());
            }
            finally
            {
                command.Connection.Close();
            }
            Close();
        }