示例#1
0
        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);
            }
        }
示例#2
0
        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);
            }
        }
示例#3
0
 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);
     }
 }
示例#4
0
 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);
     }
 }
示例#5
0
 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);
     }
 }
示例#6
0
 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);
     }
 }
示例#7
0
 public static List <Role> GetRoles()
 {
     try
     {
         using (IwillDbEntities DBC = new IwillDbEntities())
         {
             return(DBC.Roles.ToList());
         }
     }
     catch (Exception ex)
     {
         throw new Exception(ex.Message);
     }
 }
示例#8
0
 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);
     }
 }
示例#9
0
 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);
     }
 }
示例#10
0
 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);
     }
 }
示例#11
0
 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);
     }
 }
示例#12
0
 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);
     }
 }
示例#13
0
 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);
     }
 }
示例#14
0
 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);
     }
 }
示例#15
0
 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);
         }
     }
 }
示例#16
0
        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);
            }
        }
示例#17
0
        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);
            }
        }