private void btnLogin_Click(object sender, EventArgs e) { loginAccess = LoginUser(txtLogin.Text, txtPassword.Text); //SVMContext dbContext = new SVMContext(); using (var dbcontext = new SVMContext()) { //var a = (from p in dbcontext.tbluseraccess // where p.UserName == txtLogin.Text // && txtPassword.Text == p.Password // && p.isDeleted != false // select p).FirstOrDefault(); if (loginAccess != null) { this.Hide(); var parent = new Parent_SVM(); Global.loggedUserId = loginAccess.UserId; Global.loggedUserAccess = loginAccess.AccessId; //Parent_SVM parent = new Parent_SVM(); parent.Closed += (s, args) => this.Close(); parent.Show(); } else { MessageBox.Show("Login Failed"); } } }
public List <tblaccess> LoadAccess() { SVMContext svmContext = new SVMContext(); List <tblaccess> lstAccess = new List <tblaccess>(); lstAccess = (from p in svmContext.tblaccess select p).ToList(); return(lstAccess); }
public void LoadReport(int studentId) { SVMContext svmContext = new SVMContext(); var data = svmContext.tblassessment.Where(x => x.StudentId == studentId).ToList(); var reportDataSource1 = new Microsoft.Reporting.WinForms.ReportDataSource(); reportDataSource1.Name = "dataSet11"; reportDataSource1.Value = data; this.reportViewer1.LocalReport.DataSources.Add(reportDataSource1); this.reportViewer1.LocalReport.ReportEmbeddedResource = "ReportSample.Report1.rdlc"; this.reportViewer1.RefreshReport(); }
public tbluseraccess LoginUser(string userName, string password) { //SVMContext dbContext = new SVMContext(); using (var dbcontext = new SVMContext()) { var a = (from p in dbcontext.tbluseraccess where p.UserName == userName && password == p.Password && p.isDeleted == false select p).FirstOrDefault(); return(a); } }