public Boolean InsertCus(Models.Customers cusData) { Dao.CusDao cusDao = new Dao.CusDao(); var r = cusDao.InsertCus(cusData); return(r); }
public ActionResult CreateCustomerPost([Bind(Include = "CustomerID,Name,Adress,Phone,NIP")] Models.Customers customerEntry) { customerEntry.CustomerID = db.Customers.ToArray().LastOrDefault().CustomerID + 1; db.Customers.Add(customerEntry); db.SaveChanges(); return(RedirectToAction("Customers")); }
public async Task <IActionResult> Edit(string id, [Bind("SerialNumber,ClientForeName,ClientSureName,AcceptanceDate,IssueDescription,State,Photo")] Models.Customers customers) { if (id != customers.SerialNumber) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomersExists(customers.SerialNumber)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customers)); }
private void btnUpdate_Click(object sender, EventArgs e) { DAL_Customers _objDAL = new DAL_Customers(); Models.Customers customers = _objDAL.UpdateCustomer(new Models.Customers() { Address = txtAddress.Text, //txtBSTNo.Text , CustomerName = txtCompanyName.Text, ContactPerson = txtContactPerson.Text, //txtCSTNo.Text , //txtEmail.Text , //txtFYF.Text , //txtFYT.Text , MobileNo = txtMobile.Text, Id = Convert.ToInt32(lblID.Text) //txtPhone.Text , }); if (customers != null && !string.IsNullOrWhiteSpace(customers.MessageText)) { lblStatus.Visible = true; lblStatus.Text = customers.MessageText; if (customers.Code == Models.MessageCode.Success) { // ClearControl(); } } else { lblStatus.Visible = false; } }
public JsonResult InsertCus(Models.Customers cus) { Services.CusServices cusService = new Services.CusServices(); try { var cusData = new Models.Customers(); cusData.CompanyName = cus.CompanyName == null ? string.Empty : cus.CompanyName; cusData.ContactName = cus.ContactName == null ? string.Empty : cus.ContactName; cusData.ContactTitle = cus.ContactTitle; cusData.CreationDate = cus.CreationDate; cusData.Address = cus.Address == null ? string.Empty : cus.Address; cusData.City = cus.City == null ? string.Empty : cus.City; cusData.Country = cus.Country == null ? string.Empty : cus.Country; cusData.Region = cus.Region == null ? string.Empty : cus.Region; cusData.PostalCode = cus.PostalCode == null ? string.Empty : cus.PostalCode; cusData.Phone = cus.Phone == null ? string.Empty : cus.Phone; cusData.Fax = cus.Fax == null ? string.Empty : cus.Fax; var data = cusService.InsertCus(cusData); return(this.Json(data, JsonRequestBehavior.AllowGet)); } catch (Exception e) { return(this.Json(e, JsonRequestBehavior.AllowGet)); } }
private void FinishForm_Load(object sender, EventArgs e) { mch = MachineController.getinfor(Convert.ToInt32(idghe)); cus = ServiceController.getcustomerinfbymachine(Convert.ToInt32(idghe)); machinename.Text = mch.name; customername.Text = cus.name; cm = ServiceController.getInformation(mch.machineid, cus.localid); DateTime now = DateTime.Now; DateTime start = cm.dayadd; int active = time; int subactive = FileConfig.config.workingtime - active; if (subactive <= 0) { active = FileConfig.config.workingtime; } saveactive = active; int hour = active / 3600; active = active - hour * 3600; int minute = active / 60; active = active - minute * 60; int second = active; activetime.Text = addZero(hour) + ":" + addZero(minute) + ":" + addZero(second); starttime.Text = cm.dayadd.ToString(); }
public ActionResult Create(IFormCollection collection) { try { int LastTryIdNumber; if (Singleton.Instance.CustomersList.Count == 0) { LastTryIdNumber = 0; } else { LastTryIdNumber = Singleton.Instance.CustomersList.Count; } var newCustomers = new Models.Customers { Id = LastTryIdNumber, Name = collection["Name"], LastName = collection["LastName"], Telephone = Convert.ToInt32(collection["Telephone"]), Description = collection["Description"] }; Singleton.Instance.CustomersList.Add(newCustomers); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public async Task <IActionResult> Edit(int id, [Bind("Id,FirstName,LastName,Addrses1,City,Province,Country,Postal,Phone,Emailaddress")] Models.Customers customers) { if (id != customers.Id) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(customers); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CustomersExists(customers.Id)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(customers)); }
private PartialViewResult GetCustomersModal(Models.Customers customer) { return(new PartialViewResult { ViewName = @".\Customers\CustomersModal", ViewData = new ViewDataDictionary <Models.Customers>(ViewData, customer) }); }
private void comboBox1_SelectionChangeCommitted(object sender, EventArgs e) { if (textBox1.Text != "" && customer != "") { selected_customer = CustomerController.getinformation(comboBox1.SelectedValue.ToString()); showInfor(); } }
public void AddCustomer(Models.Customers customer) { //if (_data.Any(r => r.Id == restaurant.Id)) //{ // throw new InvalidOperationException($"Restaurant located at {restaurant.Location} already exists."); //} _db.Add(Mapper.Map(customer)); }
private void CustomerHistory_Load(object sender, EventArgs e) { label1.Text = idcustomer; dt_history = Module.MydataGridView(dt_history); dt_history.DataSource = HistoryController.getHistorybyCustomerId(idcustomer); Models.Customers cus = CustomerController.getinformation(idcustomer); label2.Text = cus.name; label3.Text = cus.phone; label4.Text = cus.address; }
private void button2_Click(object sender, EventArgs e) { AddCustomerForm acf = new AddCustomerForm(); if (acf.ShowDialog() == DialogResult.OK) { selected_customer = CustomerController.addedCustomer; showInfor(); } }
public async Task <PartialViewResult> OnGetCustomerDelete(int id) { Models.Customers customer = await _context.Customers.FirstOrDefaultAsync(m => m.CustomerId == id); customer.Action = "Delete"; //TODO: Cancel Twilio Phone Numbers return(GetCustomersModal(customer)); }
public ActionResult Details(string CustomerID) { NorthwindEntities dc = new NorthwindEntities(); Models.Customers c = dc.Customers.Find(CustomerID); if (c == null) { return(HttpNotFound());//回傳404 } return(View(c)); }
public Customer CreateCustomer(Models.Customers res, string Primarydomain, string billingCulture, string billingLanguage) { try { var customerToCreate = new Customer() { CompanyProfile = new CustomerCompanyProfile() { Domain = Primarydomain, }, BillingProfile = new CustomerBillingProfile() { Culture = billingCulture, //"en-US", Email = res.Email, Language = billingLanguage, //"en", CompanyName = res.Company, DefaultAddress = new Address() { FirstName = res.FirstName, LastName = res.LastName, AddressLine1 = res.Address1, AddressLine2 = res.Address2, City = res.City, State = res.Province, //"WA", Country = res.Country, //"US", PhoneNumber = res.PhoneNumber, PostalCode = res.ZipCode } } }; var newCustomer = ApplicationDomain.Instance.PartnerCenterClient.Customers.Create(customerToCreate); string MailBody = "<html><body>" + "<b>Name</b>" + res.FirstName + " " + res.LastName + "<b>Email</b>" + res.PrimaryDomain + "<b>Password</b>" + newCustomer.UserCredentials.Password + "</body></html>"; ViewModel.SendEmail.SendEmailRegister(res.Email, "Successfully Account has been created", MailBody); return(newCustomer); } catch { throw new Exception("Unknown error occur, Please try again"); } }
public ActionResult Search(Models.Customers c) { bool a = c.CompanyName == null; var results = db.Customers .Where(x => (c.CustomerID == 0) ? true : x.CustomerID == c.CustomerID) .Where(x => (c.CompanyName == null) ? true : x.CompanyName.Contains(c.CompanyName)) .Where(x => (c.ContactName == null) ? true : x.ContactName.Contains(c.ContactName)) .Where(x => (c.ContactTitle == null) ? true : x.ContactTitle == c.ContactTitle); return(Json(results, JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> Create([Bind("Id,FirstName,LastName,Addrses1,City,Province,Country,Postal,Phone,Emailaddress")] Models.Customers customers) { if (ModelState.IsValid) { _context.Add(customers); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); } return(View(customers)); }
public PartialViewResult OnGetCustomerCreate() { Models.Customers customer = new Models.Customers() { Action = "Create", IsMember = false, Active = true }; //TODO: Create CustomerRate record return(GetCustomersModal(customer)); }
public ActionResult NewCustomer(Models.Customers C) { try { Models.DataManagement.DataAcces db = new Models.DataManagement.DataAcces(); db.AddCustomer(C); C = db.GetCustomerBySIREN(C.SIREN); return(RedirectToAction(nameof(PersonContacted), new { IdCustomer = C.IdCustomer })); } catch { return(RedirectToAction(nameof(PersonContacted), new { IdCustomer = C.IdCustomer })); } }
private List <SelectListItem> TwilioPhoneList(int customerid, string phone, int miles) { Models.Customers customer = _context.Customers.FirstOrDefault(c => c.CustomerId == customerid); phone = (string.IsNullOrEmpty(phone) ? "+1" + customer.PrimaryPhone : "+1" + phone); TwilioClient.Init(customer.TwilioAccountSid, customer.TwilioAuthToken); ResourceSet <LocalResource> localAvailableNumbers = LocalResource.Read("US", nearNumber: phone, distance: miles); return((from c in localAvailableNumbers select new SelectListItem { Value = c.PhoneNumber.ToString().Substring(2), Text = c.FriendlyName.ToString() + " " + c.Locality }).ToList()); }
public JsonResult SearchCus(Models.Customers cus) { Services.CusServices cusService = new Services.CusServices(); var cusData = new Models.CustomerView1(); cusData.CustomerID = Convert.ToInt16(cus.CustomerID); cusData.CompanyName = "%" + Convert.ToString(cus.CompanyName) + "%"; cusData.ContactName = "%" + Convert.ToString(cus.ContactName) + "%"; cusData.ContactTitle = "000" + Convert.ToString(cus.ContactTitle); var data = cusService.SearchCus(cusData); return(this.Json(data, JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> OnGetAsync(int?id) { if (id == null) { return(NotFound()); } Customers = await _context.Customers.FirstOrDefaultAsync(m => m.CustomerId == id); if (Customers == null) { return(NotFound()); } return(Page()); }
public Models.Customers post([FromBody] Models.Customers customer) { string data; using (StreamReader reader = new StreamReader(new FileStream(Path.GetFileName("../database.json"), FileMode.Open))) { data = reader.ReadToEnd(); } var Customers = JsonConvert.DeserializeObject <Models.APIData>(data); Customers.customers.Add(customer); customers.Add(customer); return(customer); }
public async Task <PartialViewResult> OnGetCustomerPhonesCreateAsync(int id) { Models.Customers customer = await _context.Customers.FirstOrDefaultAsync(c => c.CustomerId == id); CustomerPhonesEdit phone = new CustomerPhonesEdit { CustomerPhone = new Models.CustomerPhones { CustomerId = id }, AvailableNumbersSL = TwilioPhoneList(id, customer.PrimaryPhone, 10), PrimaryPhone = customer.PrimaryPhone, Action = "Create" }; return(CustomerPhonesModal(phone)); }
public JsonResult Search(SearchCondition sc) { Models.CustomerService CustomerService = new Models.CustomerService(); List <Models.Customers> customers = CustomerService.GetOrderByCondition(sc); List <Object> results = new List <Object>(); for (int i = 0; i < customers.Count; i++) { Models.Customers order = customers[i]; results.Add(new { CustomerID = order.CustomerID, }); } return(Json(results, JsonRequestBehavior.AllowGet)); }
public ActionResult Create(Models.Customers customer) { if (!ModelState.IsValid) { return(View(customer)); } db.Customers.Add(customer); try { db.SaveChanges(); } catch (Exception e) { return(View(customer)); } return(RedirectToAction("Index")); }
public async Task <PartialViewResult> OnPostCustomersUpdate(Models.Customers customer) { if (ModelState.IsValid) { switch (customer.Action) { case "Create": customer.FTPUserName = customer.CustomerCode; customer.FTPPassword = GenerateRandomPassword(); //TODO: Create Twilio Subaccount //TODO: Get SendGridAPIKey and populate, generate e-mail address _context.Customers.Add(customer); await _context.SaveChangesAsync(); Models.MasterRates masterrate = _context.MasterRates.FirstOrDefault(mr => mr.IsMember == customer.IsMember); Models.CustomerRates rate = new Models.CustomerRates { CustomerId = customer.CustomerId, EmailRate = masterrate.EmailRate, TextRate = masterrate.TextRate, VoiceRate = masterrate.VoiceRate }; _context.CustomerRates.Add(rate); break; case "Edit": //Not used here break; case "Delete": _context.Customers.Remove(customer); //TODO: Close Twilio Subaccount //TODO: Cancel Twilio Phone break; } await _context.SaveChangesAsync(); } return(GetCustomersModal(customer)); }
public ActionResult Index(IFormCollection collection) { try { var newCustomer = new Models.Customers { Name = collection["Name"], Surname = collection["Surname"], Phone = Convert.ToInt32(collection["Phone"]), Description = collection["Description"] }; Singleton.Instance.ClientList.Add(newCustomer); return(RedirectToAction(nameof(Index))); } catch { return(View()); } }
public ActionResult Detail(int Id) { KalliPoshApp.Models.Customers uiCustomer = new Models.Customers(); var model = _DbContext.Customers.Where(x => x.Id == Id).FirstOrDefault(); var dbMembershipList = _DbContext.MembershipTypes.Where(x => x.Id == model.MembershipTypeId).FirstOrDefault(); if (model != null) { uiCustomer.Name = model.Name; uiCustomer.MembershipName = dbMembershipList.MembershipName; uiCustomer.DOB = model.DOB; } else { uiCustomer = null; } return(View(uiCustomer)); }