public void SetGraph() { pltMain.Series.Clear(); NonDisplayedSeries.Clear(); innerStack.Children.Clear(); DateTime dMin = OPoints.Min(x => x.Date); dtAxis = new DateTimeAxis { Position = OxyPlot.Axes.AxisPosition.Bottom, Minimum = dMin.Date.ToOADate(), Maximum = DateTime.Today.ToOADate(), StringFormat = "M/d" }; dtAxis.FirstDateTime = dMin.Date; dtAxis.LastDateTime = DateTime.Today; PrefixedLineSeries = new List <PrefixedLineSeries>(); OUsers.ForEach(x => PrefixedLineSeries.Add(OPoints.ToDailyPoints(x.Alias))); OUsers.ForEach(x => PrefixedLineSeries.Add(OPoints.ToHourlyDatePoints(x.Alias))); OUsers.ForEach(x => PrefixedLineSeries.Add(OPoints.ToTotalAvg(x.Alias))); OUsers.ForEach(x => PrefixedLineSeries.Add(OPoints.ToWeeklyAvg(x.Alias))); foreach (var PrefLine in PrefixedLineSeries.OrderBy(x => x.Title)) { pltMain.Series.Add(PrefLine.LineSeries); CheckBox checkBox = new CheckBox() { Name = PrefLine.Key, Content = PrefLine.Title, IsChecked = true }; checkBox.Click += new RoutedEventHandler(this.Combo_Clicked); innerStack.Children.Add(checkBox); } RefreshGraph(); }
private void Refresh() { LoadFile(FileName); OUsers.ForEach(x => GetUserPoints(x)); SetGraph(); SaveFile(FileName); }
public ActionResult Register(OUsers user) { UserBLL userBLL = new UserBLL(); user.IdUser = Guid.NewGuid(); user.IdRole = 2; if (userBLL.Insert(user)) { return(RedirectToAction("Login", "Account")); } return(View(user)); }
public ActionResult Login(OUsers user) { OUsers u = new OUsers(); UserBLL userBLL = new UserBLL(); u = userBLL.Checklogin(user); if (u.UserName == null) { ModelState.AddModelError("", "Tên đăng nhập hoặc mật khẩu không đúng."); return(View()); } Session.Add(CommonConstant.SESSION_ACCOUNT, u); return(RedirectToAction("Index", "Home")); }
// GET: ReciveEmail public ActionResult Index(string code, int number, string date) { string ngayht = Encrypt.sha1("" + DateTime.Now.Date); if (ngayht != date) { ViewBag.message = "Đã quá hạn để xác nhận. Xin cảm ơn!"; } else { OUsers user = new OUsers(); UserBLL userbll = new UserBLL(); // lấy tất cả các user chưa gửi khảo sát var dsus = userbll.GetallBycheck(0); if (dsus == null) // kiểm tra nếu danh sách rỗng thì gửi message { ViewBag.message = "Bạn đã làm khảo sát ngày hôm nay. Xin cảm ơn "; } else // nếu không thì kiểm tra tiếp { foreach (var item in dsus) //kiểm tra có id nào trùng với id đã gửi về k. nếu có thì gán vào biến user { string ma = Encrypt.sha1("" + item.IdUser); if (ma == code) { user = item; } } } // kiểm tra biến user có giá trị k if (user.IdUser != Guid.Empty) //nếu có { HistoryBLL hisbll = new HistoryBLL(); //kiểm tra xem đã có bản ghi ngày hôm nay chưa var kttontai = from table in hisbll.Getall() where table.CreationDate == DateTime.Now.Date select table; if (kttontai == null) //nếu không có thì thêm mới. { OHistories history = new OHistories(); history.IdHis = Guid.NewGuid(); history.CreationDate = DateTime.Now.Date; history.IdStatus = number; history.IdGroup = user.IdGroup; hisbll.Insert(history); } else // nếu đã có bản ghi ngày hôm nay { bool kq = false; foreach (var item in kttontai) { if (item.IdStatus == number) // kiểm tra xem có bản ghi của loại trạng thái đã truyền về không { hisbll.Update(item); //nếu có. update bản ghi kq = true; } } if (kq == false) // nếu không có thì tạo bản ghi mới với trạng thái đấy { OHistories history = new OHistories(); history.IdHis = Guid.NewGuid(); history.CreationDate = DateTime.Now.Date; history.IdStatus = number; history.IdGroup = user.IdGroup; hisbll.Insert(history); } } // sửa user thành đã làm khảo sát user.Checkmail = true; userbll.Updatecheckmail(user, 1); ViewBag.message = "Cảm ơn bạn đã khảo sát. Xin cảm ơn !"; } else { ViewBag.message = "Bạn đã làm khảo sát ngày hôm nay. Xin cảm ơn "; } } return(View()); }