Example #1
0
        private void ListCustomers()
        {
            List <CustomerModel> customers = CustomerHepler
                                             .MapCustomerEntity(CustomerHepler.GetCustomers(textBox1.Text));

            if (customers.Count > 0)
            {
                dataGridView1.Rows.Clear();

                dataGridView1.ColumnCount     = 5;
                dataGridView1.Columns[0].Name = "ID";
                dataGridView1.Columns[1].Name = "Ad";
                dataGridView1.Columns[2].Name = "Soyad";
                dataGridView1.Columns[3].Name = "Telefon";
                dataGridView1.Columns[4].Name = "Adres";


                for (int i = 0; i < customers.Count; i++)
                {
                    i = dataGridView1.Rows.Add();
                    dataGridView1.Rows[i].Cells[0].Value = customers[i].customerID;
                    dataGridView1.Rows[i].Cells[1].Value = customers[i].firstName;
                    dataGridView1.Rows[i].Cells[2].Value = customers[i].lastName;
                    dataGridView1.Rows[i].Cells[3].Value = customers[i].phoneNumber;
                    dataGridView1.Rows[i].Cells[4].Value = customers[i].adress;
                }
            }
        }
Example #2
0
        private void Button7_Click(object sender, EventArgs e)
        {
            string id = dataGridView1.CurrentRow.Cells[0].Value.ToString();

            bool success = CustomerHepler.DeleteCustomer(Convert.ToInt32(id));

            if (success)
            {
                ListCustomers();
            }
        }
Example #3
0
        private void Button1_Click(object sender, EventArgs e)
        {
            Customers newCustomer = new Customers
            {
                firstName   = textBox1.Text,
                lastName    = textBox2.Text,
                phoneNumber = maskedTextBox1.Text,
                address     = textBox4.Text
            };
            bool success = CustomerHepler.AddCustomer(newCustomer);

            if (success)
            {
                MessageBox.Show("Kayıt Başarılı");
                this.Close();
            }
            else
            {
                MessageBox.Show("Kayıt Başarısız!!!");
            }
        }
Example #4
0
        private void Button1_Click(object sender, EventArgs e)
        {
            Customers updatedCustomer = new Customers
            {
                customerID  = customer.customerID,
                firstName   = textBox1.Text,
                lastName    = textBox2.Text,
                phoneNumber = maskedTextBox1.Text,
                address     = textBox4.Text
            };

            bool updated = CustomerHepler.UpdateCustomer(Convert.ToInt32(customer.customerID), updatedCustomer);

            if (updated)
            {
                MessageBox.Show("Kayıt Guncellendi");
                this.Close();
            }
            else
            {
                MessageBox.Show("Kayıt Guncellenemedi!!!");
            }
        }