예제 #1
0
        /// <summary>
        /// Metoda vklada do DB noveho uzivatele s vychozim nastavenim
        /// </summary>
        /// <param name="nick">uzivatelske jmeno</param>
        /// <param name="password">heslo</param>
        /// <returns>identifikator prave pridaneho uzivatele</returns>
        public static int user_insertNewUser(string nick, string password)
        {
            int usr_id = 0;
            try
            {
                using (MessDataContext db = new MessDataContext())
                {
                    USER usr = new USER();
                    usr.C_USER = 0;
                    usr.C_DATE = DateTime.Now;
                    usr.USR_NICK = nick;
                    usr.USR_PASSWORD = password;
                    usr.USR_STATE = (int)UsrState.aktivni;
                    usr.USR_STATUS = (int)UsrStatus.offline;
                    db.USERs.InsertOnSubmit(usr);
                    db.SubmitChanges();

                    usr_id = db.USERs.Max(i => i.ID_USR);
                }
            }
            catch (Exception)
            {
                usr_id = 0;
            }
            return usr_id;
        }
예제 #2
0
 partial void UpdateUSER(USER instance);
예제 #3
0
 partial void DeleteUSER(USER instance);
예제 #4
0
 partial void InsertUSER(USER instance);