/// <summary> /// 保存用户 /// </summary> /// <param name="inObj"></param> /// <returns></returns> public async Task <ResultObj <int> > saveUser(WxUserEntity inObj, List <string> saveFieldList) { ResultObj <int> resultObj = new ResultObj <int>(); var saveEnt = new DtoSave <WxUserEntity>() { data = inObj }; string openid = inObj.openid; if (await dbHelper_user.Count(x => x.openid == openid) > 0) { saveEnt.ignoreFieldList = new List <string> { "openid" }; saveEnt.whereList = new List <string> { "openid" }; saveEnt.data.lastTime = DataTimeHelper.getDateLong(DateTime.Now); saveEnt.saveFieldList = saveFieldList; resultObj.data = await dbHelper_user.Update(saveEnt); } else { saveEnt.data.createTime = DataTimeHelper.getDateLong(DateTime.Now); saveEnt.data.lastTime = saveEnt.data.createTime; resultObj.data = await dbHelper_user.Save(saveEnt); } resultObj.success = resultObj.data > 0; return(resultObj); }
public void TestAbleToFlyOnFridays() { SearchPage searchPage = new SearchPage(Driver); searchPage.Open(); searchPage.SelectFlightFrom("Luton"); searchPage.SelectFlightTo("Porto"); searchPage.SetOneWayJourney(); var date = DataTimeHelper.GetFridayDate(); searchPage.SetOutBoundDate(date.Day.ToString(), date.Month.ToString(), date.Year.ToString()); searchPage.SelectAdultsNum("1").SelectChildrenNum("0").SelectInfantsNum("0"); BookingPage bookingPage = searchPage.ClickShowFlights(); Assert.IsFalse(bookingPage.HasFlights(), "You can not fly on Friday"); }
public void TestAbleToFlightFor2AdultsAnd1Children() { SearchPage searchPage = new SearchPage(Driver); searchPage.Open(); searchPage.SelectFlightFrom("Luton"); searchPage.SelectFlightTo("Barcelona"); var fromDate = DataTimeHelper.AddDaysToCurrentDate(3); searchPage.SetOutBoundDate(fromDate.Day.ToString(), fromDate.Month.ToString(), fromDate.Year.ToString()); var toDate = fromDate.AddDays(5); searchPage.SetReturnDate(toDate.Day.ToString(), toDate.Month.ToString(), toDate.Year.ToString()); searchPage.SelectAdultsNum("2").SelectChildrenNum("1").SelectInfantsNum("0"); BookingPage bookingPage = searchPage.ClickShowFlights(); Assert.IsTrue(bookingPage.HasFlights(), "You can not fly with such preferences"); }
private string TryChooseBestDateTimePhoto(DateTimeRangeDelay dateTimeRangeDelay) { var pathToDirectory = _properietes.PhotoDirectoryPath; var photoPaths = GetAllPhotoNameFromDirectory(pathToDirectory); foreach (var path in photoPaths) { var name = path.Split('\\').Last(); var splittedName = name.Split('_'); var date = splittedName[0]; var time = splittedName[1]; var nameDateTime = DataTimeHelper.CreateDateTimeFromText(date, time); if (nameDateTime >= dateTimeRangeDelay.Min || nameDateTime <= dateTimeRangeDelay.Max) { return(path); } } throw new PhotoFileNotFoundException(); }