public static List<TrainingCourse> GetCoursesByLocation(string _location)
        {
            TeachinVietnamDataContext dbContext = new TeachinVietnamDataContext();
            var courseList = dbContext.proc_GetCoursesByLocation(_location);

            List<TrainingCourse> mylist = new List<TrainingCourse>();
            foreach (var c in courseList)
            {
                TrainingCourse tc = new TrainingCourse();
                //tc.Id = c.tc_id.ToString();
                tc.Guid = c.tc_empId.ToString();
                //tc.Name = c.tc_name;
                //tc.Certificate = (int)c.tc_certificate;
                //tc.Category = (int)c.tc_category;
                //tc.Location = (int)c.tc_location;
                tc.Length = c.tc_length;
                tc.Timetable = c.tc_timetable;
                tc.Cost = c.tc_cost;
                tc.Entry = c.tc_entryRequirement;
                tc.Contact = c.tc_contact;
                tc.Coursecontent = c.tc_courseContent;
                tc.Benefit = c.tc_teacherBenefit;
                tc.ViewCount = (int)c.tc_viewCount;

                mylist.Add(tc);
            }
            return mylist;
        }
Exemplo n.º 2
0
 public static List<FeaturedLogo> GetAll()
 {
     TeachinVietnamDataContext dbContext = new TeachinVietnamDataContext();
     var all = dbContext.tbl_feature_logos.Where(x=>x.active==true).OrderByDescending(x => x.SortOrder);
     List<FeaturedLogo> list = new List<FeaturedLogo>();
     foreach (var obj in all)
     {
         FeaturedLogo fl = new FeaturedLogo();
         fl.orgName = obj.OrganizationName;
         fl.logo = obj.logo;
         fl.username = obj.username;
         list.Add(fl);
     }
     return list;
 }
