public void Should_have_error_when_zippostalcode_is_null_or_empty_based_on_required_setting()
        {
            var model = new CustomerInfoModel();

            //required
            var validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                                                      new CustomerSettings
            {
                ZipPostalCodeEnabled  = true,
                ZipPostalCodeRequired = true
            });

            model.ZipPostalCode = null;
            validator.ShouldHaveValidationErrorFor(x => x.ZipPostalCode, model);
            model.ZipPostalCode = "";
            validator.ShouldHaveValidationErrorFor(x => x.ZipPostalCode, model);


            //not required
            validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                                                  new CustomerSettings
            {
                ZipPostalCodeEnabled  = true,
                ZipPostalCodeRequired = false
            });
            model.ZipPostalCode = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.ZipPostalCode, model);
            model.ZipPostalCode = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.ZipPostalCode, model);
        }
Exemple #2
0
        public IHttpActionResult Payment(string SessionId, CustomerInfoModel CustomerInfo)
        {
            var customer_cart = Utilities._shopingCarts.FirstOrDefault(cart => cart.SessionId == SessionId);

            customer_cart.CustomerInfo = CustomerInfo;
            return(Ok());
        }
Exemple #3
0
        public ProcessRequestAssignIPViewModel()
        {
            CustomerInfo = new CustomerInfoModel();
            RequestInfo  = new RequestInfoModel();

            StaffCodeOptions = new List <SelectListItem>();
        }
        public void Should_have_error_when_fax_is_null_or_empty_based_on_required_setting()
        {
            var model = new CustomerInfoModel();

            //required
            var validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                                                      new CustomerSettings
            {
                FaxEnabled  = true,
                FaxRequired = true
            });

            model.Fax = null;
            validator.ShouldHaveValidationErrorFor(x => x.Fax, model);
            model.Fax = "";
            validator.ShouldHaveValidationErrorFor(x => x.Fax, model);


            //not required
            validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                                                  new CustomerSettings
            {
                FaxEnabled  = true,
                FaxRequired = false
            });
            model.Fax = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.Fax, model);
            model.Fax = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.Fax, model);
        }
        public void ShouldHaveErrorWhenLastNameIsNullOrEmpty()
        {
            var model = new CustomerInfoModel();

            //required
            var validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                                                      new CustomerSettings
            {
                LastNameEnabled  = true,
                LastNameRequired = true
            });

            model.LastName = null;
            validator.ShouldHaveValidationErrorFor(x => x.LastName, model);
            model.LastName = string.Empty;
            validator.ShouldHaveValidationErrorFor(x => x.LastName, model);

            //not required
            validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                                                  new CustomerSettings
            {
                LastNameEnabled  = true,
                LastNameRequired = false
            });
            model.LastName = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.LastName, model);
            model.LastName = string.Empty;
            validator.ShouldNotHaveValidationErrorFor(x => x.LastName, model);
        }
        public void ShouldHaveErrorWhenCompanyIsNullOrEmptyBasedOnRequiredSetting()
        {
            var model = new CustomerInfoModel();

            //required
            var validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                                                      new CustomerSettings
            {
                CompanyEnabled  = true,
                CompanyRequired = true
            });

            model.Company = null;
            validator.ShouldHaveValidationErrorFor(x => x.Company, model);
            model.Company = string.Empty;
            validator.ShouldHaveValidationErrorFor(x => x.Company, model);

            //not required
            validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                                                  new CustomerSettings
            {
                CompanyEnabled  = true,
                CompanyRequired = false
            });
            model.Company = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.Company, model);
            model.Company = string.Empty;
            validator.ShouldNotHaveValidationErrorFor(x => x.Company, model);
        }
        public ActionResult EditCustomer(int id)
        {
            var result = CustomerInfoRepo.getCustomerByID(id);

            if (result.HasError)
            {
            }

            var model = new CustomerInfoModel()
            {
                Address         = result.Data.UserInfo.Address,
                Email           = result.Data.UserInfo.Email,
                UserCode        = result.Data.UserInfo.UserCode,
                UserName        = result.Data.UserInfo.UserName,
                Name            = result.Data.UserInfo.Name,
                ID              = id,
                IsActive        = result.Data.UserInfo.IsActive,
                UserTypeID      = result.Data.UserInfo.UserTypeID,
                ExtraBalance    = result.Data.ExtraBalance,
                Rate            = result.Data.Rate,
                SortedBalance   = result.Data.SortedBalance,
                UnSortedBalance = result.Data.UnsortedBalance,
                Value           = result.Data.Value
            };

            return(View(model));
        }
        public static AuthOrSaleRequestModel GetDummyAuthRequestModel()
        {
            var card        = new CreditCardModel();
            var transaction = new TransactionModel();

            var customer = new CustomerInfoModel
            {
                BillingAddress  = new BillingAddressModel(),
                ShippingAddress = new ShippingAddressModel()
            };

            var orderItem1 = new OrderItemModel();
            var orderItem2 = new OrderItemModel();
            var orderItems = new[] { orderItem1, orderItem2 };
            var order      = new OrderModel {
                OrderItems = orderItems
            };

            var request = new AuthOrSaleRequestModel
            {
                CreditCard   = card,
                CustomerInfo = customer,
                Transaction  = transaction,
                Order        = order
            };

            return(request);
        }
