/// <summary> /// 获取数据 /// </summary> /// <param name="customer"></param> private void FaceToData(ref Customer customer) { if (customer == null) { return; } customer.Name = this.NameId.Text; customer.ShortName = this.ShortName.Text; customer.Cagegory = FindCategoryItem(this.CagegoryTypeId.SelectedValue); customer.Car = this.CarId.Text; customer.Code = this.Code.Text; customer.CreditRating = FindCategoryItem(CreditRatingID.SelectedValue); customer.CustomerType = this.FindCategoryItem(this.CustomerTypeItemId.SelectedValue); customer.AccType = this.IdentificationID.SelectedValue == "1" ? CustomerIdentification.Enterprise : CustomerIdentification.Person; customer.Area = this.FindCategoryItem(this.AreaId.SelectedValue); customer.Company = this.CurrentCompany; customer.Remark = this.RemarkID.Text; customer.CreatePerson = this.CurrentOperatorUser; customer.ImportantLevel = this.ImportantLevelId.SelectedValue.Convert<ImportantLevel>(); customer.LevelSort = this.FindCategoryItem(this.LevelSort.SelectedValue); customer.RelationLevel = this.FindCategoryItem(this.RelationLevelID.SelectedValue); if (this.BelongPersonID.SelectedValue.IsInt()) { customer.BelongPerson = DependencyResolver.Resolver<IUserInfoService>().FindById(int.Parse(this.BelongPersonID.SelectedValue)); } customer.ModifyTime = DateTime.Now; customer.MemberCard = DependencyResolver.Resolver<IMembershipCardService>().FindByCode(this.MemberCardID.Text); customer.CustomerBusiness = AspNetHelper.GetItemByDropDownValue(this.CustomerBusinessID); customer.CustomerSource = AspNetHelper.GetItemByDropDownValue(this.CustomerSourceID); }
public void CustomerTest() { Customer customer = new Customer(); customer.BelongPerson = this._operatorUser; customer.Car = "浙A H012413"; customer.Cagegory = FindByCategoryCodeAndItemName("CustomerType", "一般意向"); // 一般意向 customer.Name = "李红"; customer.CreditRating = this.FindByCategoryCodeAndItemName("CreditRating", "A"); customer.AccType = CustomerIdentification.Person; customer.TotalScore = 0; customer.LastSpendDate = null; customer.CreatePerson = this._operatorUser; CustomerInfo customerInfo = new CustomerInfo() { Addr = "浙江好", CreateTime = DateTime.Now, Deleted = false, Email = "*****@*****.**", EmailAuth = false, IdCard = "100000000" }; customerInfo.BirthDate = System.DateTime.Now.AddDays(-30); customerInfo.Customer = customer; _customerService.Save(customer); DependencyResolver.Resolver<ICustomerInfoService>().Save(customerInfo); }
/// <summary> /// 显示数据 /// </summary> /// <param name="customer"></param> private void DataToFace(Customer customer) { if (customer == null) { // 新增 初始化数据 this.CreateTime.Text = DateTime.Now.ToShortDateString(); //this.CreatePerson.Text = this.CurrentOperatorUser.OperatorName; //this.BodyWeightID.Text = "0"; //this.HeightID.Text = "0"; if (string.IsNullOrEmpty(this.Code.Text)) { this.GetCutomerId_Click(null, null); } return; } this.NameId.Text = customer.Name; this.ShortName.Text = customer.ShortName; this.RemarkID.Text = customer.Remark; this.CreateTime.Text = customer.CreateTime.ToShortDateString(); if (customer.Cagegory != null) { this.CagegoryTypeId.SelectedValue = customer.Cagegory.Id.ToString(); } this.CarId.Text = customer.Car; this.Code.Text = customer.Code; if (customer.MemberCard != null) { MemberCardID.Text = customer.MemberCard.CardCode; } if (customer.CreditRating != null) { CreditRatingID.SelectedValue = customer.CreditRating.Id.ToString(); } if (customer.CustomerType != null && customer.CustomerType.ParentItem != null) { CustomerTypeParentId.SelectedValue = customer.CustomerType.ParentItem.Id.ToString(); this.CustomerTypeParentId_SelectedIndexChanged(null, null); // 加载子类ID this.CustomerTypeItemId.SelectedValue = customer.CustomerType.Id.ToString(); } this.IdentificationID.SelectedValue = customer.AccType == CustomerIdentification.Enterprise ? "1" : "0"; this.ImportantLevelId.SelectedValue = ((int)customer.ImportantLevel).ToString(); AspNetHelper.SetDropDownSelectedvalue(LevelSort, customer.LevelSort); AspNetHelper.SetDropDownSelectedvalue(RelationLevelID, customer.RelationLevel); if (customer.BelongPerson != null) { this.BelongPersonID.SelectedValue = customer.BelongPerson.Id.ToString(); } if (customer.MemberCard != null) { this.MemberCardID.Text = customer.MemberCard.CardCode; } if (customer.Area != null) { if (customer.Area.ParentItem != null) { this.AreaParentId.SelectedValue = customer.Area.ParentItem.Id.ToString(); this.AreaParentId_SelectedIndexChanged(null, null); } this.AreaId.SelectedValue = customer.Area.Id.ToString(); } AspNetHelper.SetDropDownSelectedvalue(this.CustomerBusinessID,customer.CustomerBusiness); AspNetHelper.SetDropDownSelectedvalue(this.CustomerSourceID,customer.CustomerSource); }
private void PrintCustomer(Customer customer) { }