/// <summary> /// Indique si l'objet est valide /// </summary> private bool CanExecuteSelectTaskCommand(IcomiTask param) { return true; }
/// <summary> /// Récupère les tâches du jour pour un utilisateur /// </summary> /// <param name="NomComplet">Nom complet de l'utilisateur</param> /// <returns>la liste des documents</returns> public IEnumerable<IcomiTask> GetTodaysTasksForUser(string NomComplet) { try { var ctx = SharepointContextFactory.GetContext(); var list = ctx.Web.Lists.GetByTitle("ICOMI_ERP_PLANIF"); //string query = String.Format(@"<View><Query> <Where><And><Eq> <FieldRef Name='User'/> <Value Type='Lookup'>{0}</Value> </Eq> <Geq><FieldRef Name='EndDate'/><Value Type='DateTime'><Today OffsetDays='0'/></Value></Geq></And></Where> </Query></View>", NomComplet); //<DateRangesOverlap> <FieldRef Name='EventDate' /> <FieldRef Name='EndDate' /> <FieldRef Name='RecurrenceID'/> <Value Type='DateTime'> <Today /> </Value> </DateRangesOverlap> string query = String.Format(@"<View scope='RecursiveAll'><Query> <Where><And><Eq> <FieldRef Name='User'/> <Value Type='Lookup'>{0}</Value> </Eq> <DateRangesOverlap> <FieldRef Name='EventDate' /> <FieldRef Name='EndDate' /> <FieldRef Name='RecurrenceID'/> <Value Type='DateTime'> <Today /> </Value> </DateRangesOverlap> </And></Where> </Query></View>", NomComplet); var camlQuery = new CamlQuery { ViewXml = query, }; var tasks = list.GetItems(camlQuery); ctx.Load(tasks); ctx.ExecuteQuery(); IcomiTask maTache = null; List<IcomiTask> lesTaches = new List<IcomiTask>(); foreach (var listItem in tasks) { maTache = new IcomiTask(NomComplet); maTache.NbOccurence = 1; maTache.ID = listItem.FieldValues["DateDebut"] != null ? listItem.FieldValues["DateDebut"].ToString() : "00:00:00"; maTache.HeureDebut = listItem.FieldValues["DateDebut"] != null ? listItem.FieldValues["DateDebut"].ToString() : "00:00:00"; maTache.HeureFin = listItem.FieldValues["DateFin"] != null ? listItem.FieldValues["DateFin"].ToString() : "00:00:00"; bool allDayEvent = listItem.FieldValues["fAllDayEvent"] != null ? Convert.ToBoolean(listItem.FieldValues["fAllDayEvent"]) : false; if (allDayEvent) { maTache.HeureDebut = "Toute la journée"; maTache.HeureFin = string.Empty; } maTache.TileTitle = listItem.FieldValues["Title"] != null ? listItem.FieldValues["Title"].ToString() : string.Empty; maTache.Title = listItem.FieldValues["Title"] != null ? listItem.FieldValues["Title"].ToString() : string.Empty; maTache.Emplacement = listItem.FieldValues["Location"] != null ? listItem.FieldValues["Location"].ToString() : string.Empty; maTache.Description = listItem.FieldValues["Description"] != null ? listItem.FieldValues["Description"].ToString() : string.Empty; if(!maTache.Title.Contains("Suppression")) lesTaches.Add(maTache); } return lesTaches; } catch (ExceptionBase) { throw; } catch (Exception ex) { throw new BusinessException(GetType().FullName, "GetTodaysTasksForUser", string.Format("Erreur lors de la récupération des tâches de l'utilisateur : {0}", ex.Message), ex); } }
/// <summary> /// Valide l'édition en cours et retourne à l'écran principal /// </summary> /// <param name="notUsed"></param> protected virtual void ExecuteSelectTaskCommand(IcomiTask param) { Messenger.Default.Send<ViewTaskMessage>(new ViewTaskMessage() { TaskToShow = param }); }