public ActionResult Login(FormCollection collection) { QLKSDataContext data = new QLKSDataContext(); var tendn = collection["username"]; var matkhau = collection["password"]; if (String.IsNullOrEmpty(tendn)) { ViewData["Loi1"] = "Phải nhập tên đăng nhập"; } else if (String.IsNullOrEmpty(matkhau)) { ViewData["Loi2"] = "Phải nhập mật khẩu"; } else { TaiKhoan ad = data.TaiKhoans.SingleOrDefault(t => t.TenTK == tendn && t.MatKhau == matkhau); if (ad != null) { Session["Taikhoanadmin"] = ad; Session["HoTenAdmin"] = ad.TenTK; return(RedirectToAction("Index", "Admin")); } else { ViewBag.Thongbao = "Tên đăng nhập hoặc mật khẩu không đúng"; } } return(View()); }
public WebService1() { db = new QLKSDataContext(); //Uncomment the following line if using designed components //InitializeComponent(); //Task task = new Task(RunSync2); //task.Start(); //task.Wait(); }
private void btnLoad_Click(object sender, EventArgs e) { try { QLKSDataContext db = new QLKSDataContext(); chartThongKe.DataSource = db.ThuNhaps.ToList(); chartThongKe.Series["VNĐ"].XValueMember = "Ngaydi"; chartThongKe.Series["VNĐ"].XValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Date; chartThongKe.Series["VNĐ"].YValueMembers = "TienTT"; chartThongKe.Series["VNĐ"].YValueType = System.Windows.Forms.DataVisualization.Charting.ChartValueType.Double; } catch (Exception ex) { MessageBox.Show(ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error); } }