/// <summary> /// Create a new eventusers object. /// </summary> /// <param name="eventUserID">Initial value of the EventUserID property.</param> public static eventusers Createeventusers(global::System.Int32 eventUserID) { eventusers eventusers = new eventusers(); eventusers.EventUserID = eventUserID; return eventusers; }
public string Login(string EventKey, string IMEI, string NickName, string Code) { string studentID = string.Empty; try { var studentTMP = (from s in wonderDB.students where s.IMEI == IMEI select s).FirstOrDefault(); if (studentTMP == null) { students student = new students(); student.NickName = NickName; student.IMEI = IMEI; student.Code = Code; wonderDB.students.AddObject(student); wonderDB.SaveChanges(); studentID = student.StudentID.ToString(); } else { studentTMP.NickName = NickName; wonderDB.SaveChanges(); studentID = studentTMP.StudentID.ToString(); } var eventTMP = (from s in wonderDB.events where s.Key == EventKey select s).FirstOrDefault(); if (eventTMP.EventID > 0) { int studentIDTMP = int.Parse(studentID); var eventUserTMP = (from s in wonderDB.eventusers where s.EventID == eventTMP.EventID && s.StudentID == studentIDTMP select s).FirstOrDefault(); if (eventUserTMP == null || eventUserTMP.EventUserID <= 0) { eventusers eventUser = new eventusers(); eventUser.EventID = eventTMP.EventID; eventUser.StudentID = int.Parse(studentID); eventUser.Status = 1; wonderDB.eventusers.AddObject(eventUser); wonderDB.SaveChanges(); } } } catch (Exception ex) { WriteLog(ex.Message, "Login"); return "-1"; } return studentID; }
/// <summary> /// Deprecated Method for adding a new object to the eventusers EntitySet. Consider using the .Add method of the associated ObjectSet<T> property instead. /// </summary> public void AddToeventusers(eventusers eventusers) { base.AddObject("eventusers", eventusers); }