public void GetPeriods() { List <WebPeriod> periods; periods = PeriodManager.GetPeriods(GetContext()); Assert.IsTrue(periods.IsNotEmpty()); }
public JsonResult GetAvailablePeriods(Guid accountGuid) { List <Period> models = new PeriodManager().GetPeriodsByAccountForCurrentWeek(accountGuid); List <SelectListItem> modelsSelectList = new List <SelectListItem> { new SelectListItem { Text = "Select Day", Value = Guid.Empty.ToString() } }; if (models != null) { foreach (Period model in models) { modelsSelectList.Add(new SelectListItem { Text = model.StartDate.ToShortDateString(), Value = model.PeriodGuid.ToString() }); } } return(Json(new SelectList(modelsSelectList, "Value", "Text"), JsonRequestBehavior.AllowGet)); }
public void GetPeriodTypes() { Data.ArtDatabankenService.PeriodTypeList periodTypeList; periodTypeList = PeriodManager.GetPeriodTypes(); Assert.IsTrue(periodTypeList.IsNotEmpty()); }
/// <summary> /// 根据当前时间周期获取父周期的计划项列表 /// </summary> /// <param name="period"></param> /// <returns></returns> public List <Entity.PlanItem> GetParentPlanItem(string periodID) { PeriodManager pm = new PeriodManager(); var parentPeriod = pm.GetParentPeriod(periodID); if (parentPeriod == null) { return(null); } PlanDac dac = new PlanDac(); #warning 缺少判断父周期是否启用 List <Entity.PlanItem> planItemList = new List <Entity.PlanItem>(); PlanFilter planFilter = new PlanFilter(); planFilter.Periods = new List <string>() { parentPeriod.ID }; planFilter.Senders = new List <string>() { Utils.GetUserId() }; //获取当前用户父时间段内的计划信息 List <PlanInfo> planInfoList = PlanService.Current.Get(planFilter); if (planInfoList == null || planInfoList.Count <= 0) { return(null); } planInfoList.ForEach(item => { planItemList.AddRange(dac.GetPlanItems(item.ID)); }); return(planItemList); }
public void GetRelistedTaxa() { Data.ArtDatabankenService.Factor factor; RedListCategoryEnum redListCategory; SpeciesFactCondition speciesFactCondition; SpeciesFactFieldCondition speciesFactFieldCondition; Data.ArtDatabankenService.TaxonList taxa; speciesFactCondition = new SpeciesFactCondition(); factor = Data.ArtDatabankenService.FactorManager.GetFactor(Data.ArtDatabankenService.FactorId.RedlistCategory); speciesFactCondition.Factors.Add(factor); speciesFactCondition.IndividualCategories.Add(IndividualCategoryManager.GetDefaultIndividualCategory()); speciesFactCondition.Periods.Add(PeriodManager.GetCurrentPublicPeriod()); for (redListCategory = RedListCategoryEnum.DD; redListCategory <= RedListCategoryEnum.NT; redListCategory++) { speciesFactFieldCondition = new SpeciesFactFieldCondition(); speciesFactFieldCondition.FactorField = factor.FactorDataType.Field1; speciesFactFieldCondition.SetValue((Int32)redListCategory); speciesFactCondition.SpeciesFactFieldConditions.Add(speciesFactFieldCondition); } // The merge is necessary if there are problems in Dyntaxa. taxa = new Data.ArtDatabankenService.TaxonList(); taxa.Merge(Data.ArtDatabankenService.TaxonManager.GetTaxaByQuery(speciesFactCondition, TaxonInformationType.Basic)); Assert.IsTrue(taxa.IsNotEmpty()); Assert.AreEqual(4261, taxa.Count); }
public void GetPeriodTypesTest() { List <WebPeriodType> periodTypes; periodTypes = PeriodManager.GetPeriodTypes(GetContext()); Assert.IsTrue(periodTypes.IsNotEmpty()); }
public JsonResult GetAvailableAppointmentsFromInjector(Guid accountGuid, Guid serviceGuid, Guid periodGuid) { // do the big c# work in manager List <Slot> models = new PeriodManager().GetAvailableAppointmentTimesForInjectorByPeriod(periodGuid, accountGuid, serviceGuid); List <SelectListItem> modelsSelectList = new List <SelectListItem> { new SelectListItem { Text = "Select Appointment", Value = DateTime.MinValue.ToString() } }; if (models != null) { foreach (Slot item in models) { modelsSelectList.Add(new SelectListItem { Text = item.StartTime.ToShortTimeString().ToString() + " to " + item.EndTime.ToShortTimeString().ToString(), Value = item.StartTime.ToString(), }); } } return(Json(new SelectList(modelsSelectList, "Value", "Text"), JsonRequestBehavior.AllowGet)); }
public void GetPeriod() { foreach (Period period in GetSomePeriods()) { Assert.AreEqual(period, PeriodManager.GetPeriod(period.Id)); } }
public ActionResult Periods() { List <PeriodViewModel> models = new List <PeriodViewModel>(); models = new PeriodManager().GetWorkPeriodsForView(); return(View(models)); }
public void GetPeriodType() { Data.ArtDatabankenService.PeriodType redlistPeriodType = PeriodManager.GetPeriodType(Data.ArtDatabankenService.PeriodTypeId.SwedishRedlist); Assert.AreEqual(1, redlistPeriodType.Id); Data.ArtDatabankenService.PeriodType helcomRedlistPeriodType = PeriodManager.GetPeriodType(2); Assert.AreEqual((Int32)PeriodTypeId.HelcomRedList, helcomRedlistPeriodType.Id); }
public ActionResult PeriodsForAccount(Guid accountGuid) { List <Period> models = new List <Period>(); models = new PeriodManager().GetPeriodsByAccount(accountGuid); return(View(models)); }
public AccountComplexManager() { uow = new UnitOfWork(new Database.Context.AydinUniversityProjectContext()); userManager = uow.GetManager <UserManager, User>(); stdManager = uow.GetManager <StudentManager, Student>(); prdManager = uow.GetManager <PeriodManager, Period>(); frManager = uow.GetManager <FriendRelationshipManager, FriendRelationship>(); }
public AssignmentsController(ILogger <AssignmentsController> logger, IConfiguration config, AssignmentManager assignmentManager, PeriodManager periodManager) { this.config = config; this.logger = logger; this.assignmentManager = assignmentManager; this.periodManager = periodManager; }
public static Data.ArtDatabankenService.PeriodList GetSomePeriods() { Data.ArtDatabankenService.PeriodList periods; periods = new Data.ArtDatabankenService.PeriodList(); periods.AddRange(PeriodManager.GetPeriods().GetRange(0, 2)); return(periods); }
public ActionResult Update(Guid periodGuid, Guid accountGuid) { Period model = new PeriodManager().Read(periodGuid, accountGuid); model.Accounts = new AccountManager().GetAccountsByType(enums.AccountTypes.Injector); return(View(model)); }
public void DeleteUserSelectedPeriods() { foreach (UserSelectedPeriodUsage periodUsage in Enum.GetValues(typeof(UserSelectedPeriodUsage))) { PeriodManager.AddUserSelectedPeriods(GetContext(), PeriodManagerTest.GetSomePeriodIds(GetContext()), periodUsage); PeriodManager.DeleteUserSelectedPeriods(GetContext()); } }
public void GetCurrentPublicPeriod() { Data.ArtDatabankenService.Period currentPublicPeriod; currentPublicPeriod = PeriodManager.GetCurrentPublicPeriod(); Assert.IsNotNull(currentPublicPeriod); Assert.IsFalse(currentPublicPeriod.AllowUpdate); Assert.AreEqual((Int32)Data.ArtDatabankenService.PeriodTypeId.SwedishRedlist, currentPublicPeriod.PeriodType.Id); }
public EducationOpsComplexManager() { uow = new UnitOfWork(new Database.Context.AydinUniversityProjectContext()); educationManager = uow.GetManager <EducationManager, Education>(); noteManager = uow.GetManager <NoteManager, Note>(); periodManager = uow.GetManager <PeriodManager, Period>(); lessonManager = uow.GetManager <LessonManager, Lesson>(); studentManager = uow.GetManager <StudentManager, Student>(); }
public void GetPeriods() { Data.ArtDatabankenService.PeriodList allPeriods; Data.ArtDatabankenService.PeriodList redlistPeriods; allPeriods = PeriodManager.GetPeriods(); Assert.IsTrue(allPeriods.IsNotEmpty()); redlistPeriods = PeriodManager.GetPeriods(Data.ArtDatabankenService.PeriodTypeId.SwedishRedlist); Assert.IsTrue(redlistPeriods.IsNotEmpty()); Assert.IsTrue(redlistPeriods.Count < allPeriods.Count); }
public PeriodsController(ILogger <PeriodsController> logger, IConfiguration config, PeriodManager periodManager, AssignmentManager assignmentManager, AttemptLogManager attemptLogManager, QuestionManager questionManager) { this.config = config; this.logger = logger; this.periodManager = periodManager; this.assignmentManager = assignmentManager; this.attemptLogManager = attemptLogManager; this.questionManager = questionManager; }
public RepsController(ILogger <RepsController> logger, IConfiguration config, RepManager repManager, AssignmentManager assignmentManager, PeriodManager periodManager, AttemptLogManager attemptLogManager) { this.config = config; this.logger = logger; this.repManager = repManager; this.assignmentManager = assignmentManager; this.attemptLogManager = attemptLogManager; this.periodManager = periodManager; }
public void Periods() { UserParameterSelection userParameterSelection = GetUserParameterSelection(); Assert.AreEqual(userParameterSelection.Periods.IsNotEmpty(), userParameterSelection.HasPeriods); userParameterSelection.Periods.Merge(PeriodManager.GetPeriods()); Assert.IsTrue(userParameterSelection.Periods.IsNotEmpty()); Assert.IsTrue(userParameterSelection.Periods.Count > 2); Assert.IsTrue(userParameterSelection.HasPeriods); }
/// <summary> /// Save UserDataSet to xml file. /// </summary> /// <param name='fileName'>File name.</param> /// <param name='userDataSet'>UserDataSet to save.</param> /// <param name='dictionaryURI'>Path.</param> /// <param name='renewCommonDefinitions'>Indicates if common definitions should be updated.</param> public static void Serialize(String fileName, UserDataSet userDataSet, String dictionaryURI, Boolean renewCommonDefinitions) { BinaryFormatter formatter = new BinaryFormatter(); Stream stream = File.OpenWrite(fileName); formatter.Serialize(stream, userDataSet); stream.Close(); if (renewCommonDefinitions) { String factorFileName = dictionaryURI + @"\Factors.bin"; stream = File.OpenWrite(factorFileName); FactorList allFactors = FactorManager.GetFactors(); formatter.Serialize(stream, allFactors); stream.Close(); FactorTreeSearchCriteria searchCriteria = new FactorTreeSearchCriteria(); FactorTreeNodeList factorTrees = new FactorTreeNodeList(); foreach (Factor factor in allFactors) { List <Int32> factorIds = new List <Int32>(); factorIds.Add(factor.Id); searchCriteria.RestrictSearchToFactorIds = factorIds; } String factorTreeFileName = dictionaryURI + @"\FactorTrees.bin"; stream = File.OpenWrite(factorTreeFileName); formatter.Serialize(stream, factorTrees); stream.Close(); String speciesFactQualityFileName = dictionaryURI + @"\SpeciesFactQualities.bin"; stream = File.OpenWrite(speciesFactQualityFileName); formatter.Serialize(stream, SpeciesFactManager.GetSpeciesFactQualities()); stream.Close(); String periodsFileName = dictionaryURI + @"\Periods.bin"; stream = File.OpenWrite(periodsFileName); formatter.Serialize(stream, PeriodManager.GetPeriods()); stream.Close(); } }
public ActionResult Create(Period model) { if (ModelState.IsValid) { model.StartDate = model.BeginDate.Add(model.BeginTime); model.StopDate = model.EndDate.Add(model.EndTime); if (model.StartDate > model.StopDate) { ViewBag.MessageResult = "Start date and time cannot be later than the end date and time."; return(View(model)); } model = new PeriodManager().Create(model); if (model.PeriodGuid != Guid.Empty) { return(RedirectToAction("Read", new { periodGuid = model.PeriodGuid, accountGuid = model.AccountGuid })); } } return(View(model)); }
/// <summary> /// Read UserDataSet from xml file. /// </summary> /// <param name='fileName'>File name.</param> /// <param name='dictionaryURI'>Path.</param> /// <returns>The read UserDataSet.</returns> public static UserDataSet Deserialize(String fileName, String dictionaryURI) { Stream stream = File.OpenRead(fileName); BinaryFormatter formatter = new BinaryFormatter(); UserDataSet userDataSet = (UserDataSet)formatter.Deserialize(stream); stream.Close(); stream = File.OpenRead(dictionaryURI + @"\Factors.bin"); FactorList allFactors = ((FactorList)formatter.Deserialize(stream)); stream.Close(); stream = File.OpenRead(dictionaryURI + @"\FactorTrees.bin"); FactorTreeNodeList factorTrees = ((FactorTreeNodeList)formatter.Deserialize(stream)); stream.Close(); stream = File.OpenRead(dictionaryURI + @"\SpeciesFactQualities.bin"); SpeciesFactQualityList speciesFactQualities = ((SpeciesFactQualityList)formatter.Deserialize(stream)); stream.Close(); stream = File.OpenRead(dictionaryURI + @"\Periods.bin"); PeriodList periods = ((PeriodList)formatter.Deserialize(stream)); stream.Close(); PeriodManager.InitialisePeriods(periods); SpeciesFactManager.InitialiseSpeciesFactQualities(speciesFactQualities); FactorManager.InitialiseAllFactors(allFactors, factorTrees); SpeciesFactManager.InitAutomatedCalculations(userDataSet.SpeciesFacts); return(userDataSet); }
/// <summary> /// 获取父计划列表 /// </summary> /// <param name="periodID"></param> /// <returns></returns> public List <PlanInfo> GetParentPlan(string periodID) { PeriodManager pm = new PeriodManager(); var parentPeriod = pm.GetParentPeriod(periodID); if (parentPeriod == null) { return(null); } #warning 缺少判断父周期是否启用 PlanFilter planFilter = new PlanFilter(); planFilter.Periods = new List <string>() { parentPeriod.ID }; planFilter.Senders = new List <string>() { Utils.GetUserId() }; //获取当前用户父时间段内的计划信息 List <PlanInfo> planInfoList = PlanService.Current.Get(planFilter); return(planInfoList); }
public ActionResult SearchPeriods(DateTime?startDate = null, DateTime?endDate = null, Guid?accountGuid = null) { List <PeriodViewModel> model = new PeriodManager().SearchPeriods(startDate, endDate, accountGuid); return(PartialView("_Periods", model)); }
public static List <WebPeriod> GetSomePeriods(WebServiceContext context) { return(PeriodManager.GetPeriods(context)); }
public static WebPeriodType GetOnePeriodType(WebServiceContext context) { return(PeriodManager.GetPeriodTypes(context)[0]); }
public ActionResult Read(Guid periodGuid, Guid accountGuid) { Period model = new PeriodManager().Read(periodGuid, accountGuid); return(View(model)); }