示例#1
0
 public bool Add(EximinationCenter eximination)
 {
     try
     {
         repo.EximinationCenters.Add(eximination);
         repo.SaveChanges();
         return(true);
     }catch (Exception ex)
     {
         return(false);
     }
 }
示例#2
0
        //public bool SaveAll()
        //{

        //    //return dBWebData.SaveChanges() > 0;
        //}
        public void Add(Registation registation)
        {
            try
            {
                Console.WriteLine(registation.Email);
                repo.Registations.Add(registation);
                repo.SaveChanges();
            }
            catch (Exception e)
            {
                Console.WriteLine(e);
            }
        }
示例#3
0
        public bool Add(StudentAdmitCard card)
        {
            try
            {
                StudentAdmitCard student = dBAccess.StudentAdmitCards.FirstOrDefault(f => f.GenrateExameFor == card.GenrateExameFor);
                if (student != null)
                {
                    return(false);
                }

                IEnumerable <Registation> registations = dBAccess.Registations.Where(r => r.ExaminationApplied == card.GenrateExameFor);
                if (registations == null)
                {
                    return(false);
                }
                List <StudentAdmitCard> admitCards = new List <StudentAdmitCard>();
                foreach (Registation registation in registations)
                {
                    card.Roll     = card.GenrateExameFor + registation.Registration_number;
                    card.Password = card.GenrateExameFor + registation.Password;
                    admitCards.Add(card);
                }
                dBAccess.StudentAdmitCards.AddRange(admitCards);
                dBAccess.SaveChanges();
                return(true);
            }catch (Exception ex)
            {
                return(false);
            }
        }
示例#4
0
 public bool Add(Registation registation)
 {
     try
     {
         if (UserExistes(registation.Email, registation.Mobile))
         {
             return(false);
         }
         registation.Registration_number = (20200001 + getTotalNumberOfReg()).ToString();
         Console.WriteLine(registation.Email);
         repo.Registations.Add(registation);
         repo.SaveChanges();
         return(true);
     }
     catch (Exception e)
     {
         Console.WriteLine(e);
         return(false);
     }
 }
示例#5
0
 public bool Add(Enrollment enrollment)
 {
     try
     {
         if (repo.EximinationCenters.FirstOrDefault(e => e.Code == enrollment.ExameCenter).SeatAvailable <= 0)
         {
             return(false);
         }
         cernterRepositry.SeatUpdate(enrollment.ExameCenter);
         repo.Enrollments.Add(enrollment);
         repo.SaveChanges();
         return(true);
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex);
         return(false);
     }
 }