コード例 #1
0
 public async Task CheckInMember(EventRSVP rsvp)
 {
     await Task.Factory.StartNew(() =>
     {
         database.SaveItem <EventRSVP>(rsvp);
     });
 }
コード例 #2
0
 public bool RecordRSVP(string eventID, string GuestID, string Status)
 {
     int ev_ID = Convert.ToInt32(eventID);
     int g_ID = Convert.ToInt32(GuestID);
     using (EventrixDBDataContext db = new EventrixDBDataContext())
     {
         try
         {
             int query = (from res in db.EventRSVPs where res.E_ID.Equals(ev_ID) && res.G_ID.Equals(g_ID) select res).Count();
             if(query == 0)
             {
                 EventRSVP rsvp = new EventRSVP();
                 rsvp.E_ID = ev_ID;
                 rsvp.G_ID = g_ID;
                 rsvp.Status = Status;
                 db.EventRSVPs.InsertOnSubmit(rsvp);
                 db.SubmitChanges();
                 return true;
             }else
             {
                 var update = (from res in db.EventRSVPs where res.E_ID.Equals(ev_ID) && res.G_ID.Equals(g_ID) select res).First();
                 update.Status = Status;
                 db.SubmitChanges();
                 return true;
             }
         }catch(Exception)
         {
             return false;
         }
     };
 }
コード例 #3
0
        public EventRSVP ReadById(int eventId)
        {
            EventRSVP eventRSVP = new EventRSVP();

            DataProvider.ExecuteCmd("dbo.EventRSVP_SelectCount",
                                    inputParamMapper: (SqlParameterCollection inputs) =>
            {
                inputs.AddWithValue("@eventId", eventId);
            },
                                    singleRecordMapper: (IDataReader reader, short resultSet) =>
            {
                eventRSVP = DataMapper <EventRSVP> .Instance.MapToObject(reader);
            });

            return(eventRSVP);
        }