/// <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; }
partial void UpdateUSER(USER instance);
partial void DeleteUSER(USER instance);
partial void InsertUSER(USER instance);