Exemple #9
0
 public CustomerInfoEvent(Customer customer, CustomerInfoModel model, IFormCollection form, IList <CustomAttribute> customerAttributes)
 {
     Customer           = customer;
     Model              = model;
     Form               = form;
     CustomerAttributes = customerAttributes;
 }
        public void Should_have_error_when_streetaddress2_is_null_or_empty_based_on_required_setting()
        {
            var model = new CustomerInfoModel();

            //required
            var validator = new CustomerInfoValidator(_localizationService,
                                                      new CustomerSettings()
            {
                StreetAddress2Enabled  = true,
                StreetAddress2Required = true
            });

            model.StreetAddress2 = null;
            validator.ShouldHaveValidationErrorFor(x => x.StreetAddress2, model);
            model.StreetAddress2 = "";
            validator.ShouldHaveValidationErrorFor(x => x.StreetAddress2, model);

            //not required
            validator = new CustomerInfoValidator(_localizationService,
                                                  new CustomerSettings()
            {
                StreetAddress2Enabled  = true,
                StreetAddress2Required = false
            });
            model.StreetAddress2 = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.StreetAddress2, model);
            model.StreetAddress2 = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.StreetAddress2, model);
        }
Exemple #11
0
        public ActionResult Customer()
        {
            var result = CustomerInfoRepo.loadCustomers();
            var model  = new List <CustomerInfoModel>();

            if (!result.HasError)
            {
                foreach (var v in result.Data)
                {
                    var cust = new CustomerInfoModel()
                    {
                        Address    = v.Address,
                        Email      = v.Email,
                        ID         = v.ID,
                        IsActive   = v.IsActive,
                        Name       = v.Name,
                        UserCode   = v.UserCode,
                        UserName   = v.UserName,
                        UserTypeID = v.UserTypeID
                    };
                    model.Add(cust);
                }
            }
            if (TempData["trash"] != null)
            {
                ViewBag.Success = TempData["trash"];
            }
            if (TempData["trashError"] != null)
            {
                ViewBag.Error = TempData["trashError"];
            }
            return(View(model));
        }
        public void Should_have_error_when_phone_is_null_or_empty_based_on_required_setting()
        {
            var model = new CustomerInfoModel();

            //required
            var validator = new CustomerInfoValidator(_localizationService,
                                                      new CustomerSettings()
            {
                PhoneEnabled  = true,
                PhoneRequired = true
            });

            model.Phone = null;
            validator.ShouldHaveValidationErrorFor(x => x.Phone, model);
            model.Phone = "";
            validator.ShouldHaveValidationErrorFor(x => x.Phone, model);

            //not required
            validator = new CustomerInfoValidator(_localizationService,
                                                  new CustomerSettings()
            {
                PhoneEnabled  = true,
                PhoneRequired = false
            });
            model.Phone = null;
            validator.ShouldNotHaveValidationErrorFor(x => x.Phone, model);
            model.Phone = "";
            validator.ShouldNotHaveValidationErrorFor(x => x.Phone, model);
        }
