private void ModifyCustomerOnSearch(object sender, Form.SubmittedEventArgs e) { if (!int.TryParse(e.Data.Get <string>("Customer ID"), out var customerId)) { e.Result = "Invalid ID"; return; } var customer = _crm.Customers.FirstOrDefault(c => c.Id == customerId); if (customer == null) { e.Result = "No customer with that ID"; return; } var modifyForm = ModifyCustomer.GetComponent <Form>("modify"); modifyForm.Set("ID", customerId.ToString()); modifyForm.Set("Title", customer.Title); modifyForm.Set("Given Names", customer.GivenNames); modifyForm.Set("Surname", customer.Surname); modifyForm.Set("Date of birth", customer.BirthDate.ToString("dd/MM/yyyy")); modifyForm.Set("Gender", customer.Gender); ModifyCustomer.ActiveComponent = "modify"; }
public void XuLyDatPhong(int idPhong, string userName) { int IDCus = 0; ModifyCustomer mC = new ModifyCustomer(); IDCus = mC.GetIDByUsername(userName); ModifyBooking mB = new ModifyBooking(); mB.InsertDB(IDCus, idPhong); //int ID = new ModifyCustomer().GetIDByUsername(userName); }
public CustomerManager(CustomerResourceManager crm, Fleet fleet) { _crm = crm; _fleet = fleet; AddCustomer.Submitted += AddCustomerOnSubmitted; CustomerSearch.GetComponent <Form>("initial search").Submitted += CustomerSearchOnSearch; CustomerSearch.GetComponent <Form>("customer list").Submitted += CustomerSearchOnSearch; ModifyCustomer.GetComponent <Form>("search").Submitted += ModifyCustomerOnSearch; ModifyCustomer.GetComponent <Form>("modify").Submitted += ModifyCustomerOnSubmitted; DeleteCustomer.GetComponent <Form>("select").Submitted += DeleteCustomerOnSearch; DeleteCustomer.GetComponent <Form>("confirm").Submitted += DeleteCustomerOnSubmitted; CustomerReport.PreRender += CustomerReportOnFocused; }
public JsonResult CheckCustomer(string phoneNumber) { if (new ModifyCustomer().GetCustomerByPhone(phoneNumber) == null) { return(Json("false", JsonRequestBehavior.AllowGet)); } else { Customer c = new ModifyCustomer().GetCustomerByPhone(phoneNumber); string InfoCus = c.Name + "-" + c.Birth.Day + "-" + c.Birth.Month + "-" + c.Birth.Year + "-" + c.Gender + "-" + c.Phone + "-" + c.Address; return(Json(InfoCus, JsonRequestBehavior.AllowGet)); } }