예제 #1
0
        public List <CustomerPhoneContract> UpdCustomerPhone(CustomerPhoneContract customerPhone)
        {
            SqlDataReader dr;

            dr = dbOperation.SpGetData("cus.upd_customerphone", new SqlParameter[] {
                new SqlParameter("@Id", customerPhone.Id),
                new SqlParameter("@Phone", customerPhone.Phone),
                new SqlParameter("@CustomerId", customerPhone.CustomerId)
            });

            List <CustomerPhoneContract> customerPhones = new List <CustomerPhoneContract>();
            CustomerPhoneContract        customerPhoneTemp;

            while (dr.Read())
            {
                customerPhoneTemp            = new CustomerPhoneContract();
                customerPhoneTemp.Id         = (int)dr[0];
                customerPhoneTemp.Phone      = dr[1].ToString();
                customerPhoneTemp.CustomerId = (int)dr[2];


                customerPhones.Add(customerPhoneTemp);
            }

            return(customerPhones);
        }
예제 #2
0
        private void btnDeletePhone_Click(object sender, RoutedEventArgs e)
        {
            if (dgCustomerPhone.SelectedItem == null)
            {
                MessageBox.Show("Lütfen Gridden silinecek Telefon adresini seçiniz."); return;
            }

            CustomerPhoneContract customerPhone = new CustomerPhoneContract();

            customerPhone = dgCustomerPhone.SelectedItem as CustomerPhoneContract;

            var connect = new Connector.Banking.GenericConnect <CustomerPhoneResponse>();
            var request = new Types.Banking.CustomerPhoneRequest();

            request.customerPhone = customerPhone;
            request.MethodName    = "DelCustomerPhone";

            var response = connect.Execute(request);

            if (response.IsSuccess == true)
            {
                MessageBox.Show("Telefon numarası silme işlemi başarı ile gerçekleştirildi.");
                this.Close();
                return;
            }
            else
            {
                MessageBox.Show("Telefon numarası silme işlemi başarısız oldu.");
                return;
            }
        }
예제 #3
0
        private void GetCustomerPhone(CustomerPhoneContract customerPhone)
        {
            customerPhones = new List <CustomerPhoneContract>();
            var connect = new Connector.Banking.GenericConnect <CustomerPhoneResponse>();
            var request = new Types.Banking.CustomerPhoneRequest();

            request.customerPhone = customerPhone;
            request.MethodName    = "GetCustomerPhone";

            var response = connect.Execute(request);

            if (response.IsSuccess == true)
            {
                foreach (var item in response.customerPhones)
                {
                    customerPhones.Add(item);
                }
                dgCustomerPhone.ItemsSource = response.customerPhones;
                dgCustomerPhone.Items.Refresh();
                return;
            }
            else
            {
                return;
            }
        }
예제 #4
0
        public GenericResponse <CustomerPhoneContract> PhoneAdd(CustomerPhoneContract phoneContract)
        {
            DbOperation dbOperation = new DbOperation();

            SqlParameter[] parameters = new SqlParameter[] {
                new SqlParameter("@CustomerId", phoneContract.CustomerId),
                new SqlParameter("@PhoneNumber", phoneContract.PhoneNumber),
                new SqlParameter("@PhoneType", phoneContract.PhoneType)
            };

            try
            {
                int id = Convert.ToInt32(dbOperation.SpExecute("CUS.ins_AddNewCustomerPhone", parameters));

                return(new GenericResponse <CustomerPhoneContract>()
                {
                    IsSuccess = true, Value = new CustomerPhoneContract()
                    {
                        CustomerPhoneId = id
                    }
                });
            }
            catch (Exception)
            {
                return(new GenericResponse <CustomerPhoneContract>()
                {
                    IsSuccess = false, ErrorMessage = "CustomerPhoneAdd isteği başarısız."
                });
            }
        }
예제 #5
0
        //-------------------------------------------------------------------


        //Phone CRUD butonları
        private void btnAddPhone_Click(object sender, RoutedEventArgs e)
        {
            CustomerPhoneContract customerPhone = new CustomerPhoneContract();

            customerPhone.CustomerId = customerDetail.Id;
            CustomerPhoneWindow.MainWindow addPhoneWindow = new CustomerPhoneWindow.MainWindow(customerPhone);
            addPhoneWindow.Show();
        }
예제 #6
0
        public MainWindow(CustomerPhoneContract customerPhone)
        {
            _customerPhone = customerPhone;
            InitializeComponent();

            if (_customerPhone.Id > 0)
            {
                txtPhoneId.Text      = _customerPhone.Id.ToString();
                txtPhoneAddress.Text = _customerPhone.Phone;
            }
        }
예제 #7
0
        private void btnUpdatePhone_Click(object sender, RoutedEventArgs e)
        {
            CustomerPhoneContract customerPhone = new CustomerPhoneContract();

            customerPhone.CustomerId = customerDetail.Id;
            if (dgCustomerPhone.SelectedItem == null)
            {
                MessageBox.Show("Lütfen Gridden güncellenecek Telefon adresini seçiniz."); return;
            }
            customerPhone            = dgCustomerPhone.SelectedItem as CustomerPhoneContract;
            customerPhone.CustomerId = customerDetail.Id;
            CustomerPhoneWindow.MainWindow addPhoneWindow = new CustomerPhoneWindow.MainWindow(customerPhone);
            addPhoneWindow.Show();
        }
예제 #8
0
        public List <CustomerPhoneContract> GetCustomerPhone(int Id)
        {
            SqlDataReader dr;

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

            List <CustomerPhoneContract> customerPhones = new List <CustomerPhoneContract>();
            CustomerPhoneContract        customerPhone;

            while (dr.Read())
            {
                customerPhone       = new CustomerPhoneContract();
                customerPhone.Id    = (int)dr[0];
                customerPhone.Phone = dr[1].ToString();

                customerPhones.Add(customerPhone);
            }

            return(customerPhones);
        }