Пример #1
0
        public CustomerDetailContract GetCustomerDetail(int Id)
        {
            SqlDataReader dr;

            dr = dbOperation.SpGetData("cus.sel_customerdetail", new SqlParameter[] {
                new SqlParameter("@Id", Id)
            });
            CustomerDetailContract customerDetail = new CustomerDetailContract();;

            while (dr.Read())
            {
                customerDetail.Id          = (int)dr[0];
                customerDetail.Name        = dr[1].ToString();
                customerDetail.SurName     = dr[2].ToString();
                customerDetail.TaxNumber   = dr[3].ToString();
                customerDetail.BirthPlace  = dr[4].ToString();
                customerDetail.BirthDate   = (DateTime)dr[5];
                customerDetail.MomName     = dr[6].ToString();
                customerDetail.FatherName  = dr[7].ToString();
                customerDetail.EducationId = (int)dr[8];
                customerDetail.JobId       = (int)dr[9];
            }

            return(customerDetail);
        }
Пример #2
0
        private void btnCustomerDelete_Click(object sender, RoutedEventArgs e)
        {
            if (customer != null && txtCustomerAddNo.Text != "")
            {
                //var olan kaydı silme
                customerDetail.Id          = Convert.ToInt32(txtCustomerAddNo.Text);
                customerDetail.Name        = txtCustomerAddName.Text;
                customerDetail.SurName     = txtCustomerAddSurName.Text;
                customerDetail.TaxNumber   = txtCustomerAddTaxNumber.Text;
                customerDetail.BirthPlace  = txtCustomerAddBirthPlace.Text;
                customerDetail.BirthDate   = dpBirthDate.SelectedDate.Value;
                customerDetail.MomName     = txtCustomerAddMomName.Text;
                customerDetail.FatherName  = txtCustomerAddFatherName.Text;
                customerDetail.EducationId = cbCustomerAddEducation.SelectedIndex + 1;
                customerDetail.JobId       = cbCustomerAddJob.SelectedIndex + 1;

                customerDetail = DeleteCustomerDetail(customerDetail);
                MessageBox.Show("Id:" + customerDetail.Id + " kullanıcı başarıyla silindi.", "Message", MessageBoxButton.OK, MessageBoxImage.Information);
                this.Close();
            }
            else
            {
                MessageBox.Show("Kayıt silinemedi");
            }
        }
Пример #3
0
        public CustomerDetailContract AddCustomerDetail(CustomerDetailContract customerDetail)
        {
            SqlDataReader dr;

            dr = dbOperation.SpGetData("cus.ins_customerdetail", new SqlParameter[] {
                new SqlParameter("@Name", customerDetail.Name),
                new SqlParameter("@Surname", customerDetail.SurName),
                new SqlParameter("@TaxNumber", customerDetail.TaxNumber),
                new SqlParameter("@BirthPlace", customerDetail.BirthPlace),
                new SqlParameter("@BirthDate", customerDetail.BirthDate.Date),
                new SqlParameter("@MomName", customerDetail.MomName),
                new SqlParameter("@FatherName", customerDetail.FatherName),
                new SqlParameter("@EducationId", customerDetail.EducationId),
                new SqlParameter("@JobId", customerDetail.JobId)
            });


            CustomerDetailContract customerDetailResponse = new CustomerDetailContract();;

            while (dr.Read())
            {
                customerDetailResponse.Id          = (int)dr[0];
                customerDetailResponse.Name        = dr[1].ToString();
                customerDetailResponse.SurName     = dr[2].ToString();
                customerDetailResponse.TaxNumber   = dr[3].ToString();
                customerDetailResponse.BirthPlace  = dr[4].ToString();
                customerDetailResponse.BirthDate   = (DateTime)dr[5];
                customerDetailResponse.MomName     = dr[6].ToString();
                customerDetailResponse.FatherName  = dr[7].ToString();
                customerDetailResponse.EducationId = (int)dr[8];
                customerDetailResponse.JobId       = (int)dr[9];
            }

            return(customerDetailResponse);
        }
