/// <summary> /// Create a new Usr object. /// </summary> /// <param name="id">Initial value of the ID property.</param> /// <param name="usr1">Initial value of the Usr1 property.</param> /// <param name="pass">Initial value of the Pass property.</param> /// <param name="nume">Initial value of the Nume property.</param> /// <param name="prenume">Initial value of the Prenume property.</param> /// <param name="mail">Initial value of the Mail property.</param> /// <param name="rank">Initial value of the Rank property.</param> /// <param name="scor">Initial value of the Scor property.</param> /// <param name="baniDonati">Initial value of the BaniDonati property.</param> /// <param name="nrDonatii">Initial value of the NrDonatii property.</param> /// <param name="data_Inreg">Initial value of the Data_Inreg property.</param> /// <param name="data_LastLogIn">Initial value of the Data_LastLogIn property.</param> /// <param name="isForDelete">Initial value of the IsForDelete property.</param> public static Usr CreateUsr(global::System.Int32 id, global::System.String usr1, global::System.String pass, global::System.String nume, global::System.String prenume, global::System.String mail, global::System.String rank, global::System.Double scor, global::System.Decimal baniDonati, global::System.Int16 nrDonatii, global::System.DateTime data_Inreg, global::System.DateTime data_LastLogIn, global::System.Boolean isForDelete) { Usr usr = new Usr(); usr.ID = id; usr.Usr1 = usr1; usr.Pass = pass; usr.Nume = nume; usr.Prenume = prenume; usr.Mail = mail; usr.Rank = rank; usr.Scor = scor; usr.BaniDonati = baniDonati; usr.NrDonatii = nrDonatii; usr.Data_Inreg = data_Inreg; usr.Data_LastLogIn = data_LastLogIn; usr.IsForDelete = isForDelete; return usr; }
/// <summary> /// Deprecated Method for adding a new object to the Usrs EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToUsrs(Usr usr) { base.AddObject("Usrs", usr); }
public bool RegisterUser(string firstname, string lastname, string username, string password, string email, string region) { dbEntities db = new dbEntities(); try { Usr u = new Usr() { Nume = lastname, Prenume = firstname, Usr1 = username, Pass = password, Mail = email, Data_Inreg = DateTime.Now, Data_LastLogIn = DateTime.Now, BaniDonati = 0, NrDonatii = 0, Scor = 10, Rank = "Rank1", IsForDelete = false }; db.AddToUsrs(u); db.SaveChanges(); //--- int usrid = db.Usrs.Where<Usr>(x => x.Usr1 == username).ToArray<Usr>()[0].ID; Regiune r = new Regiune() { Nume = region, FK_User = usrid }; db.AddToRegiunes(r); db.SaveChanges(); } catch(Exception ex) { return false; } finally { db.Dispose(); } return true; }