Пример #1
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     if (String.IsNullOrEmpty(txtFirstName.Text) || String.IsNullOrEmpty(txtLastName.Text) ||
         String.IsNullOrEmpty(ddGender.Text) || String.IsNullOrEmpty(txtPhone.Text) ||
         String.IsNullOrEmpty(txtEmail.Text) || String.IsNullOrEmpty(txtAddress.Text))
     {
         MessageBox.Show("Please insert information fully !", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
     else
     {
         string   fName       = txtFirstName.Text;
         string   lName       = txtLastName.Text;
         string   phone       = txtPhone.Text;
         string   email       = txtEmail.Text;
         string   address     = txtAddress.Text;
         bool     gender      = (ddGender.SelectedItem.ToString() == "Female") ? true : false;
         Customer customer    = new Customer(1, fName, lName, phone, email, address, gender, true);
         bool     addCustomer = customerBLL.AddCustomer(customer);
         if (addCustomer)
         {
             MessageBox.Show("Add customer success");
         }
         LoadCustomer();
     }
 }
Пример #2
0
        public ActionResult Kaydet()
        {
            string musteriID    = Request.Params["txt_müsteriID"];
            string musteriadi   = Request.Params["txt_müsteriadi"];
            string contactTitle = Request.Params["txt_contactTitle"];
            string CompanyName  = Request.Params["txt_companyName"];
            string adres        = Request.Params["txt_adres"];
            string sehir        = Request.Params["txt_sehir"];

            Customer customer = new Customer();

            customer.CustomerID   = musteriID.Substring(0, 5).ToUpper();
            customer.ContactName  = musteriadi;
            customer.ContactTitle = contactTitle;
            customer.CompanyName  = CompanyName;
            customer.Address      = adres;
            customer.City         = sehir;
            customer.Country      = "sdfghj";
            customer.Fax          = "fgh";
            customer.Phone        = "fgh";
            customer.PostalCode   = "bn";
            customer.Region       = 1;
            CustomerBLL.AddCustomer(customer);


            return(RedirectToAction("About"));
        }
Пример #3
0
        public ActionResult Index(FormCollection collection, Customer c)
        {
            CustomerBLL cb      = new CustomerBLL();
            string      message = cb.AddCustomer(collection, c);

            return(View(message));
        }
Пример #4
0
        private void btn_kaydet_Click(object sender, EventArgs e)
        {
            string kelime     = txt_CompanyName.Text;
            string CustomerID = kelime.Substring(0, 3);

            Customer customer = new Customer();

            customer.City         = txt_City.Text;
            customer.Address      = txt_address.Text;
            customer.CompanyName  = txt_CompanyName.Text;
            customer.ContactName  = txt_ContactName.Text;
            customer.ContactTitle = txt_ContactName.Text;
            customer.Country      = txt_ContactName.Text;
            customer.Fax          = txt_Fax.Text;
            customer.Phone        = txt_Phone.Text;
            customer.PostalCode   = txt_PostalCode.Text;
            customer.Region       = txt_Region.Text;
            customer.CustomerID   = CustomerID;

            int eklendiMi = CustomerBLL.AddCustomer(customer);

            if (eklendiMi > 0)
            {
                MessageBox.Show("Test");
            }
            else
            {
                MessageBox.Show("Test");
            }
        }
Пример #5
0
        public dynamic AddCustomer()
        {
            string name    = Fun.Form("name");
            int    sex     = Fun.Form("sex", -1);
            string bday    = Fun.Form("bday");
            int    bdType  = Fun.Form("bdType", 0);
            int    source  = Fun.Form("source", 0);
            int    level   = Fun.Form("level", 0);
            int    manager = Fun.Form("manager", 0);
            int    state   = Fun.Form("state", 0);
            string markday = Fun.Form("markday");
            string phone   = Fun.Form("phone");
            string addr    = Fun.Form("addr");
            string memo    = Fun.Form("memo");

            int         credit  = 100; //信用度
            string      headImg = "";  //默认头像
            int         loginId = 0;   //未绑定登陆账号
            CustomerBLL c       = new CustomerBLL();

            if (!c.AddCustomer(loginId, name, sex, bday, bdType, source, level, manager, state, markday, phone, addr, memo, credit, headImg))
            {
                return("失败");
            }
            else
            {
                return("成功");
            }
        }
        private void btnAdd_Click(object sender, EventArgs e)
        {
            try
            {
                bool NameNull    = string.IsNullOrEmpty(textboxName.Text);
                bool EmailNull   = string.IsNullOrEmpty(textboxEmail.Text);
                bool PhoneNull   = string.IsNullOrEmpty(textboxPhone.Text);
                bool AddressNull = string.IsNullOrEmpty(textboxAddress.Text);

                if (!NameNull && !EmailNull && !PhoneNull && !AddressNull)
                {
                    string name    = textboxName.Text;
                    string phone   = textboxPhone.Text;
                    string email   = textboxEmail.Text;
                    string address = textboxAddress.Text;

                    if (CustomerController.AddCustomer(name, phone, email, address))
                    {
                        MessageBox.Show("Thêm khách hàng thành công");
                    }
                }
                else
                {
                    MessageBox.Show("Thêm thất bại");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Thong tin khong hop le");
            }
        }
Пример #7
0
        public HttpResponseMessage Post(CustomerModels models)
        {
            bool result = _customerLayer.AddCustomer(models);

            if (result)
            {
                return(Request.CreateResponse(HttpStatusCode.OK));
            }
            else
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError));
            }
        }
