Beispiel #1
0
        public void GetExcel()
        {
            List <Membrii> allCust = new List <Membrii>();

            using (ArtClubContext dc = new ArtClubContext())
            {
                allCust = dc.Membriis.ToList();
            }

            WebGrid grid = new WebGrid(source: allCust, canPage: false, canSort: false);

            string gridData = grid.GetHtml(
                columns: grid.Columns(
                    grid.Column("ID_Username", "Username"),
                    grid.Column("Nume", "Nume"),
                    grid.Column("Prenume", "Prenume"),
                    grid.Column("Email", "Email"),
                    grid.Column("Parola", "Parola"),
                    grid.Column("ID_NumeFunctie", "NumeFunctie")
                    )
                ).ToString();


            Response.ClearContent();
            Response.AddHeader("content-disposition", "attachment; filename=Membrii.xls");
            Response.ContentType = "application/vnd.ms-excel"; //excel

            Response.Write(gridData);
            Response.End();
        }
        public UnitOfWork(ArtClubContext context,
                          IRepository <Admin> admins,
                          IRepository <Course> courses,
                          IRepository <Event> events,
                          IRepository <HistoryPart> history,
                          IRepository <Member> members,
                          IMemberCourseRepository memberCourses,
                          IRepository <Resource> inventory,
                          IRepository <Room> rooms,
                          IRepository <Trainer> trainers,
                          IRepository <TrainerCourse> trainerCourses,
                          IRepository <User> users)
        {
            _context = context;

            Admins         = admins;
            Courses        = courses;
            Events         = events;
            History        = history;
            Members        = members;
            MemberCourses  = memberCourses;
            Inventory      = inventory;
            Rooms          = rooms;
            Trainers       = trainers;
            TrainerCourses = trainerCourses;
            Users          = users;
        }
        //newwww
        public override string[] GetRolesForUser(string username)
        {
            ArtClubContext db   = new ArtClubContext();
            string         data = db.Membriis.Where(a => a.ID_Username == username).SingleOrDefault().ID_NumeFunctie;

            string[] result = { data };
            return(result);
        }
 public List <Resurse> GetTables(string search, string sort, string sortdir, int skip, int pageSize, out int totalRecord)
 {
     using (ArtClubContext dc = new ArtClubContext())
     {
         var v = (from a in dc.Resurses
                  where
                  a.ID_NumeResursa.Contains(search) ||
                  a.ID_Locatie.Contains(search) ||
                  a.CostZi.Contains(search) ||
                  a.ID_Status.Contains(search)
                  select a
                  );
         totalRecord = v.Count();
         v           = v.OrderBy(sort + " " + sortdir); //linq.dynamic
         if (pageSize > 0)
         {
             v = v.Skip(skip).Take(pageSize);
         }
         return(v.ToList());
     }
 }
Beispiel #5
0
 public List <Membrii> GetTables(string search, string sort, string sortdir, int skip, int pageSize, out int totalRecord)
 {
     using (ArtClubContext dc = new ArtClubContext())
     {
         var v = (from a in dc.Membriis
                  where
                  a.Nume.Contains(search) ||
                  a.Prenume.Contains(search) ||
                  a.Email.Contains(search) ||
                  a.ID_NumeFunctie.Contains(search) ||
                  a.ID_Username.Contains(search)
                  select a
                  );
         totalRecord = v.Count();
         v           = v.OrderBy(sort + " " + sortdir); //linq.dynamic
         if (pageSize > 0)
         {
             v = v.Skip(skip).Take(pageSize);
         }
         return(v.ToList());
     }
 }
Beispiel #6
0
        public ActionResult SaveData(List <Membrii> Membrii)
        {
            bool status = false;

            if (ModelState.IsValid)
            {
                using (ArtClubContext dc = new ArtClubContext())
                //using()
                {
                    foreach (var i in Membrii)
                    {
                        dc.Membriis.Add(i);
                    }
                    dc.SaveChanges();
                    status = true;
                    Console.WriteLine(status);
                }
            }
            return(new JsonResult {
                Data = new { status = status }
            });
        }
 public MemberCourseRepository(ArtClubContext context)
     : base(context)
 {
 }
Beispiel #8
0
 public Repository(ArtClubContext context)
 {
     _context = context;
     _dbSet   = context.Set <T>();
 }