Exemple #13
0
        public ActionResult _SearchCustomer(CustomerInfoModel model)
        {
            var list = (from c in _context.CustomerModel
                        // join e in _context.EmployeeModel on c.EmployeeId equals e.EmployeeId
                        //  join cs in _context.CustomerLevelModel on c.CustomerLevelId equals cs.CustomerLevelId
                        where (model.FullName == null || c.FullName.Contains(model.FullName))
                        //&& (model.EmployeeId == null || e.EmployeeId == model.EmployeeId)
                        //&& (model.CustomerLevelId == null || cs.CustomerLevelId == model.CustomerLevelId)
                        && (model.Phone == null || c.Phone.Contains(model.Phone)) &&
                        c.Actived == true &&
                        (model.Gender == null || model.Gender == c.Gender) &&
                        (model.BirthDay == null || model.BirthDay == c.BirthDay)
                        select new CustomerInfoModel
            {
                CustomerId = c.CustomerId,
                FullName = c.FullName,
                //CustomerLevelName = cs.CustomerLevelName,
                Gender = c.Gender,
                BirthDay = c.BirthDay,
                Email = c.Email,
                Phone = c.Phone,
                //EmployeeName = e.FullName,
                RegDate = c.RegDate
            }).OrderByDescending(p => p.CustomerId)
                       .ToList();

            return(PartialView(list));
        }
        public void ShouldHaveErrorWhenFaxIsNullOrEmptyBasedOnRequiredSetting()
        {
            var model = new CustomerInfoModel();

            //required
            var validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                                                      new CustomerSettings
            {
                FaxEnabled  = true,
                FaxRequired = true
            });

            model.Fax = null;
            validator.TestValidate(model).ShouldHaveValidationErrorFor(x => x.Fax);
            model.Fax = string.Empty;
            validator.TestValidate(model).ShouldHaveValidationErrorFor(x => x.Fax);

            //not required
            validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                                                  new CustomerSettings
            {
                FaxEnabled  = true,
                FaxRequired = false
            });
            model.Fax = null;
            validator.TestValidate(model).ShouldNotHaveValidationErrorFor(x => x.Fax);
            model.Fax = string.Empty;
            validator.TestValidate(model).ShouldNotHaveValidationErrorFor(x => x.Fax);
        }
        public void PublicVoidShouldHaveErrorWhenStreetAddress2IsNullOrEmptyBasedOnRequiredSetting()
        {
            var model = new CustomerInfoModel();

            //required
            var validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                                                      new CustomerSettings
            {
                StreetAddress2Enabled  = true,
                StreetAddress2Required = true
            });

            model.StreetAddress2 = null;
            validator.TestValidate(model).ShouldHaveValidationErrorFor(x => x.StreetAddress2);
            model.StreetAddress2 = string.Empty;
            validator.TestValidate(model).ShouldHaveValidationErrorFor(x => x.StreetAddress2);

            //not required
            validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                                                  new CustomerSettings
            {
                StreetAddress2Enabled  = true,
                StreetAddress2Required = false
            });
            model.StreetAddress2 = null;
            validator.TestValidate(model).ShouldNotHaveValidationErrorFor(x => x.StreetAddress2);
            model.StreetAddress2 = string.Empty;
            validator.TestValidate(model).ShouldNotHaveValidationErrorFor(x => x.StreetAddress2);
        }
        public ProcessRequestChangeIPViewModel()
        {
            CustomerInfo = new CustomerInfoModel();
            RequestInfo  = new RequestInfoModel();

            StaffCodeOptions = new List <SelectListItem>();
            NewIPsOptions    = new List <SelectListItem>();
        }
Exemple #17
0
        public void Should_not_have_error_when_email_is_correct_format()
        {
            var validator = new CustomerInfoValidator(new CustomerSettings());

            var model = new CustomerInfoModel();

            model.Email = "*****@*****.**";
            validator.ShouldNotHaveValidationErrorFor(x => x.Email, model);
        }
Exemple #18
0
        public void Should_not_have_error_when_lastName_is_specified()
        {
            var validator = new CustomerInfoValidator(new CustomerSettings());

            var model = new CustomerInfoModel();

            model.LastName = "Smith";
            validator.ShouldNotHaveValidationErrorFor(x => x.LastName, model);
        }
Exemple #19
0
        public CustomerInfoModel AttachCustomerAndAddress(CustomerModel customer, AddressModel address)
        {
            CustomerInfoModel newModel = new CustomerInfoModel();

            newModel.CustomerModelInfo = customer;
            newModel.AddressModelInfo  = address;


            return(newModel);
        }
Exemple #20
0
        protected virtual void PrepareCustomerInfoModel(CustomerInfoModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }
            var customerSetting = _settingService.GetCustomerSettings();

            model.EnabledModifyName = customerSetting.ModifyNickName;
        }
Exemple #21
0
        public ActionResult CreateInfoSheet(CustomerInfoModel customerInfo)
        {
            //use the submitted download token value to set a cookie in the response
            Response.AppendCookie(new HttpCookie("fileDownloadToken", customerInfo.DownloadToken));

            var file           = CreateFile();
            var outputFileName = string.Format("{0}_CustomerInfo.pdf", DateTime.Now.Ticks);

            return(File(file, "application/pdf", outputFileName));
        }
Exemple #22
0
        public void Should_not_have_error_when_firstName_is_specified()
        {
            var customerSettings = new CustomerSettings();
            var validator        = new CustomerInfoValidator(_localizationService, customerSettings);

            var model = new CustomerInfoModel();

            model.FirstName = "John";
            validator.ShouldNotHaveValidationErrorFor(x => x.FirstName, model);
        }
