예제 #1
0
 public List <ict_GraduateCourse> GetGraduateCourses()
 {
     using (var context = new assignmentEntities())
     {
         return(context.ict_GraduateCourse.ToList());
     }
 }
예제 #2
0
        // GET: Country
        public ActionResult Index()
        {
            assignmentEntities countrylist = new assignmentEntities();

            ViewBag.country = new SelectList(GetCountries(), "id", "name");
            return(View());
        }
예제 #3
0
        public List <country> GetCountries()
        {
            assignmentEntities countrylist = new assignmentEntities();
            List <country>     countries   = countrylist.countries.ToList();

            return(countries);
        }
예제 #4
0
 public List <ict_ProgramOverview> GetOverview()
 {
     using (var context = new assignmentEntities())
     {
         return(context.ict_ProgramOverview.ToList());
     }
 }
예제 #5
0
 public List <ict_DiplomaCourse> GetDiplomaCourses()
 {
     using (var context = new assignmentEntities())
     {
         return(context.ict_DiplomaCourse.ToList());
     }
 }
예제 #6
0
 public List <ict_Degree> GetDegreePrograms()
 {
     using (var context = new assignmentEntities())
     {
         return(context.ict_Degree.ToList());
     }
 }
예제 #7
0
 public List <ict_Student> GetALLStudents()
 {
     using (var context = new assignmentEntities())
     {
         return(context.ict_Student.ToList());
     }
 }
예제 #8
0
 public string GetDegree()
 {
     using (var context = new assignmentEntities())
     {
         return(context.ict_Degree.Where(d => d.degreeCode == "BSD").ToString());
     }
 }
예제 #9
0
 public List <ict_Staff> SearchStaff()
 {
     using (var context = new assignmentEntities())
     {
         return(context.ict_Staff.Where(s => s.lastName == search).ToList());
     }
 }
예제 #10
0
 /// <summary>
 /// Get all ictPage objects
 /// </summary>
 /// <returns>Generic list of ictPage objects</returns>
 public List <ict_Page> GetAllPages()
 {
     using (var context = new assignmentEntities())
     {
         return(context.ict_Page.OrderByDescending(p => p.DateModified).ToList());
     }
 }
예제 #11
0
 public ict_Page GetPageByID(int id)
 {
     using (var context = new assignmentEntities())
     {
         return(context.ict_Page.FirstOrDefault(p => p.PageID == id));
     }
 }
예제 #12
0
        public ActionResult GetStates(int cid)
        {
            assignmentEntities countrylist = new assignmentEntities();
            List <state>       states      = countrylist.states.Where(x => x.countryid == cid).ToList();

            ViewBag.states = new SelectList(states, "id", "name");
            return(PartialView("States"));
        }
예제 #13
0
    /*     /// <summary>
     *   /// Get ictPage objects for a list control
     *   /// </summary>
     *   /// <returns>Generic list of custom ictPage objects</returns>
     *   public List<ListPage> GetListOfAllPages()
     *   {
     *       using (var context = new assignmentEntities())
     *       {
     *           var pages = from p in context.ict_Page
     *                       orderby p.Title
     *                       select new ListPage { PageID = p.PageID, Title = p.Title };
     *           return pages.ToList();
     *       }
     *   }
     *
     */



    public void UpdatePageContentByID(int pageID, string Title, string Content)
    {
        using (var context = new assignmentEntities())
        {
            ict_Page p = context.ict_Page.Single(h => h.PageID == pageID);

            p.Title        = Title.Trim();
            p.Content      = Content.Trim();
            p.DateCreated  = DateTime.Now;
            p.DateModified = DateTime.Now;
            //  p.URL = context.ict_Page.Single(q => q.ID == pageID).URL;


            context.SaveChanges();
        }
    }
