예제 #1
0
        /// <summary>
        /// Create a new tbl_user object.
        /// </summary>
        /// <param name="id">Initial value of the id property.</param>
        /// <param name="aDAccount">Initial value of the ADAccount property.</param>
        /// <param name="email">Initial value of the Email property.</param>
        /// <param name="isValid">Initial value of the IsValid property.</param>
        /// <param name="isAdmin">Initial value of the IsAdmin property.</param>
        /// <param name="fullName">Initial value of the FullName property.</param>
        public static tbl_user Createtbl_user(global::System.Int32 id, global::System.String aDAccount, global::System.String email, global::System.Boolean isValid, global::System.Boolean isAdmin, global::System.String fullName)
        {
            tbl_user tbl_user = new tbl_user();

            tbl_user.id        = id;
            tbl_user.ADAccount = aDAccount;
            tbl_user.Email     = email;
            tbl_user.IsValid   = isValid;
            tbl_user.IsAdmin   = isAdmin;
            tbl_user.FullName  = fullName;
            return(tbl_user);
        }
예제 #2
0
        public static tbl_user GetUserInfoByAd(string sAdName)
        {
            tbl_user user = null;

            using (FavLinkEntities context = new FavLinkEntities())
            {
                var people = from p in context.tbl_user
                             where (0 == String.Compare(p.ADAccount, sAdName, StringComparison.InvariantCultureIgnoreCase))
                             select p;
                if (people.Any())
                {
                    user = people.First();
                }
            }
            return(user);
        }
예제 #3
0
        public static bool InsertUserInfo(string inputad, ref string errmsg)
        {
            bool bOk    = false;
            var  adUser = GetAdInfo(inputad, out errmsg);

            if (adUser == null)
            {
                errmsg = "AD login failed!";
                return(false);
            }
            var adInfo = GetUserInfoByAd(inputad);

            if (adInfo != null)
            {
                errmsg = "You had been registered!";
                return(false);
            }
            using (FavLinkEntities context = new FavLinkEntities())
            {
                var entity = new tbl_user()
                {
                    ADAccount = adUser.ADAccount,
                    Email     = adUser.Email,
                    FullName  = adUser.FirstName + ' ' + adUser.LastName,
                    IsAdmin   = false,
                    IsValid   = true
                };
                try
                {
                    context.tbl_user.AddObject(entity);
                    context.SaveChanges();
                    bOk    = true;
                    errmsg = string.Empty;
                }
                catch (Exception ex)
                {
                    errmsg = ex.Message;
                }
            }
            return(bOk);
        }
예제 #4
0
 /// <summary>
 /// Deprecated Method for adding a new object to the tbl_user EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddTotbl_user(tbl_user tbl_user)
 {
     base.AddObject("tbl_user", tbl_user);
 }