| 37 | | { |
| 38 | | Authors = _context.GetAuthors().OrderBy(a => a.FullName).ToList(), |
| 39 | | EmploymentTypeList = new SelectList(_context.GetEmploymentTypes().ToList(),"Id","Name"), |
| 40 | | UserList = new SelectList(_context.GetUsers().OrderBy(u => u.FirstName).ToList(),"Id","FullName") |
| 41 | | }; |
| | 38 | { |
| | 39 | Authors = _context.GetAuthors().OrderBy(a => a.FullName).ToList(), |
| | 40 | EmploymentTypeList = new SelectList(_context.GetEmploymentTypes().ToList(),"Id","Name"), |
| | 41 | UserList = new SelectList(_context.GetUsers().OrderBy(u => u.FullName).ToList(),"Id","FullName") |
| | 42 | }; |
| 47 | | var items = _repository.Find(m => m.Date.Month == month && m.Date.Year == year && m.CreatedBy == user) |
| | 48 | var allViewData = new AllViewData(); |
| | 49 | string error = ""; |
| | 50 | string naglowek = ""; |
| | 51 | |
| | 52 | if (user <= 0) |
| | 53 | { |
| | 54 | error = "Nie mo¿na wywietliæ wierszówek. Spróbuj jeszcze raz. "; |
| | 55 | allViewData = InitAllViewData("", error, null, null); |
| | 56 | return View("Error",allViewData); |
| | 57 | } |
| | 58 | var name = ""; |
| | 59 | var items = new List<MagazineItem>(); |
| | 60 | if (user > 0) |
| | 61 | { |
| | 62 | var u = _context.GetUserById(user); |
| | 63 | if (u != null) |
| | 64 | { |
| | 65 | name = u.FullName; |
| | 66 | items = _repository.Find(m => m.Date.Month == month && m.Date.Year == year && m.CreatedBy == user) |
| 49 | | return View(items); |
| | 68 | |
| | 69 | if (items.Count <= 0) |
| | 70 | { |
| | 71 | error = "Brak wierszówek dla tego u¿ytkownika."; |
| | 72 | allViewData = InitAllViewData("", error, null, null); |
| | 73 | return View("Error", allViewData); |
| | 74 | } |
| | 75 | } |
| | 76 | else |
| | 77 | { |
| | 78 | //U¿ytkownik bo taki nie istnieje |
| | 79 | error = "Nie mo¿na wyswietliæ wierszówek, gdy¿ u¿ytkownik nie istnieje. "; |
| | 80 | allViewData = InitAllViewData("", error, null, null); |
| | 81 | return View("Error", allViewData); |
| | 82 | } |
| | 83 | DateTime dat = new DateTime(1, 1, 1); |
| | 84 | dat = dat.AddYears(year-1); |
| | 85 | dat = dat.AddMonths(month-1); |
| | 86 | |
| | 87 | naglowek = "<div class='st1'>Wierszówki z " + dat.ToString("MM/yyyy", CultureInfo.CreateSpecificCulture("en-US")) + "</div>"; |
| | 88 | if ( name != "") |
| | 89 | { |
| | 90 | naglowek += "<div class='st1'>Wprowadzaj¹cy: <span>" + name + "</span></div>"; |
| | 91 | } |
| | 92 | } |
| | 93 | Info inf = new Info(); |
| | 94 | inf.powrot = "2"; |
| | 95 | inf.month = month; |
| | 96 | inf.year = year; |
| | 97 | inf.user_id = user; |
| | 98 | |
| | 99 | allViewData = InitAllViewData(naglowek, error, inf, items); |
| | 100 | return View("All", allViewData); |
| 55 | | return View("All", items); |
| | 111 | if ( items.Count <= 0 ) |
| | 112 | { |
| | 113 | error = "Brak wierszówek do wyceny."; |
| | 114 | allViewData = InitAllViewData(naglowek, error, null, null); |
| | 115 | return View("Error", allViewData); |
| | 116 | } |
| | 117 | allViewData = InitAllViewData(naglowek, "", inf, items); |
| | 118 | return View("All", allViewData); |
| 71 | | { |
| 72 | | FullName = magazineItems[0].Author.FullName, |
| 73 | | Date = magazineItems[0].Date, |
| 74 | | MagazineItems = new Dictionary<string, List<MagazineItem>>() |
| 75 | | }; |
| | 134 | { |
| | 135 | FullName = magazineItems[0].Author.FullName, |
| | 136 | Date = magazineItems[0].Date, |
| | 137 | MagazineItems = new Dictionary<string, List<MagazineItem>>() |
| | 138 | }; |