예제 #14
0
    public bool CreateNewEditablePage(string name, string inFolder)
    {
        // This version does not permit overwrites
        // It could, if the UI had a check box to permit overwrite/replace
        // Then add a parameter to the method to handle and process it

        // This method depends upon the following:
        // editablepage.aspx in the ~/author folder
        // An entity named ictPage, with the properties referenced below
        // A "new page creator" web form, which calls this method
        // The web form that calls this method must have the
        // correctly-configured <location> block in Web.config

        // Clean up the arguments which were passed in
        name = name.Trim().ToLower();

        //  inFolder = inFolder.Trim().ToLower();

        _app = System.Web.HttpContext.Current.ApplicationInstance;

        // Check whether file "name" already exists "inFolder"...

        // Create new proposed folder
        string folder = string.Format("{0}/{1}", _app.Server.MapPath("~/"), inFolder);
        //  string folder = Path.Combine(_app.Server.MapPath("~/"), inFolder);
        // Create new proposed file names
        string newMarkup = Path.Combine(folder, name + ".aspx");
        string newCsharp = Path.Combine(folder, name + ".aspx.cs");

        if (File.Exists(newMarkup))
        {
            return(false);
        }
        else
        {
            // Get references to the editablepage.aspx and .cs
            // Use the technique that you used in your Lab 3 code
            // to get access to the http context
            string markup = _app.Server.MapPath("~/author/editablepage.aspx");
            string csharp = _app.Server.MapPath("~/author/editablepage.aspx.cs");

            // Copy the editable page template files
            File.Copy(markup, newMarkup, true);
            File.Copy(csharp, newCsharp, true);

            // Open the text of the aspx page
            StreamReader sr         = File.OpenText(newMarkup);
            string       markupText = sr.ReadToEnd();
            sr.Close();

            // Change the CodeFile attribute in the Page directive to the new file name
            markupText = markupText.Replace("editablepage.aspx", name + ".aspx");
            StreamWriter sw = File.CreateText(newMarkup);
            sw.Write(markupText);
            sw.Close();

            // Create a new ictPage content item
            ict_Page page = null;
            using (var context = new assignmentEntities())
            {
                page              = new ict_Page();
                page.DateCreated  = DateTime.Now;
                page.DateModified = DateTime.Now;
                page.Title        = "New page - " + name;
                page.Content      = string.Format("<h3>New page - {0}</h3><p>New Page</p>", name);

                context.ict_Page.AddObject(page);
                context.SaveChanges();
            }

            // Open the text of the C# code file
            sr = null;
            sr = File.OpenText(newCsharp);
            string csharpText = sr.ReadToEnd();
            sr.Close();

            // Change the placeholder "pageID" value
            csharpText = csharpText.Replace("pageID = 0", "pageID = " + page.PageID.ToString());
            sw         = null;
            sw         = File.CreateText(newCsharp);
            sw.Write(csharpText);
            sw.Close();

            return(true);
        }
    }
예제 #15
0
 public string GetDegree()
 {
     using (var context = new assignmentEntities())
     {
         return context.ict_Degree.Where(d => d.degreeCode == "BSD").ToString();
     }
 }
예제 #16
0
 public List<ict_Staff> SearchStaff()
 {
     using (var context = new assignmentEntities())
     {
         return context.ict_Staff.Where(s => s.lastName == search).ToList();
     }
 }
예제 #17
0
 public ict_Page GetPageByID(int id)
 {
     using (var context = new assignmentEntities())
     {
         return context.ict_Page.FirstOrDefault(p => p.PageID == id);
     }
 }
예제 #18
0
 public List<ict_ProgramOverview> GetOverview()
 {
     using (var context = new assignmentEntities())
     {
         return context.ict_ProgramOverview.ToList();
     }
 }
예제 #19
0
 public List<ict_GraduateCourse> GetGraduateCourses()
 {
     using (var context = new assignmentEntities())
     {
         return context.ict_GraduateCourse.ToList();
     }
 }
예제 #20
0
 public List<ict_DiplomaCourse> GetDiplomaCourses()
 {
     using (var context = new assignmentEntities())
     {
         return context.ict_DiplomaCourse.ToList();
     }
 }
예제 #21
0
 public List<ict_Degree> GetDegreePrograms()
 {
     using (var context = new assignmentEntities())
     {
         return context.ict_Degree.ToList();
     }
 }
예제 #22
0
 /// <summary>
 /// Get all ictPage objects
 /// </summary>
 /// <returns>Generic list of ictPage objects</returns>
 public List<ict_Page> GetAllPages()
 {
     using (var context = new assignmentEntities())
        {
            return context.ict_Page.OrderByDescending(p => p.DateModified).ToList();
        }
 }
