// GET: CustomerMaster/Create public ActionResult Create() { var moveToList = new List<SelectListItem>(); MoveToModel moveModel = new MoveToModel(); moveModel.MoveTo = "AMC Customer"; moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo }); moveModel = new MoveToModel(); moveModel.MoveTo = "Warranty List"; moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo }); moveModel = new MoveToModel(); moveModel.MoveTo = "MAC Inprocess"; moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo }); moveModel = new MoveToModel(); moveModel.MoveTo = "Inactive Customer"; moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo }); ViewBag.MoveToList = moveToList; var cm = new CustomerModel() { listMoveTo = moveToList }; return View(cm); }
public ActionResult Create(FormCollection collection) { try { // TODO: Add insert logic here var cm = new CustomerModel() { CustomerCode = collection["CustomerCode"].ToString(), CustomerName = collection["CustomerName"].ToString(), ContactPersonName = collection["ContactPersonName"].ToString(), AddressLine1 = collection["AddressLine1"].ToString(), AddressLine2 = collection["AddressLine2"].ToString(), AddressLine3 = collection["AddressLine3"].ToString(), Telephone1 = collection["Telephone1"].ToString(), Telephone2 = collection["Telephone1"].ToString(), CountryCode = collection["CountryCode"].ToString(), CountryName = collection["CountryName"].ToString(), Fax1 = collection["Fax1"].ToString(), Fax2 = collection["Fax2"].ToString(), Email = collection["Email"].ToString(), Remarks = collection["Remarks"].ToString(), CustomerType = collection["MoveToList"].ToString(), InstallationDate = collection["InstallationDate"].ToString(), ExpiryDate = collection["ExpiryDate"].ToString() }; cm.AddCust(cm); return RedirectToAction("Index"); } catch(Exception ex) { Response.Write(ex.ToString()); return View(); } }
public CustomerControl() { InitializeComponent(); //this.gvCustomers.ContextMenuStrip = this.GridViewMenu; Settings setting = new Settings(); try { CustomerParser newParser = new CustomerParser(); dataModel = new CustomerModel( this.gvCustomers, setting.DB_HOST, setting.DB_PORT, setting.DB_NAME, setting.DB_USER, setting.DB_PASS, "Sales.Customers", newParser); //dataModel = new CustomerModel(this.gvCustomers, ".\\SQL2008", setting.DB_PORT, setting.DB_NAME, setting.DB_USER, setting.DB_PASS, "HR.Customers", newParser); newParser.DataModel = dataModel; this.cbCountry.Items.Clear(); this.cbCountry.Items.AddRange(CustomerModel.GetCountries().ToArray()); } catch (Exception ex) { MessageBox.Show(ex.Message); } this._initModel(); }
public CustomerControl(string host, int port, string dbname, string username, string password, string table_name, CustomerParser parser) { this.InitializeComponent(); CustomerParser newParser = new CustomerParser(); try { dataModel = new CustomerModel( this.gvCustomers, host, port, dbname, username, password, "Sales.Customers", newParser); newParser.DataModel = dataModel; } catch (Exception ex) { MessageBox.Show(ex.Message); } this._initModel(); }
public ActionResult Register(string txtEmail, string txtConfirmEmail, string txtPassword, string txtConfirmPassword,string Button) { if (Button == "Create") { string strHostName = Dns.GetHostName(); //Get Host Name IPHostEntry ipEntry = Dns.GetHostEntry(strHostName); //Got IP Address string strAddr = ipEntry.AddressList[2].ToString(); //string url = "http://www.geobytes.com/IpLocator.htm?GetLocation&IpAddress=24.107.53.155"; UserGeoLocator ul = new UserGeoLocator(); UserLocationModel ulm = ul.GetUserLocation(strAddr); CustomerModel Customer = new CustomerModel(); Customer.Email = txtEmail; Customer.Password = txtPassword; Customer.LastIPAddress = strAddr; //Customer.IsNew = false; Customer.Status = "I"; Customer.LastCity = ulm.City; Customer.LastCountryName = ulm.CountryName; Customer.LastLatitude = ulm.Latitude; Customer.LastLongitude = ulm.Longitude; Customer.LastTimeZone = ulm.Timezone; Customer.LastZipCode = ulm.ZipPostalCode; //Customer.SignUpdate = DateTime.Now; CustomerDB.CreateCustomer(Customer); string EmailActivationURL = string.Format("http://*****:*****@RTDeals.com", "Account Activation", EmailActivationURL); } return View(); }
public void SetUp() { _model = new CustomerModel(); _mocker = new AutoMoqer(); _mocker.GetMock<IGetCustomersListQuery>() .Setup(p => p.Execute()) .Returns(new List<CustomerModel> { _model }); _controller = _mocker.Create<CustomersController>(); }
public ActionResult EditPost(CustomerModel customerModel) { if (ModelState.IsValid) { var newCustomer = CustomerManager.Edit(customerModel.Id, customerModel.Name, customerModel.Surname, customerModel.CompanyName, customerModel.Street, customerModel.City, customerModel.Code, customerModel.PhoneNumber, customerModel.NIP); return View(newCustomer); } else { return View(); } }
public void Update(CustomerModel model) { //If new customer if(model.CustomerId == 0) { CreatedDate = DateTime.Now; } FirstName = model.FirstName; LastName = model.LastName; Address1 = model.Address1; Address2 = model.Address2; City = model.City; Zip = model.Zip; States = model.States; }
// Update properties in Customer class from the input object public void Update(CustomerModel modelCustomer) { // If adding new customer, set created date if (modelCustomer.CustomerId == 0) { CreatedDate = DateTime.Now; } // Copy values from input object to Customer properties FirstName = modelCustomer.FirstName; LastName = modelCustomer.LastName; Address1 = modelCustomer.Address1; Address2 = modelCustomer.Address2; City = modelCustomer.City; State = modelCustomer.State; Zip = modelCustomer.Zip; }
public IHttpActionResult CreateCustomer(CustomerModel newCustomer) { var entity = new Customer() { Address = newCustomer.Address, City = newCustomer.City, CompanyName = newCustomer.CompanyName, ContactName = newCustomer.ContactName, ContactTitle = newCustomer.ContactTitle, Country = newCustomer.Country, Fax = newCustomer.Fax, Phone = newCustomer.Phone, PostalCode = newCustomer.PostalCode, Region = newCustomer.Region }; _repository.CreateCustomer(entity); var loc = Url.Link("api/customers/{customerID}", new { customerID = newCustomer.CustomerID}); return Created<CustomerModel>(loc, newCustomer); }
/// <summary> /// Adds a new customer to the database. /// </summary> /// <param name="customer">Customer.</param> /// <returns>Number of records affected. If all worked well, then should be 1.</returns> public int AddCustomer(CustomerModel customer) { CustomerRequest request = new CustomerRequest(); request.RequestId = NewRequestId; request.AccessToken = AccessToken; request.ClientTag = ClientTag; request.Action = "Create"; request.Customer = Mapper.ToDataTransferObject(customer); CustomerResponse response = null; SafeProxy.DoAction<ActionServiceClient>(Service, client => { response = client.SetCustomers(request); }); if (request.RequestId != response.CorrelationId) throw new ApplicationException("AddCustomer: RequestId and CorrelationId do not match."); if (response.Acknowledge != AcknowledgeType.Success) throw new ApplicationException(response.Message); return response.RowsAffected; }
public void SetUp() { _mocker = new AutoMoqer(); var customer = new CustomerModel { Id = CustomerId, Name = CustomerName, }; var employee = new EmployeeModel() { Id = EmployeeId, Name = EmployeeName }; var product = new ProductModel { Id = ProductId, Name = ProductName, UnitPrice = ProductPrice }; _mocker.GetMock<IGetCustomersListQuery>() .Setup(p => p.Execute()) .Returns(new List<CustomerModel> { customer }); _mocker.GetMock<IGetEmployeesListQuery>() .Setup(p => p.Execute()) .Returns(new List<EmployeeModel> { employee }); _mocker.GetMock<IGetProductsListQuery>() .Setup(p => p.Execute()) .Returns(new List<ProductModel> { product }); _factory = _mocker.Create<CreateSaleViewModelFactory>(); }
private void UpdateCutomer(CustomerModel existingCustomer) { using (SqlConnection cxn = new SqlConnection(cxnString)) { SqlCommand cmdCustomer = new SqlCommand("spUpdateCustomer", cxn); cmdCustomer.CommandType = CommandType.StoredProcedure; SqlParameter firstNameParam = new SqlParameter("@FirstName", SqlDbType.NVarChar, 50); firstNameParam.Value = existingCustomer.FirstName; SqlParameter surnameParam = new SqlParameter("@Surname", SqlDbType.NVarChar, 50); surnameParam.Value = existingCustomer.Surname; SqlParameter emailParam = new SqlParameter("@Email", SqlDbType.NVarChar, 50); emailParam.Value = existingCustomer.Email; SqlParameter phoneParam = new SqlParameter("@Phone", SqlDbType.NVarChar, 50); phoneParam.Value = existingCustomer.Phone; SqlParameter add1Param = new SqlParameter("@Address1", SqlDbType.NVarChar, 50); add1Param.Value = existingCustomer.Address1; SqlParameter add2Param = new SqlParameter("@Address2", SqlDbType.NVarChar, 50); add2Param.Value = existingCustomer.Address2; SqlParameter cityParam = new SqlParameter("@City", SqlDbType.NVarChar, 50); cityParam.Value = existingCustomer.City; SqlParameter countyParam = new SqlParameter("@County", SqlDbType.NVarChar, 50); countyParam.Value = existingCustomer.County; SqlParameter custIDParam = new SqlParameter("@CustomerID", SqlDbType.Int); custIDParam.Value = existingCustomer.CustomerID; cmdCustomer.Parameters.Add(firstNameParam); cmdCustomer.Parameters.Add(surnameParam); cmdCustomer.Parameters.Add(emailParam); cmdCustomer.Parameters.Add(phoneParam); cmdCustomer.Parameters.Add(add1Param); cmdCustomer.Parameters.Add(add2Param); cmdCustomer.Parameters.Add(cityParam); cmdCustomer.Parameters.Add(countyParam); cmdCustomer.Parameters.Add(custIDParam); cxn.Open(); cmdCustomer.ExecuteNonQuery(); cxn.Close(); } }
public IActionResult SignUp(CustomerModel model) { return(View()); }
public ResponseModel <BoolResponse> Register(CustomerModel model) { return(CallApi <BoolResponse>(ApiUrls.RegisterUser, JsonConvert.SerializeObject(model), Method.POST)); }
public CustomerModel Put(string id, CustomerModel model) { var retorno = PutAsync<CustomerModel>(id, model).Result; return retorno; }
public ActionResult CreateSubscriber(SiteSubscriber obj) { if (ModelState.IsValid) { Guid guid = new Guid(); Random rnmd = new Random(); PinPaymentsDbEntities db = new PinPaymentsDbEntities(); if (ModelState.IsValid) { tblCustomer obtbl = new tblCustomer(); CustomerModel model = new CustomerModel(); int cutomerid = model.AddCustomer(obj); xml = "<subscriber><customer-id>" + cutomerid + "</customer-id><screen-name>" + obj.FirstName + obj.LastName + "</screen-name></subscriber>"; site = ConfigurationManager.AppSettings["apiUrl"].ToString(); url = string.Format("https://subs.pinpayments.com/api/v4/{0}/subscribers.xml", site); CreateSubscriberApi(url, xml, "Post"); CardDetail obj1 = new CardDetail(); obj1.token = GenrateInvoice(obj.SubscriptionId, cutomerid.ToString(), obj.FirstName, obj.Email); obj1.firstName = obj.FirstName; obj1.lastName = obj.LastName; ViewBag.year = DBCommon.BindYear(); ViewBag.month = DBCommon.BindMonth(); return RedirectToAction("AddCardDetail", obj1); } return View("CreateSubscriber"); } else { return View(obj); } }
public ActionResult IsEmailExist(string Email) { CustomerModel cust = new CustomerModel(); return Json(cust.IsEmailExist(Email), JsonRequestBehavior.AllowGet); }
public ActionResult CustomerMadeOrder(CustomerModel model) { var addOrder = _inventoryService.CustomerMadeOrder(model); return(RedirectToAction("Index", "Home/Index")); }
public ActionResult Add(CustomerModel model) { if (!ModelState.IsValid) { return(View(model)); } CWICCard cwiccd = new CWICCard(); //顾客姓名保证唯一的 Customer other = cwiccd.FindCust(cu => cu.UserName == model.UserName); if (other != null) { ModelState.AddModelError("", "当前顾客名- " + model.UserName + " 已被占用,其车牌号- " + other.PlateNum + " ,请输入唯一的用户名!"); return(View(model)); } string plate = ""; foreach (char vl in model.PlateNum) { if (Char.IsLetter(vl)) { plate += char.ToUpper(vl); } else { plate += vl; } } model.PlateNum = plate; //车牌号码保证唯一的 other = cwiccd.FindCust(cu => cu.PlateNum == model.PlateNum); if (other != null) { ModelState.AddModelError("", "当前车牌号- " + model.PlateNum + " 已被绑定,其顾客名- " + other.UserName + " ,请输入正确的车牌号!"); return(View(model)); } Location lctn = null; #region if (model.Type == EnmICCardType.FixedLocation) { if (model.Warehouse == 0 || string.IsNullOrEmpty(model.LocAddress)) { ModelState.AddModelError("", "固定车位卡,请指定绑定车位!"); return(View(model)); } lctn = new CWLocation().FindLocation(lc => lc.Warehouse == model.Warehouse && lc.Address == model.LocAddress); if (lctn == null) { ModelState.AddModelError("", "绑定车位不存在,地址-" + model.LocAddress); return(View(model)); } else { //固定车位时,当前车位没有存车 if (lctn.Status != EnmLocationStatus.Space) { ModelState.AddModelError("", "当前车位:" + lctn.Address + " 已存车,卡号- " + lctn.ICCode + " ,请等待取车完成后再绑定!"); return(View(model)); } } } ICCard iccd = null; if (!string.IsNullOrEmpty(model.UserCode)) { #region iccd = cwiccd.Find(ic => ic.UserCode == model.UserCode); if (iccd == null) { ModelState.AddModelError("", "当前用户卡号没有注册,请确保该卡已完成制卡!"); return(View(model)); } if (iccd.Status != EnmICCardStatus.Normal) { ModelState.AddModelError("", "该卡已挂失或注销,无法完成操作!"); return(View(model)); } if (iccd.CustID != 0) { Customer cust = cwiccd.FindCust(iccd.CustID); if (cust != null) { ModelState.AddModelError("", "该卡已被绑定,车主姓名:" + cust.UserName); return(View(model)); } } #endregion } Customer addcust = new Customer(); if (model.Type == EnmICCardType.FixedLocation) { Customer cust = cwiccd.FindCust(cc => cc.Warehouse == model.Warehouse && cc.LocAddress == model.LocAddress); if (cust != null) { ModelState.AddModelError("", "该车位已被其他卡绑定,无法使用该车位- " + model.LocAddress + " ,Warehouse- " + model.Warehouse); return(View(model)); } addcust.Warehouse = (int)model.Warehouse; addcust.LocAddress = model.LocAddress; } addcust.UserName = model.UserName; addcust.PlateNum = model.PlateNum; addcust.FamilyAddress = model.FamilyAddress; addcust.MobilePhone = model.MobilePhone; addcust.Type = EnmICCardType.Temp; if ((int)model.Type > 0) { addcust.Type = model.Type; } addcust.StartDTime = DateTime.Parse("2017-1-1"); addcust.Deadline = DateTime.Parse("2017-1-1"); Response resp = cwiccd.AddCust(addcust); if (resp.Code == 1) { //如果有卡号,则绑定顾客于卡号 if (iccd != null) { iccd.CustID = addcust.ID; resp = cwiccd.Update(iccd); } #region 绑定指纹,更新指纹信息 CWFingerPrint fprint = new CWFingerPrint(); if (!string.IsNullOrEmpty(model.FingerPrint1)) { Int32 sn = Convert.ToInt32(model.FingerPrint1); FingerPrint finger = fprint.Find(p => p.SN_Number == sn); if (finger != null) { finger.CustID = addcust.ID; fprint.Update(finger); } } if (!string.IsNullOrEmpty(model.FingerPrint2)) { Int32 sn = Convert.ToInt32(model.FingerPrint2); FingerPrint finger = fprint.Find(p => p.SN_Number == sn); if (finger != null) { finger.CustID = addcust.ID; fprint.Update(finger); } } if (!string.IsNullOrEmpty(model.FingerPrint3)) { Int32 sn = Convert.ToInt32(model.FingerPrint3); FingerPrint finger = fprint.Find(p => p.SN_Number == sn); if (finger != null) { finger.CustID = addcust.ID; fprint.Update(finger); } } #endregion } if (addcust.Type == EnmICCardType.FixedLocation) { SingleCallback.Instance().WatchFixLocation(lctn, 1, addcust.UserName, addcust.Deadline.ToString(), addcust.PlateNum); } #endregion return(RedirectToAction("Index")); }
public ActionResult FindCustomList(int?pageSize, int?pageIndex, string sortOrder, string sortName, string queryName, string queryValue) { #region CWICCard cwiccd = new CWICCard(); List <Customer> custLst = cwiccd.FindCustList(cust => true); List <CustomerModel> models = new List <CustomerModel>(); foreach (Customer cust in custLst) { CustomerModel model = new CustomerModel(); model.ID = cust.ID; model.UserName = cust.UserName; model.PlateNum = cust.PlateNum; model.Type = cust.Type; model.Warehouse = cust.Warehouse; model.LocAddress = cust.LocAddress; model.MobilePhone = cust.MobilePhone; model.Deadline = cust.Deadline.ToString(); model.FamilyAddress = cust.FamilyAddress; ICCard iccd = cwiccd.Find(ic => ic.CustID == cust.ID); if (iccd != null) { model.UserCode = iccd.UserCode; model.Status = iccd.Status; } models.Add(model); } List <CustomerModel> firstQuery = new List <CustomerModel>(); if (queryName != "0" && !string.IsNullOrEmpty(queryValue)) { #region if (queryName == "UserCode") { firstQuery = models.Where(md => md.UserCode.Contains(queryValue)).ToList(); } else if (queryName == "Type") { EnmICCardType type = EnmICCardType.Init; if (queryValue.Contains("临时")) { type = EnmICCardType.Temp; } else if (queryValue.Contains("定期")) { type = EnmICCardType.Periodical; } else if (queryValue.Contains("固定")) { type = EnmICCardType.FixedLocation; } else if (queryValue.ToUpper().Contains("VIP")) { type = EnmICCardType.VIP; } firstQuery = models.Where(md => md.Type == type).ToList(); } else if (queryName == "UserName") { firstQuery = models.Where(md => md.UserName.Contains(queryValue)).ToList(); } else if (queryName == "FamilyAddress") { firstQuery = models.Where(md => md.FamilyAddress.Contains(queryValue)).ToList(); } else if (queryName == "MobilePhone") { firstQuery = models.Where(md => md.MobilePhone.Contains(queryValue)).ToList(); } else if (queryName == "LocAddress") { firstQuery = models.Where(md => md.LocAddress == queryValue).ToList(); } else if (queryName == "PlateNum") { firstQuery = models.Where(md => md.PlateNum.Contains(queryValue)).ToList(); } #endregion } else { firstQuery.AddRange(models); } #region 排序 只允许几个字段可以排序 List <CustomerModel> sortList = new List <CustomerModel>(); if (!string.IsNullOrEmpty(sortName)) { if (sortName == "ID") { if (sortOrder.ToLower() == "asc") { var sort = from cu in firstQuery orderby cu.ID ascending select cu; sortList.AddRange(sort); } else { var sort = from cu in firstQuery orderby cu.ID descending select cu; sortList.AddRange(sort); } } else if (sortName == "Type") { if (sortOrder.ToLower() == "asc") { var sort = from cu in firstQuery orderby(int) cu.Type ascending select cu; sortList.AddRange(sort); } else { var sort = from cu in firstQuery orderby(int) cu.Type descending select cu; sortList.AddRange(sort); } } else if (sortName == "LocAddress") { if (sortOrder.ToLower() == "asc") { var sort = from cu in firstQuery orderby cu.LocAddress ascending select cu; sortList.AddRange(sort); } else { var sort = from cu in firstQuery orderby cu.LocAddress descending select cu; sortList.AddRange(sort); } } else if (sortName == "UserCode") { if (sortOrder.ToLower() == "asc") { var sort = from cu in firstQuery orderby cu.UserCode ascending select cu; sortList.AddRange(sort); } else { var sort = from cu in firstQuery orderby cu.UserCode descending select cu; sortList.AddRange(sort); } } else { sortList.AddRange(firstQuery); } } else { sortList.AddRange(firstQuery); } #endregion #endregion #region 分页 int index = 1; int size = 10; if (pageSize != null) { size = (int)pageSize; } if (pageIndex != null) { index = (int)pageIndex; } int total = firstQuery.Count; List <CustomerModel> last = sortList.Skip((index - 1) * size).Take(size).ToList(); #endregion var value = new { total = total, rows = last }; Task.Factory.StartNew(() => { #region 除没有绑定用户的指纹(垃圾指纹) CWFingerPrint cwfinger = new CWFingerPrint(); List <FingerPrint> noCustFPrintLst = cwfinger.FindList(fp => fp.CustID == 0); foreach (FingerPrint print in noCustFPrintLst) { cwfinger.Delete(print.ID, false); } #endregion }); return(Json(value)); }
public CustomerMarketingModel FindCustomerMarketingModel(int id, CompanyModel company, CustomerModel customer, bool bCreateEmptyIfNotfound = true) { return(FindCustomerMarketingModel(id, company, customer.Id, bCreateEmptyIfNotfound)); }
private void ResetToNoSelection() { _customerToIssue = null; _movieToIssue = null; lblSelectedItem.Text = string.Empty; }
/// <summary> /// Make car reservervation from a particualr customer /// </summary> /// <param name="customer"></param> /// <param name="requestedReservationStartDateTime"></param> /// <param name="requestedReservationEndDateTime"></param> /// <param name="city"></param> public void TakeCarReservervation(CustomerModel customer, DateTime requestedReservationStartDateTime, DateTime requestedReservationEndDateTime, string city) { throw new NotImplementedException(); }
public void InsertCustomer(CustomerModel customer) { connection.Insert(customer); }
// GET api/customers/5 public HttpResponseMessage Get(int id) { var customer = _db.Customers.FirstOrDefault(c => c.CustomerId == id); var cust= new CustomerModel { CustomerId = customer.CustomerId, FirstName = customer.FirstName, LastName = customer.LastName, PhoneNumber = customer.PhoneNumber, AlternatePhoneNumber = customer.AlternatePhoneNumber, Email = customer.Email, Gender = customer.Gender, ImageSource = customer.ImageSource, Remarks = customer.Remarks, Appointments = from a in customer.CustomerAppointments orderby a.Start select new AppointmentOutModel { AppointmentId = a.AppointmentId, CustomerFirstName = a.Customer.FirstName, CustomerLastName = a.Customer.LastName, EmployeeFirstName = a.Employee.FirstName, EmployeeLastName = a.Employee.LastName, ServiceName = a.Service.ServiceName, ServicePrice = a.Service.Price, AppointmentStartTime = a.Start, AppointmentDurationInMins = a.Duration, CustomerPaid = a.Paid, AppointmentConfirmation = a.Confirmation, IsEmployeeRequested = a.EmployeeRequested, AppointmentRemarks = a.Remarks } }; if (cust == null) throw new HttpResponseException(HttpStatusCode.NotFound); return Request.CreateResponse<CustomerModel>(HttpStatusCode.OK, cust); }
// GET: CustomerMaster/Edit/5 public ActionResult Edit(int id) { var moveToList = new List<SelectListItem>(); MoveToModel moveModel = new MoveToModel(); moveModel.MoveTo = "AMC Customer"; moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo }); moveModel = new MoveToModel(); moveModel.MoveTo = "Warranty List"; moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo }); moveModel = new MoveToModel(); moveModel.MoveTo = "MAC Inprocess"; moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo }); moveModel = new MoveToModel(); moveModel.MoveTo = "Inactive Customer"; moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo }); ViewBag.MoveToList = moveToList; CustomerModel cm = new CustomerModel(); cm = cm.GetCustomerById(id); cm.listMoveTo = moveToList; return View(cm); }
public ActionResult Edit(CustomerModel model) { if (!ModelState.IsValid) { return(View(model)); } CWICCard cwiccd = new CWICCard(); #region 验证用户名、车牌号 //顾客姓名保证唯一的 Customer other = cwiccd.FindCust(cu => cu.UserName == model.UserName && cu.ID != model.ID); if (other != null) { ModelState.AddModelError("", "当前顾客名- " + model.UserName + " 已被占用,其车牌号- " + other.PlateNum + " ,请输入唯一的用户名!"); return(View(model)); } //车牌号码保证唯一的 other = cwiccd.FindCust(cu => cu.PlateNum == model.PlateNum && cu.ID != model.ID); if (other != null) { ModelState.AddModelError("", "当前车牌号- " + model.PlateNum + " 已被绑定,其顾客名- " + other.UserName + " ,请输入正确的车牌号!"); return(View(model)); } #endregion #region Customer cust = cwiccd.FindCust(model.ID); Location origloc = null; //原来是否绑定 if (cust.Type == EnmICCardType.FixedLocation) { origloc = new CWLocation().FindLocation(l => l.Warehouse == cust.Warehouse && l.Address == cust.LocAddress); } //是固定卡时 if (model.Type == EnmICCardType.FixedLocation) { #region if (model.Warehouse == 0 || string.IsNullOrEmpty(model.LocAddress)) { ModelState.AddModelError("", "固定卡,请指定绑定的库区及车位号!"); return(View(model)); } Location lctn = new CWLocation().FindLocation(lc => lc.Warehouse == model.Warehouse && lc.Address == model.LocAddress); if (lctn == null) { ModelState.AddModelError("", "固定卡,请正确的库区及车位地址!"); return(View(model)); } else { //固定车位时,当前车位没有存车 if (lctn.Status != EnmLocationStatus.Space) { ModelState.AddModelError("", "当前车位:" + lctn.Address + " 已存车,卡号- " + lctn.ICCode + " ,请等待取车完成后再绑定!"); return(View(model)); } } Customer custo = cwiccd.FindCust(cc => cc.Warehouse == model.Warehouse && cc.LocAddress == model.LocAddress); if (custo != null) { if (custo.ID != cust.ID) { ModelState.AddModelError("", "当前车位已被别的用户绑定"); return(View(model)); } } cust.Type = model.Type; cust.Warehouse = (int)model.Warehouse; cust.LocAddress = model.LocAddress; //释放原车位 if (origloc != null) { if (origloc.Address != lctn.Address) { SingleCallback.Instance().WatchFixLocation(origloc, 0, "", "", ""); } } //绑定当前车位 SingleCallback.Instance().WatchFixLocation(lctn, 1, cust.UserName, cust.Deadline.ToString(), cust.PlateNum); #endregion } else { cust.Type = model.Type; cust.Warehouse = 0; cust.LocAddress = ""; cust.StartDTime = DateTime.Parse("2017-1-1"); cust.Deadline = DateTime.Parse("2017-1-1"); //释放原车位 if (origloc != null) { SingleCallback.Instance().WatchFixLocation(origloc, 0, "", "", ""); } } ICCard oriIccd = cwiccd.Find(ic => ic.CustID == model.ID); ICCard newIccd = null; if (!string.IsNullOrEmpty(model.UserCode)) { newIccd = cwiccd.Find(ic => ic.UserCode == model.UserCode); if (newIccd == null) { ModelState.AddModelError("", "当前卡号没有注册!"); return(View(model)); } } if (oriIccd == null) { //原先没有绑定的 if (newIccd != null) { newIccd.CustID = cust.ID; cwiccd.Update(newIccd); } } else { if (newIccd == null) { //释放原来卡号 //释放旧卡 oriIccd.CustID = 0; cwiccd.Update(oriIccd); } else //两卡都存在 { //不是同一张卡 if (oriIccd.UserCode != newIccd.UserCode) { #region if (newIccd.Status != EnmICCardStatus.Normal) { ModelState.AddModelError("", "卡已挂失或注销,无法绑定用户!"); return(View(model)); } if (newIccd.CustID != 0) { Customer oricust = cwiccd.FindCust(newIccd.CustID); if (oricust != null) { ModelState.AddModelError("", "该卡已被绑定,车主姓名:" + oricust.UserName); return(View(model)); } } #endregion //释放旧卡 oriIccd.CustID = 0; cwiccd.Update(oriIccd); //绑定新卡 newIccd.CustID = cust.ID; cwiccd.Update(newIccd); } } } //允许更新 cust.PlateNum = model.PlateNum; cust.MobilePhone = model.MobilePhone; cust.UserName = model.UserName; cust.FamilyAddress = model.FamilyAddress; cwiccd.UpdateCust(cust); #region 更新指纹 CWFingerPrint cwfprint = new CWFingerPrint(); if (model.FingerPrint1 != "") { int fpvalue = Convert.ToInt32(model.FingerPrint1); FingerPrint fp = cwfprint.Find(fi => fi.SN_Number == fpvalue); if (fp != null) { if (fp.CustID == 0) { fp.CustID = cust.ID; cwfprint.Update(fp); } } } if (model.FingerPrint2 != "") { int fpvalue = Convert.ToInt32(model.FingerPrint2); FingerPrint fp = cwfprint.Find(fi => fi.SN_Number == fpvalue); if (fp != null) { if (fp.CustID == 0) { fp.CustID = cust.ID; cwfprint.Update(fp); } } } if (model.FingerPrint3 != "") { int fpvalue = Convert.ToInt32(model.FingerPrint3); FingerPrint fp = cwfprint.Find(fi => fi.SN_Number == fpvalue); if (fp != null) { if (fp.CustID == 0) { fp.CustID = cust.ID; cwfprint.Update(fp); } } } #endregion #endregion return(RedirectToAction("Index")); }
/// <summary> /// Updates the customer. /// </summary> /// <param name="customerModel">The customer model.</param> /// <returns>The updated customer model.</returns> public static CustomerModel UpdateCustomer( CustomerModel customerModel ) { if ( customerModel == null ) throw new ArgumentNullException( "customerModel" ); return customerModel; }
public async Task <IActionResult> AddCustomer(CustomerModel model) { await _databaseManager.Context.ExecuteNonQueryAsync($"insert into customers (name, surname, favorite_number) values ({{0}}, {{1}}, '{model.Favorite_Number}')", new CancellationToken(), model.Name, model.Surname); return(View("success")); }
/// <summary> /// Private helper function that appends a customer to the next node /// in the treeview control /// </summary> private TreeNode AddCustomerToTree(CustomerModel customer) { TreeNode node = new TreeNode(); node.Text = customer.Company + " (" + customer.Country + ")"; node.Tag = customer; node.ImageIndex = 1; node.SelectedImageIndex = 1; this.treeViewCustomer.Nodes[0].Nodes.Add(node); return node; }
public bool AddCustomer(CustomerModel model) { return(_customerService.AddCustomer(model)); }
/// <summary> /// Updates the customer. /// </summary> /// <param name="customerModel">The customer model.</param> /// <returns>The updated customer model.</returns> public static CustomerModel UpdateCustomer( CustomerModel customerModel ) { return customerModel; }
public static void CreateCustomer(Customer.CustomerClient client, CustomerModel customerModel) { client.CreateCustomer(customerModel); }
public ActionResult PreviewList(int id, GridCommand command) { var entity = _ruleStorage.GetRuleSetById(id, false, true); switch (entity.Scope) { case RuleScope.Customer: { var provider = _ruleProvider(entity.Scope) as ITargetGroupService; var expression = _ruleFactory.CreateExpressionGroup(entity, provider, true) as FilterExpression; var customers = provider.ProcessFilter(new[] { expression }, LogicalRuleOperator.And, command.Page - 1, command.PageSize); var guestStr = T("Admin.Customers.Guest").Text; var model = new GridModel <CustomerModel> { Total = customers.TotalCount }; model.Data = customers.Select(x => { var customerModel = new CustomerModel { Id = x.Id, Active = x.Active, Email = x.Email.NullEmpty() ?? (x.IsGuest() ? guestStr : string.Empty), Username = x.Username, FullName = x.GetFullName(), CreatedOn = Services.DateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc), LastActivityDate = Services.DateTimeHelper.ConvertToUserTime(x.LastActivityDateUtc, DateTimeKind.Utc) }; return(customerModel); }) .ToList(); return(new JsonResult { Data = model }); } case RuleScope.Product: { var provider = _ruleProvider(entity.Scope) as IProductRuleProvider; var expression = _ruleFactory.CreateExpressionGroup(entity, provider, true) as SearchFilterExpression; var searchResult = provider.Search(new[] { expression }, command.Page - 1, command.PageSize); var fileIds = searchResult.Hits .Select(x => x.MainPictureId ?? 0) .Where(x => x != 0) .Distinct() .ToArray(); var files = _mediaService.Value.GetFilesByIds(fileIds).ToDictionarySafe(x => x.Id); var model = new GridModel <ProductModel> { Total = searchResult.TotalHitsCount }; model.Data = searchResult.Hits.Select(x => { var productModel = new ProductModel { Id = x.Id, Sku = x.Sku, Published = x.Published, ProductTypeLabelHint = x.ProductTypeLabelHint, ProductTypeName = x.GetProductTypeLabel(Services.Localization), Name = x.Name, StockQuantity = x.StockQuantity, Price = x.Price, LimitedToStores = x.LimitedToStores, UpdatedOn = Services.DateTimeHelper.ConvertToUserTime(x.UpdatedOnUtc, DateTimeKind.Utc), CreatedOn = Services.DateTimeHelper.ConvertToUserTime(x.CreatedOnUtc, DateTimeKind.Utc) }; files.TryGetValue(x.MainPictureId ?? 0, out var file); productModel.PictureThumbnailUrl = _mediaService.Value.GetUrl(file, _mediaSettings.Value.CartThumbPictureSize, null, true); productModel.NoThumb = file == null; return(productModel); }) .ToList(); return(new JsonResult { Data = model }); } } return(new JsonResult { Data = null }); }
public static void EditCustomers(Customer.CustomerClient client, CustomerModel customerModel) { client.EditCustomers(customerModel); }
public ResponseModel <bool> UpdateCustomerDetail(string customerId, CustomerModel model) { return(CallApi <bool>(string.Format(ApiUrls.UpdateCustomerDetail, customerId), JsonConvert.SerializeObject(model), Method.POST)); }
public async Task <IActionResult> Post(CustomerModel customerModel) { var result = await this._customerService.SaveCustomer(customerModel); return(Ok(result)); }
public void UpdateCustomersAccount(CustomerModel customer, AccountModel account) { UpdateCutomer(customer); UpdateAccount(account); }
public async Task <ActionResult <CustomerModel> > UpdateCustomer(int customerId, CustomerModel customerModel) { var oldCustomer = await _customerService.GetById(customerId); if (oldCustomer == null) { return(NotFound()); } var newCustomer = _mapper.Map(customerModel, oldCustomer); _customerService.Update(newCustomer); if (await _customerService.IsSavedToDb()) { return(Ok(_mapper.Map <CustomerModel>(newCustomer))); } return(BadRequest()); }
public void CreateCustomerAccount(CustomerModel newCustomer, AccountModel newAccount, TransactionModel newTransaction) { using (SqlConnection cxn = new SqlConnection(cxnString)) { SqlCommand cmdCustomer = new SqlCommand("spAddCustomer", cxn); cmdCustomer.CommandType = CommandType.StoredProcedure; SqlParameter firstNameParam = new SqlParameter("@FirstName", SqlDbType.NVarChar, 50); firstNameParam.Value = newCustomer.FirstName; SqlParameter surnameParam = new SqlParameter("@Surname", SqlDbType.NVarChar, 50); surnameParam.Value = newCustomer.Surname; SqlParameter emailParam = new SqlParameter("@Email", SqlDbType.NVarChar, 50); emailParam.Value = newCustomer.Email; SqlParameter phoneParam = new SqlParameter("@Phone", SqlDbType.NVarChar, 50); phoneParam.Value = newCustomer.Phone; SqlParameter add1Param = new SqlParameter("@Address1", SqlDbType.NVarChar, 50); // will change to address 1 in db add1Param.Value = newCustomer.Address1; SqlParameter add2Param = new SqlParameter("@Address2", SqlDbType.NVarChar, 50); // will change to address 1 in db add2Param.Value = newCustomer.Address2; SqlParameter cityParam = new SqlParameter("@City", SqlDbType.NVarChar, 50); cityParam.Value = newCustomer.City; SqlParameter countyParam = new SqlParameter("@County", SqlDbType.NVarChar, 50); countyParam.Value = newCustomer.County; SqlParameter custIDParam = new SqlParameter("@CustomerID", SqlDbType.Int); custIDParam.Direction = ParameterDirection.Output; cmdCustomer.Parameters.Add(firstNameParam); cmdCustomer.Parameters.Add(surnameParam); cmdCustomer.Parameters.Add(emailParam); cmdCustomer.Parameters.Add(phoneParam); cmdCustomer.Parameters.Add(add1Param); cmdCustomer.Parameters.Add(add2Param); cmdCustomer.Parameters.Add(cityParam); cmdCustomer.Parameters.Add(countyParam); cmdCustomer.Parameters.Add(custIDParam); cxn.Open(); cmdCustomer.ExecuteNonQuery(); cxn.Close(); // Taking CustomerID from customer table and assigning it to the account CustomerID newAccount.CustomerID = Convert.ToInt32(cmdCustomer.Parameters["@CustomerID"].Value); SqlCommand cmdAccount = new SqlCommand("spAddAccount", cxn); cmdAccount.CommandType = CommandType.StoredProcedure; SqlParameter CustIDParam = new SqlParameter("@CustomerID", SqlDbType.Int); CustIDParam.Value = newAccount.CustomerID; SqlParameter AccTypeParam = new SqlParameter("@AccountType", SqlDbType.NVarChar, 50); AccTypeParam.Value = newAccount.AccountType; SqlParameter AccNumberParam = new SqlParameter("@AccountNumber", SqlDbType.Int); AccNumberParam.Value = newAccount.AccountNumber; SqlParameter SortCodeParam = new SqlParameter("@SortCode", SqlDbType.Int); SortCodeParam.Value = newAccount.SortCode; SqlParameter BalParam = new SqlParameter("@Balance", SqlDbType.Int); BalParam.Value = newAccount.Balance; SqlParameter OverDraftParam = new SqlParameter("@OverdraftLimit", SqlDbType.Int); OverDraftParam.Value = newAccount.OverdraftLimit; SqlParameter AccIDParam = new SqlParameter("@AccountID", SqlDbType.Int); AccIDParam.Direction = ParameterDirection.Output; cmdAccount.Parameters.Add(CustIDParam); cmdAccount.Parameters.Add(AccTypeParam); cmdAccount.Parameters.Add(AccNumberParam); cmdAccount.Parameters.Add(SortCodeParam); cmdAccount.Parameters.Add(BalParam); cmdAccount.Parameters.Add(OverDraftParam); cmdAccount.Parameters.Add(AccIDParam); cxn.Open(); cmdAccount.ExecuteNonQuery(); cxn.Close(); SqlCommand cmdTransaction = new SqlCommand("spAddTransaction", cxn); cmdTransaction.CommandType = CommandType.StoredProcedure; newTransaction.AccountID = Convert.ToInt32(cmdAccount.Parameters["@AccountID"].Value); SqlParameter accountIDParam = new SqlParameter("@AccountID", SqlDbType.Int); accountIDParam.Value = newTransaction.AccountID; SqlParameter amountParam = new SqlParameter("@Amount", SqlDbType.Int); amountParam.Value = newTransaction.Amount; SqlParameter typeParam = new SqlParameter("@Type", SqlDbType.NVarChar, 50); typeParam.Value = newTransaction.Type; SqlParameter descriptionParam = new SqlParameter("@Description", SqlDbType.NVarChar, 250); descriptionParam.Value = newTransaction.Description; SqlParameter transactionIDParam = new SqlParameter("@TransactionID", SqlDbType.Int); transactionIDParam.Direction = ParameterDirection.Output; cmdTransaction.Parameters.Add(accountIDParam); cmdTransaction.Parameters.Add(amountParam); cmdTransaction.Parameters.Add(typeParam); cmdTransaction.Parameters.Add(descriptionParam); cmdTransaction.Parameters.Add(transactionIDParam); cxn.Open(); cmdTransaction.ExecuteNonQuery(); cxn.Close(); } }
public Boolean add(CustomerModel customer) { return(dalCustomer.add(customer)); }
// GET: CustomerMaster/Details/5 public ActionResult Details(int id) { CustomerModel cm = new CustomerModel(); cm = cm.GetCustomerById(id); return View(cm); }
public Boolean edit(CustomerModel customer) { return(dalCustomer.update(customer)); }
public ActionResult Edit(int id, FormCollection collection) { try { var moveToList = new List<SelectListItem>(); MoveToModel moveModel = new MoveToModel(); moveModel.MoveTo = "AMC Customer"; moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo }); moveModel = new MoveToModel(); moveModel.MoveTo = "Warranty List"; moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo }); moveModel = new MoveToModel(); moveModel.MoveTo = "MAC Inprocess"; moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo }); moveModel = new MoveToModel(); moveModel.MoveTo = "Inactive Customer"; moveToList.Add(new SelectListItem { Text = moveModel.MoveTo, Value = moveModel.MoveTo }); ViewBag.MoveToList = moveToList; // TODO: Add update logic here var cm = new CustomerModel() { CustomerCode = collection["CustomerCode"].ToString(), CustomerName = collection["CustomerName"].ToString(), ContactPersonName = collection["ContactPersonName"].ToString(), AddressLine1 = collection["AddressLine1"].ToString(), AddressLine2 = collection["AddressLine2"].ToString(), AddressLine3 = collection["AddressLine3"].ToString(), Telephone1 = collection["Telephone1"].ToString(), Telephone2 = collection["Telephone1"].ToString(), CountryCode = collection["CountryCode"].ToString(), CountryName = collection["CountryName"].ToString(), Fax1 = collection["Fax1"].ToString(), Fax2 = collection["Fax2"].ToString(), Email = collection["Email"].ToString(), Remarks = collection["Remarks"].ToString(), CustomerType = collection["MoveToList"].ToString(), InstallationDate = collection["InstallationDate"].ToString(), ExpiryDate = collection["ExpiryDate"].ToString() }; cm.listMoveTo = moveToList; cm.UpdateCustByID(cm, id); //ViewData["SelectedType"] = Helper.SetSelectedValue(moveToList, cm.CustomerType); return RedirectToAction("Index"); } catch(Exception ex) { Response.Write(ex.Message); return View(); } }
public ActionResult BatchSalesAdd(SalesSaveViewModel Model) { try { sale.CustomerModelsId = Model.CustomerModelsId; int loyaltyPoint = (Convert.ToInt32(Model.CustomerPayment) / 1000); CustomerModel customer = new CustomerModel(); customer.Id = sale.CustomerModelsId; var aCustomer = _customerManager.FindById(customer); if (Model.Discount > 0) { aCustomer.CustLoyaltyPoints = aCustomer.CustLoyaltyPoints - (Convert.ToInt32(Model.Discount * 10)); } else { aCustomer.CustLoyaltyPoints = aCustomer.CustLoyaltyPoints + loyaltyPoint; } sale.Date = Model.Date; sale.Comments = Model.Comments; sale.CustomerPayment = Model.CustomerPayment; sale.DiscountAmt = Model.DiscountAmt; sale.Discount = Model.Discount; sale.SalesDetailsList = Model.SalesDetailsList; if (_salesManager.SaveSalesProduct(sale)) { if (_customerManager.Update(aCustomer)) { var customersList = _customerManager.FindAll(); ViewBag.Customers = new SelectList(customersList, "Id", "CustName"); var products = _productManager.GetProducts(); ViewBag.Products = new SelectList(products, "ProductId", "ProductName"); ViewBag.SuccessMsg = "Data Saved SuccessFully!"; return(View()); } } else { ViewBag.FailMsg = "Data Saved Fail!"; } } catch (Exception EX) { ViewBag.FailMsg = "Something went wrong"; } //var salesModel = new List<SalesDetails>(); //if (ModelState.IsValid) //{ // // Model.CustomerModelsId = 1; // int CustId = Model.CustomerModelsId; // foreach (var value in Model.SalesDetailsList) // { // salesModel.Add(value); // } // if (_salesManager.Save(salesModel)) // { // ViewBag.SuccessMsg = "Data Saved SuccessFully!"; // } // else // { // ViewBag.FailMsg = "Data Saved Fail!"; // } //} //Model.ProductList = _productManager.GetAll() // .Select(c => new SelectListItem() // { // Value = c.ID.ToString(), // Text = c.Name // }).ToList(); //var customers = _customerManager.FindAll(); //ViewBag.Customers = new SelectList(customers, "Id", "CustName"); //var products = _productManager.GetAll(); //ViewBag.Products = new SelectList(products, "ID", "Name"); return(View(Model)); }
// GET: CustomerMaster public ActionResult Index() { List<CustomerModel> custs = new List<CustomerModel>(); CustomerModel cm = new CustomerModel(); custs = cm.GetAllCusts(); return View(custs); }
public bool PostIdentification(IdentificationModel model, int cid) { var contact = _contactDal.Query <ContactInfoEntity>(a => a.PCid == cid).FirstOrDefault(); if (contact == null) { throw new Exception("当前客户信息异常,不能修改"); } if (model.IsDefault == 1) { contact.DefaultIdentificationId = model.Iid; _contactDal.Update <ContactInfoEntity>(contact, new string[] { "DefaultIdentificationId" }); } else { if (contact.DefaultIdentificationId.HasValue && contact.DefaultIdentificationId.Value == model.Iid) { contact.DefaultIdentificationId = 0; _contactDal.Update <ContactInfoEntity>(contact, new string[] { "DefaultIdentificationId" }); } } model.ContactId = contact.Contactid; //判断当前公司下,是否存在相同证件,如果存在,则不许修改 CustomerModel customerModel = _getCustomerBll.GetCustomerByCid(cid); if (!string.IsNullOrEmpty(customerModel.CorpID)) { List <CustomerModel> customerModels = _getCustomerBll.GetCustomerByCorpId(customerModel.CorpID); List <int> cidList = new List <int>(); customerModels.ForEach(n => { if (n.Cid != cid) { cidList.Add(n.Cid); } }); List <ContactInfoEntity> contactInfoEntities = _contactDal.Query <ContactInfoEntity>(a => cidList.Contains(a.PCid ?? 0)).ToList(); List <int> contactIdList = new List <int>(); contactInfoEntities.ForEach(n => contactIdList.Add(n.Contactid)); List <ContactIdentificationInfoEntity> infoList = _contactIdentificationDal.Query <ContactIdentificationInfoEntity>( n => contactIdList.Contains(n.Contactid) && !string.IsNullOrEmpty(n.CardNo) && n.CardNo.ToUpper() == model.CardNo.ToUpper() && n.Iid == model.Iid) .ToList(); if (infoList != null && infoList.Count > 0) { throw new Exception("当前公司存在相同证件号,不能修改"); } } var identifications = _contactIdentificationDal.Query <ContactIdentificationInfoEntity>(a => a.Contactid == model.ContactId && a.Iid == model.Iid); var entity = Mapper.Map <IdentificationModel, ContactIdentificationInfoEntity>(model); entity.LastUpdateTime = DateTime.Now; entity.CardNo = entity.CardNo ?? ""; if (identifications != null && identifications.Any()) { _contactIdentificationDal.Update <ContactIdentificationInfoEntity>(entity); } else { _contactIdentificationDal.Insert <ContactIdentificationInfoEntity>(entity); } return(true); }
internal void Update(CustomerModel customer) { throw new NotImplementedException(); }
public async Task <IActionResult> Add([FromBody] CustomerModel _model) { var result = await busCustomer.Add(_model); return(Ok(context.WrapResponse(result))); }
public async Task <IActionResult> Edit(CustomerModel model) { return(await SaveCustomer(model)); }
public RecruitmentModel() { customer = new CustomerModel(); }
/// <summary> /// Maps customer model object to customer data transfer object. /// </summary> /// <param name="customer">Customer model object.</param> /// <returns>Customer data transfer object.</returns> internal static Customer ToDataTransferObject(CustomerModel customer) { return new Customer { CustomerId = customer.CustomerId, Company = customer.Company, City = customer.City, Country = customer.Country, Version = customer.Version }; }
public bool Create(CustomerModel model) { return(_res.Create(model)); }
public IHttpActionResult UpdateCustomer(CustomerModel customerToUpdate) { var entity = new Customer() { CustomerID = customerToUpdate.CustomerID, Address = customerToUpdate.Address, City = customerToUpdate.City, CompanyName = customerToUpdate.CompanyName, ContactName = customerToUpdate.ContactName, ContactTitle = customerToUpdate.ContactTitle, Country = customerToUpdate.Country, Fax = customerToUpdate.Fax, Phone = customerToUpdate.Phone, PostalCode = customerToUpdate.PostalCode, Region = customerToUpdate.Region }; _repository.UpdateCustomer(entity); return Ok<CustomerModel>(customerToUpdate); }
public IActionResult SignIn(CustomerModel model) { return(RedirectToAction(nameof(Auth))); }
protected void loadData() { string currentFilter ; if (IsPostBack == false) { Session["cust_filter"] = ""; currentFilter = ""; } else currentFilter = (string)Session["cust_filter"]; //this.scriptLb.Text = currentFilter; CustomerParser newParser = new CustomerParser(); this.dataModel = new CustomerModel(this.gvCustomers, @".\SQL2008", 1433, "TSQLFundamentals2008","sa", "123456", "Sales.Customers", newParser); newParser.DataModel = this.dataModel; try { this.dataModel.resetControl(currentFilter); } catch(Exception ex) { Session["current_error"] = ex.Message; Response.Redirect("serverError.aspx"); } }
public Guid Add(CustomerModel model) { var service = _serviceProvider.Provide <IEntityAddService <CustomerEntity, CustomerPropertyValueEntity> >(); return(service.Add(model)); }
public JsonResult GetCustomerList() { List <CustomerModel> CustomerList = new List <CustomerModel>(); try { Customer_List_Page_Service co = new Customer_List_Page_Service(); co.Credentials = new System.Net.NetworkCredential(Uname, Pwd); List <Customer_List_Page_Filter> custList1 = new List <Customer_List_Page_Filter>(); Customer_List_Page_Filter custList = new Customer_List_Page_Filter(); //custList.Field = Customer_List_Page_Fields.; //custList.Criteria = "HHP"; //custList1.Add(custList); Customer_List_Page_Filter custList2 = new Customer_List_Page_Filter(); //custList2.Field = Customer_List_Page_Fields.Global_Dimension_2_Code; //custList2.Criteria = "CHD ZKR"; //custList1.Add(custList2); Customer_List_Page[] customer = co.ReadMultiple(custList1.ToArray(), "", 10000); foreach (var obj in customer) { CustomerModel cm = new CustomerModel(); cm.Customer_No = obj.No; cm.Description = obj.Name; cm.Balance = obj.Balance_LCY.ToString(); cm.Blocked = obj.Blocked.ToString(); cm.Sale_Person_Code = Convert.ToString(obj.Salesperson_Code) != null?Convert.ToString(obj.Salesperson_Code) : ""; cm.FarmerLocation = Convert.ToString(obj.Farmer_Location) != null?Convert.ToString(obj.Farmer_Location) : ""; cm.CustomerType = Convert.ToString(obj.Customer_Type) != null?Convert.ToString(obj.Customer_Type) : ""; cm.CreditLimit = Convert.ToString(obj.Credit_Limit_LCY) != null?Convert.ToString(obj.Credit_Limit_LCY) : ""; cm.Address = Convert.ToString(obj.Address) != null?Convert.ToString(obj.Address) : ""; cm.Address2 = Convert.ToString(obj.Address_2) != null?Convert.ToString(obj.Address_2) : ""; cm.City = Convert.ToString(obj.City) != null?Convert.ToString(obj.City) : ""; cm.PostCode = Convert.ToString(obj.Post_Code) != null?Convert.ToString(obj.Post_Code) : ""; cm.Country_RegionCode = Convert.ToString(obj.Country_Region_Code) != null?Convert.ToString(obj.Country_Region_Code) : ""; cm.PhoneNo = Convert.ToString(obj.Phone_No) != null?Convert.ToString(obj.Phone_No) : ""; cm.Email_id = Convert.ToString(obj.E_Mail) != null?Convert.ToString(obj.E_Mail) : ""; cm.LanguageCode = Convert.ToString(obj.Language_Code) != null?Convert.ToString(obj.Language_Code) : ""; cm.VatRegistrationCode = Convert.ToString(obj.VAT_Registration_No) != null?Convert.ToString(obj.VAT_Registration_No) : ""; cm.GLN = Convert.ToString(obj.GLN) != null?Convert.ToString(obj.GLN) : ""; cm.GenBusPostingSetup = Convert.ToString(obj.Gen_Bus_Posting_Group) != null?Convert.ToString(obj.Gen_Bus_Posting_Group) : ""; cm.VatBusPostingSetup = Convert.ToString(obj.VAT_Bus_Posting_Group) != null?Convert.ToString(obj.VAT_Bus_Posting_Group) : ""; cm.CustomerPostingSetup = Convert.ToString(obj.Customer_Posting_Group) != null?Convert.ToString(obj.Customer_Posting_Group) : ""; cm.CurrencyCode = Convert.ToString(obj.Currency_Code) != null?Convert.ToString(obj.Currency_Code) : ""; cm.LocationCode = Convert.ToString(obj.Location_Code) != null?Convert.ToString(obj.Location_Code) : ""; cm.RemainingCrLimit = Convert.ToString(obj.Remaining_Credit_Limit) != null?Convert.ToString(obj.Remaining_Credit_Limit) : ""; CustomerList.Add(cm); } } catch { } return(Json(CustomerList, JsonRequestBehavior.AllowGet)); }
public async Task <IActionResult> Modify(int _id, [FromBody] CustomerModel _model) { var result = await busCustomer.Modify(_id, _model); return(Ok(context.WrapResponse(result))); }