Exemplo n.º 3
0
 public static FeaturedLogo GetFeatureLogoById(int _id)
 {
     TeachinVietnamDataContext dbContext = new TeachinVietnamDataContext();
     proc_feature_logo_GetByIdResult logo = dbContext.proc_feature_logo_GetById(_id).FirstOrDefault();
     if (logo != null)
     {
         FeaturedLogo fl = new FeaturedLogo();
         fl.id = logo.id;
         fl.Active = (bool)logo.active;
         fl.OrgName = logo.OrganizationName;
         fl.Logo = logo.logo;
         fl.Username = logo.username;
         fl.SortOrder = Convert.ToInt32(logo.SortOrder);
         return fl;
     }
     return null;
 }
        public static List<TrainingCourse> GetAllTrainingCourse()
        {
            try
            {
                List<TrainingCourse> tcList = new List<TrainingCourse>();
                TeachinVietnamDataContext dbContext = new TeachinVietnamDataContext();
                var allTrainingCourseList = (from tc in dbContext.tbl_TrainingCourses
                                            where tc.tc_active == true
                                            select tc).Take(100);
                foreach (var c in allTrainingCourseList)
                {
                    TrainingCourse tc = new TrainingCourse();
                    tc.Id = c.tc_id.ToString();
                    tc.Guid = c.tc_empId.ToString();
                    tc.Name = c.tc_name;
                    tc.Certificate = (int)c.tc_certificate;
                    tc.Category = (int)c.tc_category;
                    tc.Location = (int)c.tc_location;
                    tc.Length = c.tc_length;
                    tc.Timetable = c.tc_timetable;
                    tc.Cost = c.tc_cost;
                    tc.Entry = c.tc_entryRequirement;
                    tc.Contact = c.tc_contact;
                    tc.Coursecontent = c.tc_courseContent;
                    tc.Benefit = c.tc_teacherBenefit;
                    tc.ViewCount = (int)c.tc_viewCount;

                    tcList.Add(tc);
                }
                return tcList;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 5
0
        public static List<Intership> GetAll()
        {
            dbContext = new TeachinVietnamDataContext();
            var allIntership = dbContext.tbl_Interships.Where(x => x.active == true).OrderByDescending(x => x.createdDate);
            List<Intership> ilist = new List<Intership>();
            foreach (var i in allIntership)
            {
                Intership _intership = new Intership();
                _intership.id = i.id;
                _intership.articleName = i.articleName;
                _intership.articleIntroduction = i.articleIntroduction.Replace(Environment.NewLine, "<br />");
                _intership.articleContent = i.articleContent.Replace(Environment.NewLine, "<br />");
                _intership.active = (bool)i.active;
                _intership.createdDate = (DateTime)i.createdDate;
                _intership.enableFreeGuide = i.EnableFreeGuide != null ? (bool)i.EnableFreeGuide : false;
                _intership.enableApplyOnline = i.EnableApplyOnline != null ? (bool)i.EnableApplyOnline : false;

                ilist.Add(_intership);
            }
            return ilist;
        }
Exemplo n.º 6
0
 public static void UpdateLogo(int _id, int _displayOrder, bool _active)
 {
     try
     {
         TeachinVietnamDataContext dbContext = new TeachinVietnamDataContext();
         dbContext.proc_feature_logo_update(_id,  _active,_displayOrder);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
 public CourseBusinessFacade()
 {
     dbContext = new TeachinVietnamDataContext();
 }
Exemplo n.º 8
0
 public static void DeleteAIntershipArticle(int id)
 {
     try
     {
         dbContext = new TeachinVietnamDataContext();
         dbContext.proc_deleteAIntershipArticle(id);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 9
0
 public InternshipGuide()
 {
     dbContext = new TeachinVietnamDataContext();
 }
 public InternshipUserSubmit()
 {
     dbContext = new TeachinVietnamDataContext();
 }
Exemplo n.º 11
0
 public static void InsertNewCourse(string _guid, string _certificate, string _length, string _timetable, string _cost, string _entry, string _contact, string _content, string _benefit)
 {
     try
     {
         TeachinVietnamDataContext dbContext = new TeachinVietnamDataContext();
         Guid guid = new Guid(_guid);
         //dbContext.proc_InsertTrainingCourse(guid, _certificate, _length, _timetable, _cost, _entry, _contact, _content, _benefit,true);
         dbContext.SubmitChanges();
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 12
0
 public static void UpdateArticle(int _id, int _parentId, string _title, string _mainContent, bool _displayOnMenu, int _displayOrder, bool _active)
 {
     try
     {
         dbContext = new TeachinVietnamDataContext();
         dbContext.proc_service_article_updateArticleById(_id, _parentId, _title, _mainContent, _displayOnMenu, _displayOrder, _active);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 13
0
 public static List<ServiceArticle> GetAll()
 {
     dbContext = new TeachinVietnamDataContext();
     var allArticles = dbContext.tbl_service_articles.Where(x => x.active == true).OrderByDescending(x => x.displayOrder).ThenByDescending(x => x.createdDate).ToList();
     List<ServiceArticle> saList = new List<ServiceArticle>();
     foreach (var article in allArticles)
     {
         ServiceArticle sa = new ServiceArticle();
         sa.id = article.id;
         sa.parentId = Convert.ToInt32(article.parentId);
         sa.title = article.title;
         sa.mainContent = article.maincontent.Replace(Environment.NewLine, "<br />");
         sa.createdDate = (DateTime)article.createdDate;
         sa.displayOnMenu = (bool)article.displayOnMenu;
         sa.DisplayOrder = Convert.ToInt32(article.displayOrder);
         sa.active = (bool)article.active;
         saList.Add(sa);
     }
     return saList;
 }
Exemplo n.º 14
0
        public static bool hasParentNotRoot(int _id)
        {
            bool hasParent = false;
            dbContext = new TeachinVietnamDataContext();
            if (dbContext.proc_service_article_hasParentNotRoot(_id).Count() > 0)
            {
                hasParent = true;
            }

            return hasParent;
        }
Exemplo n.º 15
0
 public static List<ServiceArticle> GetSubArticlesById(int _id)
 {
     dbContext = new TeachinVietnamDataContext();
     var list = dbContext.proc_service_article_GetSubArtiles(_id);
     List<ServiceArticle> saList = new List<ServiceArticle>();
     foreach (var article in list)
     {
         ServiceArticle sa = new ServiceArticle();
         sa.id = article.id;
         sa.parentId = Convert.ToInt32(article.parentId);
         sa.title = article.title;
         sa.mainContent = article.maincontent.Replace(Environment.NewLine, "<br />");
         sa.createdDate = (DateTime)article.createdDate;
         sa.displayOnMenu = (bool)article.displayOnMenu;
         sa.DisplayOrder = Convert.ToInt32(article.displayOrder);
         sa.active = (bool)article.active;
         saList.Add(sa);
     }
     return saList;
 }
Exemplo n.º 16
0
 public static ServiceArticle GetArticleById(int id)
 {
     dbContext = new TeachinVietnamDataContext();
     proc_service_article_getArticleByIdResult article = dbContext.proc_service_article_getArticleById(id).FirstOrDefault();
     if (article != null)
     {
         ServiceArticle sa = new ServiceArticle();
         sa.id = article.id;
         sa.parentId = Convert.ToInt32(article.parentId);
         sa.title = article.title;
         sa.mainContent = article.maincontent.Replace(Environment.NewLine, "<br />");
         sa.createdDate = (DateTime)article.createdDate;
         sa.DisplayOrder =Convert.ToInt32(article.displayOrder);
         sa.displayOnMenu = (bool)article.displayOnMenu;
         sa.active = (bool)article.active;
         return sa;
     }
     return null;
 }
Exemplo n.º 17
0
 public static List<KeyValuePair<int, string>> GetAllIdAndTitle()
 {
     dbContext = new TeachinVietnamDataContext();
     List<KeyValuePair<int, string>> allArticles = dbContext.tbl_service_articles.Where(x => x.active == true).Select(x => new KeyValuePair<int, string>(x.id, x.title)).ToList();
     return allArticles;
 }
Exemplo n.º 18
0
 public static void Insert(string title, string firstname,string lastname,string email,string country,string phone)
 {
     TeachinVietnamDataContext dbContext = new TeachinVietnamDataContext();
     dbContext.proc_Internship_Guide_Insert(title,firstname,lastname, email, country, phone);
 }
Exemplo n.º 19
0
 public static void InsertNewLogo(string _username, int _displayOrder)
 {
     try
     {
         TeachinVietnamDataContext dbContext = new TeachinVietnamDataContext();
         dbContext.proc_feature_logo_insert(_username, _displayOrder);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemplo n.º 20
0
        public static Intership getIntershipById(int id, bool selectAll = false)
        {
            dbContext = new TeachinVietnamDataContext();
            BusinessLogic.proc_getIntershipByIdResult i = null;
            if (selectAll == false)
            {
                i = dbContext.proc_getIntershipById(id).Where(x => x.active == true).FirstOrDefault();
            }
            else
            {
                i = dbContext.proc_getIntershipById(id).FirstOrDefault();
            }
            if (i != null)
            {
                Intership _intership = new Intership();
                _intership.id = i.id;
                _intership.articleName = i.articleName;
                _intership.articleIntroduction = i.articleIntroduction.Replace(Environment.NewLine, "<br />");
                _intership.articleContent = i.articleContent.Replace(Environment.NewLine, "<br />");
                _intership.active = (bool)i.active;
                _intership.createdDate = (DateTime)i.createdDate;
                _intership.enableFreeGuide = i.EnableFreeGuide != null ? (bool)i.EnableFreeGuide : false;
                _intership.enableApplyOnline = i.EnableApplyOnline != null ? (bool)i.EnableApplyOnline : false;

                return _intership;
            }
            return null;
        }
Exemplo n.º 21
0
        public static List<TrainingCourse> SearchCourses(string _courseName,string _cateId,string _levelId,string _locationId)
        {
            try
             {
                 int? cId=0;
                //int? cId = Convert.ToInt16(_cateId);
                //int? leId = Convert.ToInt16(_levelId);
                //int? loId = Convert.ToInt16(_locationId);
                 short cIdd;
                 if (Int16.TryParse(_cateId, out cIdd))
                 {
                     cId = cIdd;
                 }

                List<TrainingCourse> tcList = new List<TrainingCourse>();
                TeachinVietnamDataContext dbContext = new TeachinVietnamDataContext();
                var allTrainingCourseList = from tc in dbContext.tbl_TrainingCourses
                                            where tc.tc_active == true &&
                                                  tc.tc_name.Contains(_courseName) &&
                                                  tc.tc_category==cId //&&
                                                  //tc.tc_location==loId &&
                                                  //tc.tc_certificate==leId
                                            select tc;
                foreach (var c in allTrainingCourseList)
                {
                    TrainingCourse tc = new TrainingCourse();
                    tc.Id = c.tc_id.ToString();
                    tc.Guid = c.tc_empId.ToString();
                    tc.Name = c.tc_name;
                    tc.Certificate = (int)c.tc_certificate;
                    tc.Category = (int)c.tc_category;
                    tc.Location = (int)c.tc_location;
                    tc.Length = c.tc_length;
                    tc.Timetable = c.tc_timetable;
                    tc.Cost = c.tc_cost;
                    tc.Entry = c.tc_entryRequirement;
                    tc.Contact = c.tc_contact;
                    tc.Coursecontent = c.tc_courseContent;
                    tc.Benefit = c.tc_teacherBenefit;
                    tc.ViewCount = (int)c.tc_viewCount;

                    tcList.Add(tc);
                }
                return tcList;
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
Exemplo n.º 22
0
        public static void Insert(string title, string introduction, string body, bool isActive, bool enableFreeGuide, bool enableApplyOnline)
        {
            try
            {
                //dbContext = new TeachinVietnamDataContext();
                //string insertCommand = string.Format("EXEC [dbo].[proc_insertIntership] N'{0}',N'{1}',N'{2}',{3},{4},{5}", title, introduction, body, isActive == true ? "1" : "0", enableFreeGuide == true ? "1" : "0", enableApplyOnline == true ? "1" : "0");
                //dbContext.ExecuteCommand(insertCommand);

                dbContext = new TeachinVietnamDataContext();
                var result = dbContext.proc_insertIntership(title, introduction, body, isActive, enableFreeGuide, enableApplyOnline);

            }
            catch (Exception e)
            {
                throw e;
            }
        }
Exemplo n.º 23
0
 public static void UpdateIntership(int id, string title, string intro, string body, bool active, bool enableFreeGuide, bool enableApplyOnline)
 {
     dbContext = new TeachinVietnamDataContext();
     var result = dbContext.proc_UpdateInternship(id, title, intro, body, active, enableFreeGuide, enableApplyOnline);
 }
Exemplo n.º 24
0
 public Intership()
 {
     dbContext = new TeachinVietnamDataContext();
 }
 public static void Insert(string title, string firstname, string lastname, string email, string country, string phone, string whenshouldwecall,string fullPath)
 {
     TeachinVietnamDataContext dbContext = new TeachinVietnamDataContext();
     dbContext.proc_Internship_UserSubmit_Insert(title, firstname, lastname, email, country, phone, whenshouldwecall, fullPath);
 }
Exemplo n.º 26
0
 public TrainingCourse()
 {
     dbContext = new TeachinVietnamDataContext();
 }