public void CopyToTest() { var member = Builder<DJ_TourGroupMember>.CreateNew().Do(x=>x.IdCardNo="cc").Build(); var newMember = new DJ_TourGroupMember(); member.CopyTo(newMember); Assert.AreEqual("cc", newMember.IdCardNo); }
protected void btnSaveMember_Click(object s, EventArgs e) { currentGroupMember = (DJ_TourGroupMember)Session["currentMember"]; if (currentGroupMember == null) { currentGroupMember = new DJ_TourGroupMember(); } UpdateMemberForm(); bllGroupMember.SaveOrUpdate(currentGroupMember); LoadData(); Session["currentMember"] = null; pnlMemberEdit.Visible = false; btnAddMember.Visible = true; // ScriptManager.RegisterClientScriptBlock(this, this.GetType(), "savesuc", "alert('保存成功')", true); }
public void SerializeMember() { DJ_TourGroupMember member = new DJ_TourGroupMember(); string errMsg; //11111111111 类型,姓名,电话 string formatedstring = "成人游客,小明,14093039130"; member= SerializationModel.SerializeMember(formatedstring, out errMsg); Assert.AreEqual(MemberType.成, member.MemberType); Assert.AreEqual("小明", member.RealName); Assert.AreEqual("14093039130", member.PhoneNum); //11111111111 类型,姓名,身份证 string formatedstring1 = "成人游客,小明,420822198010103916"; member = SerializationModel.SerializeMember(formatedstring1, out errMsg); Assert.AreEqual(MemberType.成, member.MemberType); Assert.AreEqual("小明", member.RealName); Assert.AreEqual("420822198010103916", member.IdCardNo); //11111111111 类型,姓名,其他证件 string formatedstring11 = "成人游客,小明,W345342363"; member = SerializationModel.SerializeMember(formatedstring11, out errMsg); Assert.AreEqual(MemberType.成, member.MemberType); Assert.AreEqual("小明", member.RealName); Assert.AreEqual("W345342363", member.SpecialCardNo); ///22222222 类型,姓名 身份证 电话 string formatedstring2 = "成人游客,小明,420822198010103916,13920291023"; member = SerializationModel.SerializeMember(formatedstring2, out errMsg); Assert.AreEqual(MemberType.成, member.MemberType); Assert.AreEqual("小明", member.RealName); Assert.AreEqual("420822198010103916", member.IdCardNo); Assert.AreEqual("13920291023", member.PhoneNum); //3333333333类型 姓名,其他证件,电话 string formatedstring3 = "成人游客,小明,W23432rewq34,13920291023"; member = SerializationModel.SerializeMember(formatedstring3, out errMsg); Assert.AreEqual(MemberType.成, member.MemberType); Assert.AreEqual("小明", member.RealName); Assert.AreEqual("W23432rewq34", member.SpecialCardNo); Assert.AreEqual("13920291023", member.PhoneNum); }
private string GenerateSimpleString( DJ_TourGroupMember member) { System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append(member.MemberType); sb.Append("\\"); sb.Append(member.RealName); sb.Append("\\"); if (!string.IsNullOrEmpty(member.IdCardNo)) { sb.Append(member.IdCardNo); sb.Append("\\"); } if (!string.IsNullOrEmpty(member.SpecialCardNo)) { sb.Append(member.SpecialCardNo); sb.Append("\\"); } sb.Append(member.PhoneNum); return sb.ToString(); }
public virtual void CopyTo(DJ_TourGroup newGroup, bool copyMember) { newGroup.Name = Name + "[复制]"; newGroup.BeginDate = BeginDate; newGroup.DaysAmount = DaysAmount; newGroup.EndDate = BeginDate.AddDays(DaysAmount - 1); newGroup.DijiesheEditor = DijiesheEditor; newGroup.DJ_DijiesheInfo = DJ_DijiesheInfo; foreach (DJ_Route r in Routes) { DJ_Route newRoute = new DJ_Route(); r.CopyTo(newRoute); newRoute.DJ_TourGroup = newGroup; newGroup.Routes.Add(newRoute); } //foreach (DJ_Group_Worker worker in Workers) //{ // newGroup.Workers.Add(worker); //} if (copyMember) { foreach (DJ_TourGroupMember member in Members) { DJ_TourGroupMember newMember = new DJ_TourGroupMember(); member.CopyTo(newMember); newGroup.Members.Add(newMember); } } }
public Model.DJ_TourGroupMember ConvertToMember(JToken t) { List<string> ro = new List<string>(); if (t.GetType() == typeof(JArray)) { JArray ja = (JArray)t; foreach (JToken jt in ja) { ro.Add(jt.ToString()); } } else//jtoken { for (int i = 0; i <= 5; i++) { ro.Add(t[i.ToString()].ToString()); } } Model.DJ_TourGroupMember member = new DJ_TourGroupMember(); string memberId = ro[5]; if (!string.IsNullOrEmpty(memberId)) { member = bllGroupMember.GetOne(Guid.Parse(memberId)); } member.IdCardNo = ro[3]; member.PhoneNum = ro[2]; member.RealName = ro[1]; member.SpecialCardNo = ro[4]; member.MemberType = (MemberType)Enum.Parse(typeof(MemberType), ro[0]); return member; }
private DJ_TourGroup CreateDemoGroup(DateTime beginTime) { DJ_TourGroup group = new DJ_TourGroup(); group.BeginDate = beginTime; group.DJ_DijiesheInfo = (Model.DJ_DijiesheInfo)demoDjs1; group.DaysAmount =2; group.EndDate = beginTime.AddDays(group.DaysAmount); DJ_TourGroupMember member1 = new DJ_TourGroupMember(); member1.DJ_TourGroup = group; member1.IdCardNo = "210905197807210546"; member1.MemberType = MemberType.成; member1.PhoneNum = "13280008000"; member1.RealName = "张三"; DJ_TourGroupMember member2 = new DJ_TourGroupMember(); member2.DJ_TourGroup = group; member2.IdCardNo = "210905197807210546"; member2.MemberType = MemberType.儿; member2.PhoneNum = "13280008000"; member2.RealName = "张小明"; DJ_TourGroupMember member3 = new DJ_TourGroupMember(); member3.DJ_TourGroup = group; member3.SpecialCardNo = "证件号:HK0930234"; member3.MemberType = MemberType.港澳台; member3.PhoneNum = "13280008000"; member3.RealName = "张学友"; DJ_TourGroupMember member4 = new DJ_TourGroupMember(); member4.DJ_TourGroup = group; member4.SpecialCardNo = "证件号:019203493l"; member4.MemberType = MemberType.外; member4.PhoneNum = "13280008000"; member4.RealName = "Carl Smith"; // group.Workers.Add(gwmembersiji); // group.Workers.Add(gwmemberdaoyou); group.Members.Add(member1); group.Members.Add(member2); group.Members.Add(member3); group.Members.Add(member4); group.Name = demoGroupNamePrefix+ Math.Abs(Guid.NewGuid().GetHashCode()).ToString().Substring(0, 6); DJ_Route route1 = new DJ_Route(); route1.DayNo = 1; route1.Description = "住宿"; route1.DJ_TourGroup = group; route1.Enterprise = demoHotel1; DJ_Route route11 = new DJ_Route(); route11.DayNo = 1; route11.Description = "景点"; route11.DJ_TourGroup = group; route11.Enterprise = demoScenic1; DJ_Route route111 = new DJ_Route(); route111.DayNo = 1; route111.Description = "景点"; route111.DJ_TourGroup = group; route111.Enterprise = demoScenic2; DJ_Route route2 = new DJ_Route(); route2.DayNo = 2; route2.Description = "景点"; route2.DJ_TourGroup = group; route2.Enterprise = demoScenic3; //group.Routes group.Routes.Add(route1); group.Routes.Add(route2); group.Routes.Add(route11); group.Routes.Add(route111); group.DijiesheEditor =(DJ_User_TourEnterprise) new BLLMembership().GetMember(dijiesheAdminAcount1); return group; }
protected void rptMembers_ItemCommand(object sender, RepeaterCommandEventArgs e) { currentGroupMember = bllGroupMember.GetOne(new Guid(e.CommandArgument.ToString())); if (e.CommandName.ToLower() == "edit") { Session["currentMember"] = currentGroupMember; pnlMemberEdit.Visible = true; LoadMemberForm(); btnAddMember.Visible = false; } if (e.CommandName.ToLower() == "delete") { CurrentGroup.Members.Remove(currentGroupMember); bllGroup.Save(CurrentGroup); LoadData(); } }
public virtual void CopyTo(DJ_TourGroupMember newMember) { newMember.Gender = Gender; newMember.IdCardNo = IdCardNo; newMember.MemberType = MemberType; newMember.PhoneNum = PhoneNum; newMember.RealName = RealName; newMember.SpecialCardNo = SpecialCardNo; }