예제 #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);
            }
        }