Пример #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);
            }
        }