public ActionResult UserEvents()
        {
            string userEmail=(string)Session["email"];
            string userPassword=(string)Session["password"];

            if (userEmail == null || userPassword == null)
                return RedirectToRoute("Logout");
            UserEventsClient server = new UserEventsClient();

            ViewData["userEvents"] = server.GetEvents(userEmail, userPassword);
            return View();

        }
Пример #2
0
        //--------------------------------------------------------------------------------
        //Заполняет список измененных файлов
        private void FillListView()
        {
            EventInfo [] userEvents = null;

            using (UserEventsClient client = new UserEventsClient())
            {
                userEvents = client.GetEvents(Account.GetUserEmail(), Account.GetUserPass());
            }

            listUserEvents.Items.Clear();

            foreach (var userEvent in userEvents)
            {
                ListViewItem item = new ListViewItem(userEvent.Description);

                item.SubItems.Add(userEvent.FileName);

                item.SubItems.Add(userEvent.Path);
                float fileSize = (float)userEvent.FileSize / 1024.0f;
                string suffix = "KБайт";

                if (fileSize > 1000.0f)
                {
                    fileSize /= 1024.0f;
                    suffix = "MБайт";
                }
                item.SubItems.Add(string.Format("{0:0.0} {1}", fileSize, suffix));

                item.SubItems.Add(userEvent.Created.ToString());
                item.SubItems.Add(userEvent.FileSize.ToString());
                item.SubItems.Add(userEvent.FileId.ToString());

                listUserEvents.Items.Add(item);
            }
        }