示例#1
0
 /// <summary>
 /// Create a new events object.
 /// </summary>
 /// <param name="eventID">Initial value of the EventID property.</param>
 /// <param name="title">Initial value of the Title property.</param>
 /// <param name="key">Initial value of the Key property.</param>
 /// <param name="status">Initial value of the Status property.</param>
 public static events Createevents(global::System.Int32 eventID, global::System.String title, global::System.String key, global::System.Int32 status)
 {
     events events = new events();
     events.EventID = eventID;
     events.Title = title;
     events.Key = key;
     events.Status = status;
     return events;
 }
示例#2
0
        public string StoreEvent(string eventKey, string userName, string password, string title, string details,string status)
        {
            string eventID = string.Empty;

            try
            {
                Int32 lecturerID = int.Parse(LoginLecturer(userName, password));

                if (lecturerID <= 0) return "-2";

                var eventTMP = (from e in wonderDB.events
                                where e.Key == eventKey
                                select e).FirstOrDefault();

                if (eventTMP == null)
                {
                    events currentEvent = new events();
                    currentEvent.Details = details;
                    currentEvent.Key = rundomKey();
                    currentEvent.Status = int.Parse(status);
                    currentEvent.Title = title;
                    currentEvent.LecturerID = lecturerID;
                    currentEvent.CreatedDate = DateTime.Now;

                    wonderDB.events.AddObject(currentEvent);

                    wonderDB.SaveChanges();
                    eventID = currentEvent.EventID.ToString();
                }
                else
                {
                    eventTMP.Status = int.Parse(status);
                    eventTMP.Title = title;
                    eventTMP.Details = details;

                    wonderDB.SaveChanges();

                    eventID = eventTMP.EventID.ToString();
                }
            }
            catch (Exception ex)
            {
                WriteLog(ex.Message, "StoreEvent");
                return "-1";
            }

            return eventID.ToString();
        }
示例#3
0
 /// <summary>
 /// Deprecated Method for adding a new object to the events EntitySet. Consider using the .Add method of the associated ObjectSet&lt;T&gt; property instead.
 /// </summary>
 public void AddToevents(events events)
 {
     base.AddObject("events", events);
 }