public void BuildDemoDeta() { //创建工作人员 SaveWorkers(); List<DJ_TourGroup> Groups = new List<DJ_TourGroup>(); for (int i = 1; i <= 12; i++) { DateTime beginDate = DateTime.Now.AddMonths(i - 12); DJ_TourGroup g1 = CreateDemoGroup(beginDate); bllGroup.Save(g1); DJ_Group_Worker gwmemberdaoyou1 = new DJ_Group_Worker(); gwmemberdaoyou1.DJ_TourGroup = g1; gwmemberdaoyou1.DJ_Workers = memberdaoyou; bllGW.Save(gwmemberdaoyou1); DJ_TourGroup g2 = new DJ_TourGroup(); g1.CopyTo(g2); g2.DJ_DijiesheInfo =(DJ_DijiesheInfo) demoDjs2; g2.DijiesheEditor = (DJ_User_TourEnterprise)new BLLMembership().GetMember(dijiesheAdminAcount2); // g2.Workers.Add(memberdaoyou); g2.Name = demoGroupNamePrefix + Guid.NewGuid().GetHashCode().ToString().Substring(0, 6); DJ_Group_Worker gwmemberdaoyou = new DJ_Group_Worker(); gwmemberdaoyou.DJ_TourGroup = g2; gwmemberdaoyou.DJ_Workers = memberdaoyou2; bllGroup.Save(g2); bllGW.Save(gwmemberdaoyou); Groups.Add(g2); Groups.Add(g1); } //刷卡.验票 foreach (DJ_TourGroup g in Groups) { //只对过去的验票. if (g.BeginDate> DateTime.Now) { continue; } foreach (DJ_Route r in g.Routes) { Model.DJ_GroupConsumRecord cr = new DJ_GroupConsumRecord(); cr.Route = r; cr.AdultsAmount = r.DJ_TourGroup.AdultsAmount; cr.ChildrenAmount = r.DJ_TourGroup.ChildrenAmount; cr.ConsumeTime = r.DJ_TourGroup.BeginDate.AddDays(r.DayNo); cr.Enterprise = r.Enterprise; cr.LiveDay = g.DaysAmount; cr.RoomNum = 2; bllConsum.DAL.Save(cr); } } }
public bool UpdateForm(DJ_TourGroup CurrentGroup,string groupName,string beginDate, string daysAmount, DJ_DijiesheInfo CurrentDJS, DJ_User_TourEnterprise CurrentMember,IList<string> workerIds, out string errMsg) { errMsg = string.Empty; CurrentGroup.Name = groupName; CurrentGroup.BeginDate = Convert.ToDateTime(beginDate); if (CurrentGroup.BeginDate.DayOfYear < DateTime.Now.DayOfYear) { errMsg = "开始时间不能小于当天时间"; return false; } int iDayAmount=Convert.ToInt32(daysAmount); //if (CurrentGroup.DaysAmount>iDayAmount) //{ // errMsg = string.Format("操作无法完成:当前输入的天数({1})小于已录入行程的天数({0}).为保证数据安全,输入天数应该大于等于已录入行程天数.请修改数字,或者在行程编辑页面删除部分行程.", CurrentGroup.DaysAmount, iDayAmount); // return false; //} //for (int i = 0; i < iDayAmount; i++) //{ // DJ_Route r = new DJ_Route(); // r.DayNo = i + 1; // r.DJ_TourGroup = CurrentGroup; // CurrentGroup.Routes.Add(r); //} CurrentGroup.DaysAmount = iDayAmount; CurrentGroup.EndDate = CurrentGroup.BeginDate.AddDays(CurrentGroup.DaysAmount - 1); CurrentGroup.DJ_DijiesheInfo = CurrentDJS; CurrentGroup.DijiesheEditor = (DJ_User_TourEnterprise)CurrentMember; ///司机和导游 bool hasSelectGuide = false; bool hasSelectDriver = false; bllGroupWorker.DeleteFromGroup(CurrentGroup); IList<DJ_Workers> workers = new List<DJ_Workers>(); foreach(string workerId in workerIds) { Model.DJ_Group_Worker gw = new DJ_Group_Worker(); hasSelectGuide = true; DJ_Workers worker = bllWorker.GetOne(new Guid(workerId)); if (worker.WorkerType == DJ_GroupWorkerType.司机) { hasSelectDriver = true; } if (worker.WorkerType == DJ_GroupWorkerType.导游) { hasSelectGuide = true; } gw.DJ_Workers = worker; gw.DJ_TourGroup = CurrentGroup; gw.RD_WorkerName = worker.Name; gw.RD_WorkerIdCard = worker.IDCard; gw.RD_Phone = worker.Phone; bllGroupWorker.Save(gw); } if (!hasSelectGuide) { errMsg = "必须指定导游"; return false; } if (!hasSelectDriver) { errMsg = "必须指定司机"; return false; } //路线信息 return true; }