Exemple #23
0
        public void Should_have_error_when_email_is_wrong_format()
        {
            var customerSettings = new CustomerSettings();
            var validator        = new CustomerInfoValidator(_localizationService, customerSettings);

            var model = new CustomerInfoModel();

            model.Email = "adminexample.com";
            validator.ShouldHaveValidationErrorFor(x => x.Email, model);
        }
Exemple #24
0
        /// <summary>
        /// 添加客户
        /// </summary>
        /// <returns></returns>
        public ViewResult AddCustomerView()
        {
            Session["method"] = "N";
            SetEmployee();
            ViewBag.Store      = store;
            ViewBag.Employee   = employeeName;
            ViewBag.IsManager  = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否店长;
            ViewBag.IsDesigner = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否设计师;
            ViewBag.IsEmployee = storeEmployeesBLL.GetModel(p => p.ID == employeeID).是否销售;
            List <销售_店铺员工档案> employeeList     = storeEmployeesBLL.GetModels(p => true).ToList();
            SelectList       EmployeeListList = new SelectList(employeeList, "ID", "姓名");

            ViewBag.EmployeeOptions = EmployeeListList;

            var selectAgeList = new List <SelectListItem>()
            {
                new SelectListItem()
                {
                    Value = "90后", Text = "90后"
                }, new SelectListItem()
                {
                    Value = "85-90年代", Text = "85-90年代"
                }, new SelectListItem()
                {
                    Value = "80-85年代", Text = "80-85年代"
                }, new SelectListItem()
                {
                    Value = "70后", Text = "70后"
                }, new SelectListItem()
                {
                    Value = "70前", Text = "70前"
                }
            };

            ViewBag.AgeOptions = selectAgeList;

            var        productList            = productCodeBLL.GetModels(p => true).ToList();
            SelectList productSelectListItems = new SelectList(productList, "型号", "型号");

            ViewBag.ProductOptions = productSelectListItems;

            CustomerInfoModel model = new CustomerInfoModel
            {
                接待序号   = Guid.NewGuid().ToString("D"),
                制单日期   = DateTime.Now,
                出店时间   = DateTime.Now,
                进店时间   = DateTime.Now,
                预计使用时间 = DateTime.Now,
                接待日期   = DateTime.Now.ToString("d"),
                店铺     = store,
                接待人    = employeeName
            };

            return(View(model));
        }
        public void ShouldNotHaveErrorWhenEmailIsCorrectFormat()
        {
            var validator = GetService <CustomerInfoValidator>();

            var model = new CustomerInfoModel
            {
                Email = "*****@*****.**"
            };

            validator.ShouldNotHaveValidationErrorFor(x => x.Email, model);
        }
        public void ShouldHaveErrorWhenEmailIsWrongFormat()
        {
            var validator = GetService <CustomerInfoValidator>();

            var model = new CustomerInfoModel
            {
                Email = "adminexample.com"
            };

            validator.TestValidate(model).ShouldHaveValidationErrorFor(x => x.Email);
        }
Exemple #27
0
        public void Should_have_error_when_email_is_null_or_empty()
        {
            var validator = new CustomerInfoValidator(new CustomerSettings());

            var model = new CustomerInfoModel();

            model.Email = null;
            validator.ShouldHaveValidationErrorFor(x => x.Email, model);
            model.Email = "";
            validator.ShouldHaveValidationErrorFor(x => x.Email, model);
        }
Exemple #28
0
        public void Should_have_error_when_lastName_is_null_or_empty()
        {
            var customerSettings = new CustomerSettings();
            var validator        = new CustomerInfoValidator(_localizationService, customerSettings);

            var model = new CustomerInfoModel();

            model.LastName = null;
            validator.ShouldHaveValidationErrorFor(x => x.LastName, model);
            model.LastName = "";
            validator.ShouldHaveValidationErrorFor(x => x.LastName, model);
        }
Exemple #29
0
 protected void PrepareCustomerInfoModel(CustomerInfoModel model, Customer customer)
 {
     model.Id            = customer.Id;
     model.FirstName     = customer.FirstName;
     model.LastName      = customer.LastName;
     model.Email         = customer.Email;
     model.ZipPostalCode = customer.ZipPostalCode;
     model.PhoneNumber   = customer.PhoneNumber;
     model.City          = customer.City;
     model.Address1      = customer.Address1;
     model.Address2      = customer.Address2;
 }
        public void Should_not_have_error_when_firstName_is_specified()
        {
            var validator = new CustomerInfoValidator(_localizationService, _stateProvinceService,
                                                      new CustomerSettings());

            var model = new CustomerInfoModel
            {
                FirstName = "John"
            };

            validator.ShouldNotHaveValidationErrorFor(x => x.FirstName, model);
        }