예제 #1
0
 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 = " שם משתמש או סיסמא אינם נכונים, נסה שוב";
             }
         }
     }
 }
예제 #2
0
        /* 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();
            }
        }
예제 #3
0
 /*Add function*/
 public static void addBankToList(bank bank)
 {
     using (var db = new HeznekDB())
     {
         db.bank.Add(bank);
         db.SaveChanges();
     }
 }
예제 #4
0
        /*Get function*/

        public static List <bank> getAllBanks()
        {
            using (var db = new HeznekDB())
            {
                List <bank> banks = db.bank.ToList();
                return(banks);
            }
        }
예제 #5
0
        /*
         * 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();
            }
        }
예제 #6
0
 /// <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);
     }
 }
예제 #7
0
 /// <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);
     }
 }
예제 #8
0
 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;
     }
 }
예제 #9
0
        /*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);
                    }
                }
            }
        }
예제 #10
0
        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();
        }
예제 #11
0
        /*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);
                    }
                }
            }
        }
예제 #12
0
        /// <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);
            }
        }
예제 #13
0
 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);
     }
 }
예제 #14
0
 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);
     }
 }
예제 #15
0
        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);
            }
        }