예제 #23
0
 public List<ict_Student> GetALLStudents()
 {
     using (var context = new assignmentEntities())
     {
         return context.ict_Student.ToList();
     }
 }
예제 #24
0
    /*     /// <summary>
       /// Get ictPage objects for a list control
       /// </summary>
       /// <returns>Generic list of custom ictPage objects</returns>
       public List<ListPage> GetListOfAllPages()
       {
           using (var context = new assignmentEntities())
           {
               var pages = from p in context.ict_Page
                           orderby p.Title
                           select new ListPage { PageID = p.PageID, Title = p.Title };
               return pages.ToList();
           }
       }

    */
    public void UpdatePageContentByID(int pageID, string Title, string Content)
    {
        using (var context = new assignmentEntities())
           {
               ict_Page p = context.ict_Page.Single(h => h.PageID == pageID);

               p.Title = Title.Trim();
               p.Content = Content.Trim();
               p.DateCreated = DateTime.Now;
               p.DateModified = DateTime.Now;
             //  p.URL = context.ict_Page.Single(q => q.ID == pageID).URL;

               context.SaveChanges();
           }
    }
예제 #25
0
    public bool CreateNewEditablePage(string name, string inFolder)
    {
        // This version does not permit overwrites
           // It could, if the UI had a check box to permit overwrite/replace
           // Then add a parameter to the method to handle and process it

           // This method depends upon the following:
           // editablepage.aspx in the ~/author folder
           // An entity named ictPage, with the properties referenced below
           // A "new page creator" web form, which calls this method
           // The web form that calls this method must have the
           // correctly-configured <location> block in Web.config

           // Clean up the arguments which were passed in
           name = name.Trim().ToLower();

         //  inFolder = inFolder.Trim().ToLower();

           _app = System.Web.HttpContext.Current.ApplicationInstance;

           // Check whether file "name" already exists "inFolder"...

           // Create new proposed folder
          string folder = string.Format("{0}/{1}", _app.Server.MapPath("~/"), inFolder);
         //  string folder = Path.Combine(_app.Server.MapPath("~/"), inFolder);
           // Create new proposed file names
           string newMarkup = Path.Combine(folder, name + ".aspx");
           string newCsharp = Path.Combine(folder, name + ".aspx.cs");

           if (File.Exists(newMarkup))
           {
               return false;
           }
           else
           {
               // Get references to the editablepage.aspx and .cs
               // Use the technique that you used in your Lab 3 code
               // to get access to the http context
               string markup = _app.Server.MapPath("~/author/editablepage.aspx");
               string csharp = _app.Server.MapPath("~/author/editablepage.aspx.cs");

               // Copy the editable page template files
               File.Copy(markup, newMarkup, true);
               File.Copy(csharp, newCsharp, true);

               // Open the text of the aspx page
               StreamReader sr = File.OpenText(newMarkup);
               string markupText = sr.ReadToEnd();
               sr.Close();

               // Change the CodeFile attribute in the Page directive to the new file name
               markupText = markupText.Replace("editablepage.aspx", name + ".aspx");
               StreamWriter sw = File.CreateText(newMarkup);
               sw.Write(markupText);
               sw.Close();

               // Create a new ictPage content item
               ict_Page page = null;
               using (var context = new assignmentEntities())
               {
                   page = new ict_Page();
                   page.DateCreated = DateTime.Now;
                   page.DateModified = DateTime.Now;
                   page.Title = "New page - " + name;
                   page.Content = string.Format("<h3>New page - {0}</h3><p>New Page</p>", name);

                   context.ict_Page.AddObject(page);
                   context.SaveChanges();
               }

               // Open the text of the C# code file
               sr = null;
               sr = File.OpenText(newCsharp);
               string csharpText = sr.ReadToEnd();
               sr.Close();

               // Change the placeholder "pageID" value
               csharpText = csharpText.Replace("pageID = 0", "pageID = " + page.PageID.ToString());
               sw = null;
               sw = File.CreateText(newCsharp);
               sw.Write(csharpText);
               sw.Close();

               return true;
           }
    }