public static int GetCityID(string CityName) { try { using (IwillDbEntities DBC = new IwillDbEntities()) { var cupper = CityName.ToUpper(); var data = DBC.Cities.Where(i => CityName.ToUpper().IndexOf(i.CName.ToUpper()) == 0).FirstOrDefault(); //foreach(var i in DBC.Cities) //{ // var dupper = i.CName.ToUpper(); // if (cupper.IndexOf(dupper) == 0) // { // } //} if (data != null) { return(Convert.ToInt32(data.CTID)); } return(0); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static ModelUserProfile AddUserSocialLinks(ModelUserProfile Userlinks, string IsAdd) { try { using (IwillDbEntities DBC = new IwillDbEntities()) { //var Links = new ModelUserSocialLinks() { }; if (Helper.User == null) { throw new Exception("User not found"); } var User = DBC.Users.Where(i => i.UID == Helper.User.UID).FirstOrDefault(); User.FacebookUrl = Userlinks.FacebookUrl; User.LinkedInUrl = Userlinks.LinkedInUrl; User.PlusGoogleUrl = Userlinks.PlusGoogleUrl; User.TwitterUrl = Userlinks.TwitterUrl; var Isrecord = DBC.SaveChanges(); return(Userlinks); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static List <UserQuestionDetail> GetRegQuestionDetails(Int64 UQID) { using (IwillDbEntities DBC = new IwillDbEntities()) { var data = DBC.UserQuestionDetails.Where(i => i.FkQID == UQID && i.IsActive == true).ToList(); return(data); } }
public static SelectList GetYear() { try { IwillDbEntities DBC = new IwillDbEntities(); return(new SelectList(DBC.Years.ToList(), "Year1", "Year1", 0)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static SelectList GetEducationTypes() { try { IwillDbEntities DBC = new IwillDbEntities(); return(new SelectList(DBC.EducationTypes.ToList(), "ETID", "EName", 0)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static SelectList GetRoles(long SelectedIndex) { try { IwillDbEntities DBC = new IwillDbEntities(); return(new SelectList(DBC.Roles.ToList(), "RID", "RName", SelectedIndex)); } catch (Exception ex) { throw new Exception(ex.Message); } }
public static List <Role> GetRoles() { try { using (IwillDbEntities DBC = new IwillDbEntities()) { return(DBC.Roles.ToList()); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static SelectList GetCourseCategories() { try { using (IwillDbEntities DBC = new IwillDbEntities()) { return(new SelectList(DBC.CourseCategories.ToList(), "CCID", "CCName", 0)); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static SelectList GetQuestionairTypes() { try { using (IwillDbEntities DBC = new IwillDbEntities()) { return(new SelectList(DBC.QuestionTypes.ToList(), "QTID", "QTName", 0)); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static List <UserGivenQuesAn> GetQuestionsOPtions(Int64?QID) { try { using (IwillDbEntities DBC = new IwillDbEntities()) { return(DBC.UserGivenQuesAns.Where(data => data.FkUQID == QID).ToList()); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static List <UserFollower> GetUserFollowing(long UID) { try { using (IwillDbEntities DBC = new IwillDbEntities()) { return(DBC.UserFollowers.Where(i => i.FkFollowerID == UID).ToList()); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static List <UserQuestionDetail> GetQuestionDetaills(Int64 UQID) { try { using (IwillDbEntities DBC = new IwillDbEntities()) { var data = DBC.UserQuestionDetails.Where(i => i.FkQID == UQID).ToList(); return(data); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static int GetCountryID(string CountryName) { try { using (IwillDbEntities DBC = new IwillDbEntities()) { var data = DBC.Countries.Where(i => CountryName.ToUpper().IndexOf(i.CTName.ToUpper()) == 0).FirstOrDefault(); if (data != null) { return(Convert.ToInt32(data.CTRYID)); } return(0); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static string GetGender(byte?GID) { try { using (IwillDbEntities DBC = new IwillDbEntities()) { var data = DBC.Genders.Where(i => i.GID == GID).FirstOrDefault(); if (data != null) { return(data.Name); } return(""); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static string GetCountryName(long?CTRYID) { using (IwillDbEntities DBC = new IwillDbEntities()) { try { var data = DBC.Countries.Where(i => i.CTRYID == CTRYID).FirstOrDefault(); if (data != null) { return(data.CTName); } return(""); } catch (Exception ex) { throw new Exception(ex.Message); } } }
public static long GetPrimaryRoleID(int RoleID) { try { using (IwillDbEntities DBC = new IwillDbEntities()) { var data = DBC.Roles.Where(i => i.RoleID == RoleID).FirstOrDefault(); if (data != null) { return(data.RID); } return(0); } } catch (Exception ex) { throw new Exception(ex.Message); } }
public static ModelViewRegQuestion GetViewRegQuestions(bool IsStudent) { using (IwillDbEntities DBC = new IwillDbEntities()) { ModelViewRegQuestion mod = new ModelViewRegQuestion(); // ModelDataViewRegQuestion mod = new ModelDataViewRegQuestion(); List <ModelUserRegQuestion> MQuesList = DBC.UserQuestions.Where(i => i.IsStudent == IsStudent && i.IsActive == true).Select( s => new ModelUserRegQuestion() { FkUQType = s.FkUQType, IsActive = s.IsActive, UQID = s.UQID, IsStudent = s.IsStudent == null ? false : true, UQuestion = s.UQuestion }).ToList(); foreach (var item in MQuesList) { List <ModelUserQuestionDetail> modOptlist = DBC.UserQuestionDetails.Where(i => i.FkQID == item.UQID && i.IsActive == true).Select( s => new ModelUserQuestionDetail() { FkQID = s.FkQID, IsActive = s.IsActive, IsRight = s.IsRight == null ? false : true, QuesOptionName = s.QuesOptionName, UQDID = s.UQDID }).ToList(); item.UserQuestionDetail = modOptlist; } mod.LstQuestion = MQuesList; return(mod); } }