public string Add(string Name, string Code, string Address, string Email, string Contact, int Age, int LoyalityPoint) { Customer acustomer = new Customer(); acustomer.Name = Name; acustomer.Code = Code; acustomer.Address = Address; acustomer.Email = Email; acustomer.Contact = Contact; acustomer.Age = Convert.ToInt32(Age); acustomer.LoyalityPoint = Convert.ToInt32(LoyalityPoint); string exist = customerBLL.Exist(acustomer); string exmsg; if (exist != null) { exmsg = "Customer already Exist"; return(exmsg); } bool saved = customerBLL.Add(acustomer); string msg = "UnsuccessFull Operation"; if (saved) { msg = "successfuull Operation"; } return(msg); }
public string Add(Customer form) { UserBLL userbll = new UserBLL(); string userid = userbll.GetCurrentUser().User.ID; form.Creator = form.LastUpdator = userid; return(bll.Add(form)); }
private void btnCustomerAdd_Click(object sender, EventArgs e) { if (_updateCustomer == null) { customer.CompanyName = txtCompanyName.Text; customer.ContactName = txtContactName.Text; customer.CustomerEmail = txtEmail.Text; if (customerBLL.Add(customer)) { MessageBox.Show("Müşteri Ekleme Başarılı"); } else { MessageBox.Show("Müşteri Ekleme Başarısız"); } } else { _updateCustomer.CompanyName = txtCompanyName.Text; _updateCustomer.ContactName = txtContactName.Text; _updateCustomer.CustomerEmail = txtEmail.Text; if (customerBLL.Update(_updateCustomer)) { MessageBox.Show("Güncelleme başarılı"); } else { MessageBox.Show("Güncelleme işlemi başarısız"); } } bool control = true; foreach (var item in MdiParent.MdiChildren) { if (item is CustomerListForm) { ((CustomerListForm)item).CustomerList(); item.BringToFront(); control = false; } } if (control) { CustomerListForm customerList = new CustomerListForm(); customerList.MdiParent = MdiParent; customerList.Show(); } }
private void btnAdd_Click(object sender, RoutedEventArgs e) { var op = CustomerBLL.Add(new Customer() { Id = Guid.NewGuid(), FirstName = txtFirstName.Text, LastName = txtLastName.Text, EmailAddress = txtEmailAddress.Text, ContactNumber = txtMobileNumber.Text, HomeAddress = txtHomeAddress.Text }); if (op.Code != "200") { MessageBox.Show("Error : " + op.Message); } else { MessageBox.Show("Customer is successfully added to table"); } myParentWindow.showData(); this.Close(); }
private void btnSave_Click(object sender, EventArgs e) { if (btnSave.Text == "Kaydet") { control = Convert.ToBoolean(_customerBLL.Get(txtEMail.Text)); if (control) { MessageBox.Show("Bu Email daha önce kullanılmış!"); } else { if (string.IsNullOrWhiteSpace(txtContactName.Text)) { errorProvider.SetError(txtContactName, "Yetkili ismi boş geçilemez"); return; } customer.ContactName = txtContactName.Text; errorProvider.SetError(txtContactName, ""); if (string.IsNullOrWhiteSpace(txtCompanyName.Text)) { errorProvider.SetError(txtCompanyName, "Şirket ismi boş geçilemez"); return; } customer.CompanyName = txtCompanyName.Text; errorProvider.SetError(txtCompanyName, ""); if (string.IsNullOrWhiteSpace(txtAdress.Text)) { errorProvider.SetError(txtAdress, "Adres alanı boş geçilemez"); return; } customer.Address = txtAdress.Text; errorProvider.SetError(txtAdress, ""); if (string.IsNullOrWhiteSpace(txtEMail.Text)) { errorProvider.SetError(txtEMail, "Email alanı boş geçilemez"); return; } customer.Email = txtEMail.Text; errorProvider.SetError(txtEMail, ""); if (string.IsNullOrWhiteSpace(txtPhone.Text)) { errorProvider.SetError(txtPhone, "Telefon alanı boş geçilemez"); return; } customer.Phone = txtPhone.Text; errorProvider.SetError(txtPhone, ""); _customerBLL.Add(customer); MessageBox.Show("Müşteri kaydedildi."); CleanBox(); } } else { if (string.IsNullOrWhiteSpace(txtContactName.Text)) { errorProvider.SetError(txtContactName, "Yetkili ismi boş geçilemez"); return; } customer.ContactName = txtContactName.Text; errorProvider.SetError(txtContactName, ""); if (string.IsNullOrWhiteSpace(txtCompanyName.Text)) { errorProvider.SetError(txtCompanyName, "Şirket ismi boş geçilemez"); return; } customer.CompanyName = txtCompanyName.Text; errorProvider.SetError(txtCompanyName, ""); if (string.IsNullOrWhiteSpace(txtAdress.Text)) { errorProvider.SetError(txtAdress, "Adres alanı boş geçilemez"); return; } customer.Address = txtAdress.Text; errorProvider.SetError(txtAdress, ""); if (string.IsNullOrWhiteSpace(txtEMail.Text)) { errorProvider.SetError(txtEMail, "Email alanı boş geçilemez"); return; } customer.Email = txtEMail.Text; errorProvider.SetError(txtEMail, ""); if (string.IsNullOrWhiteSpace(txtPhone.Text)) { errorProvider.SetError(txtPhone, "Telefon alanı boş geçilemez"); return; } customer.Phone = txtPhone.Text; errorProvider.SetError(txtPhone, ""); _customerBLL.Update(customer); MessageBox.Show("Güncelleme işlemi başarıyla gerçekleşti."); CleanBox(); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { List <string> errors = new List <string>(); if (string.IsNullOrEmpty(txtName.Text)) { errors.Add("First Name is required."); } ; if (string.IsNullOrEmpty(txtBillAddresss.Text)) { errors.Add("Billing Address is required."); } ; if (string.IsNullOrEmpty(txtPNumber.Text)) { errors.Add("Password is required."); } ; if (string.IsNullOrEmpty(txtEmail.Text)) { errors.Add("Email is required."); } ; if (string.IsNullOrEmpty(txtShipAddress.Text)) { errors.Add("Shipping Address is required."); } ; var message = string.Join(Environment.NewLine, errors); if (errors.Count > 0) { MessageBox.Show(message); } var op = CustomerBLL.Add(new Customer() { Id = Guid.NewGuid(), CustomerName = txtName.Text, Customer_ContactNumber = txtPNumber.Text, Customer_EmailAddress = txtEmail.Text, BillingAddress = txtBillAddresss.Text, Default_ShippingAddress = txtShipAddress.Text }); if (op.Code != "200") { MessageBox.Show("Error : " + op.Message); } else { MessageBox.Show("Employee is successfully added to table"); } myParentWindow.showData(); this.Close(); }