Exemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            Rieltor addRieltor = new Rieltor();

            if (textBox2.Text.Length > 1 && textBox3.Text.Length > 1 && textBox4.Text.Length > 1)
            {
                addRieltor.lastName   = textBox2.Text;
                addRieltor.firstName  = textBox3.Text;
                addRieltor.middleName = textBox4.Text;
                addRieltor.comission  = int.Parse(numericUpDown1.Value.ToString());
                try
                {
                    rieltorComponent.PostClient(addRieltor);
                    MessageBox.Show("Риэлтор добавлен!");
                    parent.UpdateDataGrid();
                }
                catch (Exception ex)
                {
                }
            }
            else
            {
                MessageBox.Show("ФИО должны быть указаны");
                return;
            }
        }
Exemplo n.º 2
0
        private void button1_Click(object sender, EventArgs e)
        {
            Rieltor updRieltor = new Rieltor();

            if (textBox1.Text.Length > 1 && textBox2.Text.Length > 1 && textBox3.Text.Length > 1)
            {
                updRieltor.lastName   = textBox1.Text;
                updRieltor.firstName  = textBox2.Text;
                updRieltor.middleName = textBox3.Text;
                updRieltor.comission  = int.Parse(numericUpDown1.Value.ToString());
                updRieltor.id         = indx;
                try
                {
                    rieltorComponent.Update(updRieltor);
                    parent.UpdateDataGrid();
                    MessageBox.Show("Клиент обновлен успешно");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
            }
            else
            {
                MessageBox.Show("ФИО должны быть заполнены");
                return;
            }
        }
Exemplo n.º 3
0
 private void menuStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
 {
     if (e.ClickedItem == toolStripMenuItem1)
     {
         new AddRieltor(this).Show();
     }
     else if (e.ClickedItem == toolStripMenuItem3)
     {
         try
         {
             client.Delete(index);
             MessageBox.Show("Клиент " + index + " успешно удален");
             UpdateDataGrid();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
     else if (e.ClickedItem == toolStripMenuItem2)
     {
         try
         {
             Rieltor updClient = client.GetById(index);
             new UpdateRieltor(updClient, this).Show();//updClient, this
             UpdateDataGrid();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }
Exemplo n.º 4
0
 public UpdateRieltor(Rieltor rieltor, RieltorsForm parent)
 {
     InitializeComponent();
     rieltorComponent     = new RieltorsComponent();
     this.parent          = parent;
     updateRieltor        = rieltor;
     textBox1.Text        = rieltor.lastName;
     textBox2.Text        = rieltor.firstName;
     textBox3.Text        = rieltor.middleName;
     numericUpDown1.Value = rieltor.comission;
     indx = rieltor.id;
 }
Exemplo n.º 5
0
        public Rieltor PostClient(Rieltor rieltor)
        {
            string data = JsonConvert.SerializeObject(rieltor).ToString();

            return(rieltorRequest.GetResponse("http://localhost:3000/rieltor", "POST", data));
        }
Exemplo n.º 6
0
        public Rieltor Update(Rieltor rieltor)
        {
            string data = JsonConvert.SerializeObject(rieltor).ToString();

            return(rieltorRequest.GetResponse($"http://localhost:3000/rieltor/", "PUT", data));
        }