Пример #4
0
        //Customer CRUD
        public bool GetCustomerDetail(CustomerDetailContract customerDetail)
        {
            var connect = new Connector.Banking.GenericConnect <CustomerDetailResponse>();
            var request = new Types.Banking.CustomerDetailRequest();

            request.customerDetail = customerDetail;
            request.MethodName     = "GetCustomerDetail";

            var response = connect.Execute(request);

            if (response.IsSuccess == true)
            {
                gbContact.IsEnabled = true;
                customerDetail      = response.customerDetail;
                cbCustomerAddEducation.SelectedIndex = (int)response.customerDetail.EducationId - 1;
                cbCustomerAddJob.SelectedIndex       = (int)response.customerDetail.JobId - 1;
                txtCustomerAddNo.Text         = customerDetail.Id.ToString();
                txtCustomerAddName.Text       = customerDetail.Name;
                txtCustomerAddSurName.Text    = customerDetail.SurName;
                txtCustomerAddTaxNumber.Text  = customerDetail.TaxNumber;
                txtCustomerAddBirthPlace.Text = customerDetail.BirthPlace;
                dpBirthDate.SelectedDate      = customerDetail.BirthDate;
                txtCustomerAddMomName.Text    = customerDetail.MomName;
                txtCustomerAddFatherName.Text = customerDetail.FatherName;


                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #5
0
 private void btnCloseCustomerAdd_Click(object sender, RoutedEventArgs e)
 {
     customerDetail    = null;
     customerAddresses = null;
     customerMails     = null;
     customerPhones    = null;
     if (CustomCloseTab != null)
     {
         CustomCloseTab(this, new RoutedEventArgs());
     }
     this.Close();
 }
Пример #6
0
        public CustomerDetailContract DeleteCustomerDetail(CustomerDetailContract customerDetail)
        {
            SqlDataReader dr;

            dr = dbOperation.SpGetData("cus.del_customerdetail", new SqlParameter[] {
                new SqlParameter("@Id", customerDetail.Id)
            });

            CustomerDetailContract customerDetailResponse = new CustomerDetailContract();

            while (dr.Read())
            {
                customerDetailResponse.Id = (int)dr[0];
            }

            return(customerDetailResponse);
        }
Пример #7
0
        private CustomerDetailContract DeleteCustomerDetail(CustomerDetailContract customerDetail)
        {
            var connect = new Connector.Banking.GenericConnect <CustomerDetailResponse>();
            var request = new Types.Banking.CustomerDetailRequest();

            request.customerDetail = customerDetail;
            request.MethodName     = "DeleteCustomerDetail";

            var response = connect.Execute(request);

            if (response.IsSuccess == true)
            {
                return(response.customerDetail);
            }
            else
            {
                return(null);
            }
        }
Пример #8
0
        public CustomerAdd(CustomerContract customer)
        {
            InitializeComponent();
            if (customer == null)
            {
                comboboxEducations();
                comboboxJobs();
                gbContact.IsEnabled = false;
            }
            else
            {
                gbContact.IsEnabled = true;
                customerDetail      = new CustomerDetailContract();
                customerMails       = new List <CustomerMailContract>();
                customerPhones      = new List <CustomerPhoneContract>();
                this.customer       = new CustomerContract();
                this.customer       = customer;
                comboboxEducations();
                comboboxJobs();
                customerDetail.Id = (int)customer.Id;
                GetCustomerDetail(customerDetail);

                GetCustomerAddress(new CustomerAddressContract()
                {
                    Id = customerDetail.Id
                });

                GetCustomerMail(new CustomerMailContract()
                {
                    CustomerId = customerDetail.Id
                });

                GetCustomerPhone(new CustomerPhoneContract()
                {
                    CustomerId = customerDetail.Id
                });
            }
        }
Пример #9
0
        //CustomerAdd Butonlar
        private void btnCustomerAdd_Click(object sender, RoutedEventArgs e)
        {
            if (customer == null && txtCustomerAddNo.Text != "")
            {
                //kayıt güncelleme
                if (txtCustomerAddTaxNumber.Text == "")
                {
                    MessageBox.Show("TC numarası boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddTaxNumber.Focus();
                    return;
                }
                else if (!isValidNumber(txtCustomerAddTaxNumber.Text))
                {
                    MessageBox.Show("TC numarası sadece rakamlardan oluşabilir", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddTaxNumber.Focus();
                    return;
                }

                if (txtCustomerAddName.Text == "")
                {
                    MessageBox.Show("Ad alanı boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddName.Focus();
                    return;
                }
                else if (!isValidText(txtCustomerAddName.Text))
                {
                    MessageBox.Show("Ad yanlış karakterler içeriyor", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddName.Focus();
                    return;
                }

                if (txtCustomerAddSurName.Text == "")
                {
                    MessageBox.Show("Soyad alanı boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddSurName.Focus();
                    return;
                }
                else if (!isValidText(txtCustomerAddSurName.Text))
                {
                    MessageBox.Show("Soyad yanlış karakterler içeriyor", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddSurName.Focus();
                    return;
                }

                if (txtCustomerAddMomName.Text == "")
                {
                    MessageBox.Show("Anne adı boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddMomName.Focus();
                    return;
                }
                else if (!isValidText(txtCustomerAddMomName.Text))
                {
                    MessageBox.Show("Anne adı yanlış karakterler içeriyor", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddMomName.Focus();
                    return;
                }

                if (txtCustomerAddFatherName.Text == "")
                {
                    MessageBox.Show("Baba adı boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddFatherName.Focus();
                    return;
                }
                else if (!isValidText(txtCustomerAddFatherName.Text))
                {
                    MessageBox.Show("Baba adı yanlış karakterler içeriyor", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddFatherName.Focus();
                    return;
                }


                if (txtCustomerAddBirthPlace.Text == "")
                {
                    MessageBox.Show("Doğum yeri boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddBirthPlace.Focus();
                    return;
                }
                else if (!isValidText(txtCustomerAddBirthPlace.Text))
                {
                    MessageBox.Show("Doğum yeri yanlış karakterler içeriyor", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddBirthPlace.Focus();
                    return;
                }

                if (dpBirthDate.SelectedDate == null)
                {
                    MessageBox.Show("Doğum tarihi bilgisi boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddFatherName.Focus();
                    return;
                }

                if (cbCustomerAddEducation.SelectedIndex == -1)
                {
                    MessageBox.Show("Eğitim bilgisi boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    cbCustomerAddEducation.Focus();
                    return;
                }

                if (cbCustomerAddJob.SelectedIndex == -1)
                {
                    MessageBox.Show("İş bilgisi boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    cbCustomerAddJob.Focus();
                    return;
                }

                customerDetail.Id          = Convert.ToInt32(txtCustomerAddNo.Text);
                customerDetail.Name        = txtCustomerAddName.Text;
                customerDetail.SurName     = txtCustomerAddSurName.Text;
                customerDetail.TaxNumber   = txtCustomerAddTaxNumber.Text;
                customerDetail.BirthPlace  = txtCustomerAddBirthPlace.Text;
                customerDetail.BirthDate   = dpBirthDate.SelectedDate.Value;
                customerDetail.MomName     = txtCustomerAddMomName.Text;
                customerDetail.FatherName  = txtCustomerAddFatherName.Text;
                customerDetail.EducationId = cbCustomerAddEducation.SelectedIndex + 1;
                customerDetail.JobId       = cbCustomerAddJob.SelectedIndex + 1;

                customerDetail = UpdateCustomerDetail(customerDetail);
                MessageBox.Show("Id:" + customerDetail.Id + " kullanıcı güncellendi.", "Message", MessageBoxButton.OK, MessageBoxImage.Information);
            }
            else
            {
                //yeni kayıt
                if (txtCustomerAddTaxNumber.Text == "")
                {
                    MessageBox.Show("TC numarası boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddTaxNumber.Focus();
                    return;
                }
                else if (!isValidNumber(txtCustomerAddTaxNumber.Text))
                {
                    MessageBox.Show("TC numarası sadece rakamlardan oluşabilir", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddTaxNumber.Focus();
                    return;
                }

                if (txtCustomerAddName.Text == "")
                {
                    MessageBox.Show("Ad alanı boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddName.Focus();
                    return;
                }
                else if (!isValidText(txtCustomerAddName.Text))
                {
                    MessageBox.Show("Ad yanlış karakterler içeriyor", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddName.Focus();
                    return;
                }

                if (txtCustomerAddSurName.Text == "")
                {
                    MessageBox.Show("Soyad alanı boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddSurName.Focus();
                    return;
                }
                else if (!isValidText(txtCustomerAddSurName.Text))
                {
                    MessageBox.Show("Soyad yanlış karakterler içeriyor", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddSurName.Focus();
                    return;
                }

                if (txtCustomerAddMomName.Text == "")
                {
                    MessageBox.Show("Anne adı boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddMomName.Focus();
                    return;
                }
                else if (!isValidText(txtCustomerAddMomName.Text))
                {
                    MessageBox.Show("Anne adı yanlış karakterler içeriyor", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddMomName.Focus();
                    return;
                }

                if (txtCustomerAddFatherName.Text == "")
                {
                    MessageBox.Show("Baba adı boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddFatherName.Focus();
                    return;
                }
                else if (!isValidText(txtCustomerAddFatherName.Text))
                {
                    MessageBox.Show("Baba adı yanlış karakterler içeriyor", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddFatherName.Focus();
                    return;
                }


                if (txtCustomerAddBirthPlace.Text == "")
                {
                    MessageBox.Show("Doğum yeri boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddBirthPlace.Focus();
                    return;
                }
                else if (!isValidText(txtCustomerAddBirthPlace.Text))
                {
                    MessageBox.Show("Doğum yeri yanlış karakterler içeriyor", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddBirthPlace.Focus();
                    return;
                }

                if (dpBirthDate.SelectedDate == null)
                {
                    MessageBox.Show("Doğum tarihi bilgisi boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    txtCustomerAddFatherName.Focus();
                    return;
                }

                if (cbCustomerAddEducation.SelectedIndex == -1)
                {
                    MessageBox.Show("Eğitim bilgisi boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    cbCustomerAddEducation.Focus();
                    return;
                }

                if (cbCustomerAddJob.SelectedIndex == -1)
                {
                    MessageBox.Show("İş bilgisi boş geçilemez", "Message", MessageBoxButton.OK, MessageBoxImage.Error);
                    cbCustomerAddJob.Focus();
                    return;
                }


                customerDetail             = new CustomerDetailContract();
                customerDetail.Name        = txtCustomerAddName.Text;
                customerDetail.SurName     = txtCustomerAddSurName.Text;
                customerDetail.TaxNumber   = txtCustomerAddTaxNumber.Text;
                customerDetail.BirthPlace  = txtCustomerAddBirthPlace.Text;
                customerDetail.BirthDate   = dpBirthDate.SelectedDate.Value;
                customerDetail.MomName     = txtCustomerAddMomName.Text;
                customerDetail.FatherName  = txtCustomerAddFatherName.Text;
                customerDetail.EducationId = cbCustomerAddEducation.SelectedIndex + 1;
                customerDetail.JobId       = cbCustomerAddJob.SelectedIndex + 1;

                customerDetail = AddCustomerDetail(customerDetail);
                MessageBox.Show("Yeni Eklenen Müşteri ID = " + customerDetail.Id, "Message", MessageBoxButton.OK, MessageBoxImage.Information);
                GetCustomerDetail(customerDetail);
            }
        }