protected void Button1_Click(object sender, EventArgs e) { using (var db = new HeznekDB()) { List <loginAndPermissions> usersLogin = LoginData.getLoginList(); string id = TextBox1.Text; string pass = TextBox2.Text; foreach (var loginObject in usersLogin) { /* if(string.IsNullOrEmpty(id)) * { * Label1.Text = "אנא הזן שם משתמש וסיסמא "; * * }*/ if (id.Equals(loginObject.id) && pass.Equals(loginObject.password)) { if (Label1.Visible == false) { Label1.Visible = true; } Label1.Text = "ברוך הבא, " + ForeignKeys.getUserConnectedByID(id).firstName; } else { if (Label1.Visible == false) { Label1.Visible = true; } Label1.Text = " שם משתמש או סיסמא אינם נכונים, נסה שוב"; } } } }
/* gets all the evnts from the list of events*/ /* public static List<eventTbl> getAllEvents() * { * using (var db = new HeznekDB) * { * List<eventTbl> events = db.eventTbl.ToList(); * return events; * } * } * * /*update a specific event in the list of events*/ /* public static void updateEventInList(eventTbl updatedEvent) * { * using (var db = new HeznekDB()) * { * List<eventTbl> events = getAllEvents(); * * foreach (var eventIndex in events) * { * if (eventIndex.sn == updatedEvent.sn) * { * eventIndex.nameEvent = updatedEvent.nameEvent; * eventIndex.subjectEvent = updatedEvent.subjectEvent; * db.eventTbl.Remove(eventIndex); * db.eventTbl.Add(updatedEvent); * //NOTE: here the updated event gets a new serial number(KEY) * } * } * } * }*/ /* add an vent to list of events*/ public static void AddEvent(@event eventToAdd) { using (var db = new HeznekDB()) { [email protected](eventToAdd); db.SaveChanges(); } }
/*Add function*/ public static void addBankToList(bank bank) { using (var db = new HeznekDB()) { db.bank.Add(bank); db.SaveChanges(); } }
/*Get function*/ public static List <bank> getAllBanks() { using (var db = new HeznekDB()) { List <bank> banks = db.bank.ToList(); return(banks); } }
/* * public int getAllUsersFromTheSameGender(char gender) * {//get all the users from the same gender 'F' = female or 'M'=male - aware\unaware candidates and all the students * return getAllCandidatesFromTheSameGender(gender).Count + getAllStudentsFromTheSameGender(gender).Count; * }*/ /*Add functions*/ public static void addUserToUsers(userTbl user, List <userTbl> users) { using (var db = new HeznekDB()) { db.userTbl.Add(user); db.SaveChanges(); } }
/// <Summary> /// get all active candidates(from genral details candidates table) /// </Summary> public static List <generalDetailsActiveCandidate> getCandidatesGenralDetails() { using (var db = new HeznekDB()) { List <generalDetailsActiveCandidate> users = db.generalDetailsActiveCandidate.ToList(); return(users); } }
/// <Summary> /// retrieval from DB all the users(scholarships student and candidates) /// </Summary> public static List <userTbl> getAllUsers() { using (var db = new HeznekDB()) { List <userTbl> users = db.userTbl.ToList(); return(users); } }
public static List<loginAndPermissions> getLoginList() //give all the registered users to system in the table with no filter { using (var db = new HeznekDB()) { List<loginAndPermissions> usersRegistered = db.loginAndPermissions.ToList(); return usersRegistered; } }
/*removal functions*/ public static void removeUserFromList(userTbl userToRemove) { using (var db = new HeznekDB()) { List <userTbl> users = getAllUsers(); foreach (userTbl user in users) { if (user.id.Equals(userToRemove.id)) { db.userTbl.Remove(user); } } } }
static void Main(String[] args) { var db = new HeznekDB(); /* * var studyField = new studyFieldTbl() * { * * field = "computers", * nameOfDegree = "Computer Science" * }; * db.studyFieldTbl.Add(studyField); * db.SaveChanges();*/ //userLogic userlogic = new userLogic(); // userlogic.getAllUsers(); }
/*update functions*/ public static void updateUserInList(userTbl updatedUser) { using (var db = new HeznekDB()) { List <userTbl> users = getAllUsers(); foreach (userTbl user in users) { if (user.id.Equals(updatedUser.id)) { db.userTbl.Remove(user); db.userTbl.Add(updatedUser); } } } }
/// <Summary> /// give all the scholarships students in the table(no matter what is their secondary status) /// </Summary> public static ArrayList getAllScholarshipsStudents() { using (var db = new HeznekDB()) { List <userTbl> users = getAllUsers(); ArrayList usersAL = new ArrayList(); foreach (var user in users) { if (user.status < 3) { usersAL.Add(user); } } return(usersAL); } }
public static int getInstitutionNumberByName(String institue) { using (var db = new HeznekDB()) { int instituteNum = 0; var query = (from academicInstitutTbl in db.academicInstitutTbl where (academicInstitutTbl.nameOfInstitut.Equals(institue)) select academicInstitutTbl.sn); try { instituteNum = query.Last(); } catch { return(0); } return(instituteNum); } }
public static int getCityNumberByName(String city) { using (var db = new HeznekDB()) { int cityNum = 0; var query = (from cityTbl in db.cityTbl where (cityTbl.city.Equals(city)) select cityTbl.sn); try { cityNum = query.ToArray().Last(); } catch { return(0); } return(cityNum); } }
public static int getnumberOfFieldByName(String field) { int fieldNum = 0; using (var db = new HeznekDB()) { var query = (from studyFieldTbl in db.studyFieldTbl where (studyFieldTbl.field.Equals(field)) select studyFieldTbl.sn); try { fieldNum = query.Last(); } catch { return(0); } return(fieldNum); } }