Пример #8
0
        private void btnthem_Click(object sender, EventArgs e)
        {
            eCustomer cus = new eCustomer();

            cus.CustomerID   = Convert.ToInt32(txtCustomerID.Text);
            cus.CustomerName = txtCustomerName.Text;
            cus.Address      = txtAddress.Text;
            cus.PhoneNumber  = txtPhoneNumber.Text;


            khbll.AddCustomer(cus);
            LoadDataGridView(dtGvCustomer, khbll.GetAllCustomer());
        }
Пример #9
0
        public HttpResponseMessage AddCustomer(CustomerDTO cutomerDTO)
        {
            try
            {
                if (cutomerDTO == null)
                {
                    throw new ArgumentNullException("cutomerDTO");
                }

                CustomerDTO _Output = _ICustomerBLL.AddCustomer(cutomerDTO);
                return(Request.CreateResponse(HttpStatusCode.OK, _Output));
            }
            catch (Exception ex)
            {
                return(Request.CreateResponse(HttpStatusCode.InternalServerError, ex.Message));
            }
        }
Пример #10
0
        private void btnSave_Click_1(object sender, EventArgs e)
        {
            if (String.IsNullOrEmpty(txtCMND.Text) || cbGender.Text == "-select-" ||
                String.IsNullOrEmpty(txtPhone.Text) || String.IsNullOrEmpty(txtName.Text))

            {
                MessageBox.Show("Please insert information fully !", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            else
            {
                if (lbErrorCMND.Visible == true || lbErrorGender.Visible == true ||
                    lbErrorName.Visible == true || lbErrorPhone.Visible == true)
                {
                    MessageBox.Show("Please correct your mistakes before save changes");
                }
                else
                {
                    Customer ctm  = new Customer();
                    string   Name = txtName.Text;
                    while (Name.IndexOf("  ") != -1)
                    {
                        Name = Name.Replace("   ", " ");
                    }
                    Name            = Name.Trim();
                    ctm.Name        = Name;
                    ctm.CMND        = txtCMND.Text;
                    ctm.PhoneNumber = txtPhone.Text;
                    ctm.Status      = 1;
                    ctm.IsFemale    = (cbGender.SelectedItem.ToString() == "Female") ? true : false;
                    if (customerBLL.AddCustomer(ctm) == true)
                    {
                        DialogResult dialog = MessageBox.Show("Saved successfully", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        if (dialog == DialogResult.OK)
                        {
                            mainform.loadUCCustomer();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Can't save !!", "Notification", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                }
            }
        }
Пример #11
0
        private void button1_Click(object sender, EventArgs e)
        {
            Customer customer = new Customer();

            customer.CustomerID   = txtCustomerId.Text.ToString();
            customer.ContactName  = txtContactName.Text.ToString();
            customer.ContactTitle = txtContactTitle.Text.ToString();
            customer.CompanyName  = txtCompanyName.Text.ToString();
            customer.Address      = txtAddress.Text.ToString();
            customer.City         = "istanbul";
            customer.Country      = "sdfghj";
            customer.Fax          = "fgh";
            customer.Phone        = "fgh";
            customer.PostalCode   = "bn";
            customer.Region       = 1;
            CustomerBLL.AddCustomer(customer);

            MessageBox.Show("Customer Eklendi");
        }
Пример #12
0
        public string AddCustomer(CustomerModel model, int type)
        {
            string errorMsg = "";

            model.Name = StringHelper.GetFirstPYLetter(model.RealName);
            if (type == 1) //添加
            {
                if (!_bll.CustomerAddValidate(model, ref errorMsg))
                {
                    return(JsonConvert.SerializeObject(AlertHelper.WarningMessage(errorMsg)));
                }
                int id = _bll.AddCustomer(model);
                return(id > 0
                           ? JsonConvert.SerializeObject(AlertHelper.SuccessMessage())
                           : JsonConvert.SerializeObject(AlertHelper.ErrorMessage()));
            }
            return(_bll.UpdateCustomer(model)
                       ? JsonConvert.SerializeObject(AlertHelper.SuccessMessage("修改成功"))
                       : JsonConvert.SerializeObject(AlertHelper.ErrorMessage("修改失败")));
        }
Пример #13
0
        public ActionResult Kaydet()
        {
            string musteriAdi = Request.Params["txt_MusteriAdi"];

            Customer customer = new Customer();

            customer.City         = "city";
            customer.Address      = "";
            customer.CompanyName  = "";
            customer.ContactName  = "";
            customer.ContactTitle = "";
            customer.Country      = "";
            customer.Fax          = "";
            customer.Phone        = "";
            customer.PostalCode   = "";
            customer.Region       = "";
            customer.CustomerID   = musteriAdi.Substring(0, 5).ToUpper();

            int eklendiMi = CustomerBLL.AddCustomer(customer);

            return(RedirectToAction("About"));
        }
Пример #14
0
 private void btnAdd_Click(object sender, EventArgs e)
 {
     CustomerBLL.AddCustomer(textCustomerID.Text, textCompanyName.Text, textContactName.Text, textContactTitle.Text, textAdress.Text, textCity.Text, textRagion.Text, textPostaCode.Text, textCountry.Text, textPhone.Text, textFax.Text);
 }
Пример #15
0
 public ActionResult AddCustomer(Customer custo)
 {
     customerbll.AddCustomer(custo);
     return(RedirectToAction("Index"));
 }
Пример #16
0
 public ActionResult AddCustomer(Customers customer)
 {
     customerBLL.AddCustomer(customer);
     return(RedirectToAction("Index"));
 }
Пример #17
0
        private void btnBook_Click_1(object sender, EventArgs e)
        {
            if (chbMember.Checked == true)
            {
                // Đã đến trước đó rồi => Đã có trong cơ sở dữ liệu
                if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(dtpTime.Text))
                {
                    MessageBox.Show("Please insert fully information");
                }
                else
                {
                    // Add Booking Tables
                    // Sau khi Add xong thì getCustomerID
                    Customer customer = customerBLL.SearchCustomerByName(txtName.Text);
                    if (customer != null)
                    {
                        int CustomerID = customerBLL.GetCustomerID(customer);
                        if (CustomerID != -1)
                        {
                            // Tính ExpireTime
                            DateTime ExpireTime = dtpTime.Value.AddHours(1);
                            // Tạo BookingTable
                            BookingTable bookingTable = new BookingTable();
                            bookingTable.BookingDate = dtpTime.Value;
                            bookingTable.CustomerID  = CustomerID;
                            bookingTable.ExpiredTime = ExpireTime;
                            bookingTable.TableID     = TabID;

                            // Add xuống DB
                            if (bookingTableBLL.AddBookingTable(bookingTable) == true)
                            {
                                if (tableBLL.ChangeTableStatus(TabID, false, false, true) == true)
                                {
                                    MessageBox.Show("Booked sucessfully");
                                    this.Hide();
                                    mainform.loadUCTable();
                                }
                            }
                            else
                            {
                                MessageBox.Show("Cannot book. Please try again ><");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Cannot book. Please try again ><");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Cannot book. Please try again ><");
                    }
                }
            }
            else
            {
                // Chưa đến lần nào => Phải tạo Customer mới
                if (String.IsNullOrEmpty(txtName.Text) || String.IsNullOrEmpty(txtPhone.Text) ||
                    String.IsNullOrEmpty(dtpTime.Text) || String.IsNullOrEmpty(txtCMND.Text) ||
                    String.IsNullOrEmpty(cbGender.Text))
                {
                    MessageBox.Show("Please insert fully information");
                }
                else
                {
                    // Add new Customer
                    Customer customer = new Customer();
                    customer.Name        = txtName.Text;
                    customer.PhoneNumber = txtPhone.Text;
                    customer.IsFemale    = (cbGender.Text == "Female") ? true : false;
                    customer.CMND        = txtCMND.Text;

                    // Dùng hàm Add
                    if (customerBLL.AddCustomer(customer) == true)
                    {
                        // Sau khi Add xong thì getCustomerID
                        int CustomerID = customerBLL.GetCustomerID(customer);
                        if (CustomerID != -1)
                        {
                            // Tính ExpireTime
                            DateTime ExpireTime = dtpTime.Value.AddHours(1);
                            // Tạo BookingTable
                            BookingTable bookingTable = new BookingTable();
                            bookingTable.BookingDate = dtpTime.Value;
                            bookingTable.CustomerID  = CustomerID;
                            bookingTable.ExpiredTime = ExpireTime;
                            bookingTable.TableID     = TabID;

                            // Add xuống DB
                            if (bookingTableBLL.AddBookingTable(bookingTable) == true)
                            {
                                if (tableBLL.ChangeTableStatus(TabID, false, false, true) == true)
                                {
                                    MessageBox.Show("Booking thành công");
                                    this.Hide();
                                }
                                else
                                {
                                    MessageBox.Show("Không thành công. Vui lòng thử lại");
                                }
                            }
                            else
                            {
                                MessageBox.Show("Không thành công. Vui lòng thử lại");
                            }
                        }
                        else
                        {
                            MessageBox.Show("Không thành công. Vui lòng thử lại");
                        }
                    }
                    else
                    {
                        MessageBox.Show("Không thành công. Vui lòng thử lại");
                    }
                }
            }
        }