Exemplo n.º 1
0
    protected void Page_Load(object sender, EventArgs e)
    {
        person currentUser;

        // faudrait encore fait un helper pour ça
        if (Session["user"] != null)
        {
            currentUser = (person)Session["user"];

            if (homeFacade == null)
            {
                homeFacade = new HomeFacade();
            }
            if (groupFacade == null)
            {
                groupFacade = new GroupFacade();
            }

            renderGroupsToPage(currentUser);
        }
        else
        {
            // Redirect to home page... (no login)
            // Todo: put in helper function in master ^  v
            Response.Redirect("Index.aspx");
        }
    }
Exemplo n.º 2
0
 protected void Page_Load(object sender, EventArgs e)
 {
     if (homeFacade == null)
     {
         homeFacade = new HomeFacade();
     }
 }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            HomeFacade homeFacade = new HomeFacade();

            homeFacade.LeaveFromHome();
            Console.ReadKey();
        }
Exemplo n.º 4
0
 public Form2()
 {
     InitializeComponent();
     controller  = new MainController();
     homeFacade  = new HomeFacade();
     groupFacade = new GroupFacade();
     createDataGridColumns();
 }
Exemplo n.º 5
0
    public static string GetGroupMessages()
    {
        JavaScriptSerializer TheSerializer = new JavaScriptSerializer();

        //Si groupFacade est null on l'instancie
        if (groupFacade == null)
        {
            groupFacade = new GroupFacade();
        }

        //Si homeFacade est null on l'instancie
        if (homeFacade == null)
        {
            homeFacade = new HomeFacade();
        }

        //On ajoute a la liste following tous les groups aux quels l'utilisateur participe
        following = homeFacade.GetPersonGroups(theUser.Id);

        //On instance une nouvelle liste qui contiendera les id des groups aux quels l'utilisateur participe
        groupsId = new List <int>();

        //On initialise une nouvelle liste, qui contiendera des objets de MessageDetail
        List <MessageDetail> listMessageDetail = new List <MessageDetail>();

        //Pour chaque group dans la liste following
        foreach (group followingId in following)
        {
            //On initialise une nouvelle liste qui contiendera les messages
            List <Message> listMessage = new List <Message>();

            //On ajoute dans la liste groupMessages tous les messages des groups dans lesquels l'utilisateur participe
            groupMessages = groupFacade.GetGroupChatHistory(followingId.Id);

            //Pour chaque message de la liste groupMessages
            foreach (chathistory msg in groupMessages)
            {
                //..On ajoute dans la liste listMessage les messages qui se trouve dans la liste prit a partir des messages de groupe
                listMessage.Add(new Message
                {
                    authorName  = msg.person.Name,
                    message     = msg.Message,
                    dateMessage = msg.CreationDate.ToString()
                });
            }
            MessageDetail messageDetail = new MessageDetail
            {
                groupId = followingId.Id,
                Message = listMessage
            };
            listMessageDetail.Add(messageDetail);
        }
        // TheSerializer.Serialize(personId);
        return(TheSerializer.Serialize(listMessageDetail));
    }
Exemplo n.º 6
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (homeFacade == null)
        {
            homeFacade = new HomeFacade();
        }

        if (!IsPostBack)
        {
            setValuesInPage();
        }
    }
Exemplo n.º 7
0
        public void ShouldSwitchOnAll()
        {
            var light       = new Light();
            var tv          = new TV();
            var musicSystem = new MusicSystem();
            var security    = new Security();

            var facade = new HomeFacade(light, musicSystem, tv, security);

            facade.ArriveHome();

            Assert.That(light.IsSwitchOn);
            Assert.That(tv.IsSwitchOn);
            Assert.That(musicSystem.IsSwitchOn);
            Assert.That(security.IsSwitchOn);
        }
        public List <RegistrationStats> GetInspectorStats(int userId, int year)
        {
            IHomeFacade homeFacade = new HomeFacade();

            return(homeFacade.GetInspectorStats(userId, year));
        }
        public List <RegistrationStats> GetInspectedGrowersPerMonth(int userId, int year)
        {
            IHomeFacade homeFacade = new HomeFacade();

            return(homeFacade.GetInspectedGrowersPerMonth(userId, year));
        }
        public List <RegistrationStats> GetUserPerDistrict(int year)
        {
            IHomeFacade homeFacade = new HomeFacade();

            return(homeFacade.GetUserPerDistrict(year));
        }
        public List <RegistrationStats> GetUserRegistrationsPerMonth(int year)
        {
            IHomeFacade homeFacade = new HomeFacade();

            return(homeFacade.GetUserRegistrationsPerMonth(year));
        }
        public List <CropsRegistered> GetAreaPerCrop(int year)
        {
            IHomeFacade homeFacade = new HomeFacade();

            return(homeFacade.GetAreaPerCrop(year));
        }
        public List <RegistrationStats> GetRegistrationStats(int year)
        {
            IHomeFacade homeFacade = new HomeFacade();

            return(homeFacade.GetRegistrationStats(year));
        }
Exemplo n.º 14
0
    protected void Page_Load(object sender, EventArgs e)
    {
        if (groupFacade == null)
        {
            groupFacade = new GroupFacade();
        }

        if (homeFacade == null)
        {
            homeFacade = new HomeFacade();
        }

        // Also check if the group actually exists and if the user is following it
        if (!IsValidated())
        {
            Response.Redirect("Index.aspx");
        }
        else
        {
            person currentUser = (person)Session["user"];

            // Get group ID from url parameter
            Boolean goodGroupId = false;
            int     maybeGroupId;

            goodGroupId = int.TryParse(Request.Params["groupID"], out maybeGroupId);

            if (goodGroupId)
            {
                groupId = maybeGroupId;     // definitely

                if (!Page.IsPostBack)
                {
                    renderGroupToPage();

                    eventsList = groupFacade.GetGroupEvent(groupId);

                    Session["events"] = eventsList;
                    Session["facade"] = groupFacade;

                    // Events table avec les Events du mois
                    createEventTable(DateTime.Now);
                }
                else
                {
                    eventsList  = (List <@event>)Session["events"];
                    groupFacade = (GroupFacade)Session["facade"];

                    // Events table selon le mois visible en ce moment sur la page (au first load la visible date est égale à la date de validation et nous ne voulons pas afficher pour celle-ci)
                    createEventTable((Calendar1.VisibleDate == dateValidation) ? DateTime.Now : Calendar1.VisibleDate);
                }

                if (!groupFacade.PersonIsGroupAdmin(currentUser.Id, groupId))
                {
                    panelAdminButtons.Visible = false;
                }

                AfficherGroupFiles((int)groupId);
            }
        }
    }