public IHttpActionResult Post(Evnt ev)
        {
            string username = Thread.CurrentPrincipal.Identity.Name;

            ev.TeacherUserName = username;

            this.evrepo.Insert(ev);
            int evntid = evrepo.GetMaxId();

            List <User> us = usrepo.GetAllByType("Student");

            for (int i = 0; i < us.Count; i++)
            {
                Registration reg = new Registration();
                reg.EvntId          = evntid;
                reg.Result          = -1;
                reg.StudentUserName = us[i].UserName;
                regrepo.Insert(reg);

                //this.ansrepo.setAnsTable(us[i].UserName, evntid);
            }



            return(Ok());
        }
示例#2
0
        private void btn_add_Click(object sender, EventArgs e)
        {
            if (evnt.Name != "")
            {
                evnt.priority = useId;
                ev_sr.Add(evnt);

                tb_Events.Clear();
                foreach (var el in ev_sr.Events)
                {
                    tb_Events.Text +=
                        "----------" + Environment.NewLine +
                        $"Name : {el.Name}" + Environment.NewLine +
                        $"Place : {el.Palace}" + Environment.NewLine +
                        $"Date : {el.dt.ToShortDateString()}" + Environment.NewLine +
                        $"Priority : {el.priority}" + Environment.NewLine +
                        "----------" + Environment.NewLine + Environment.NewLine;
                }

                evnt = new Evnt();

                tb_NameEv.Clear();
                tb_Name_Pl.Clear();
                dateTimePicker1.Value = DateTime.Now;
            }
            else
            {
                MessageBox.Show("Error invalid name", "Error", MessageBoxButtons.OK);
            }
        }
        public IHttpActionResult Deleteevntbyteacher(string UserName, int EvntId)
        {
            evrepo.DeleteTotalEvnt(EvntId);
            Evnt evnts = this.evrepo.Get(EvntId);


            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#4
0
        private async Task GetData()
        {
            App.UserDialogService.ShowLoading();
            ShowNearby      = false;
            ShowHistory     = true;
            ToggleListsIcon = ImageSource.FromFile("Nearby");
            Events          = await Evnt.GetAllEventsAttendedByUser(App.ThisUser.ID);

            App.UserDialogService.HideLoading();
        }
示例#5
0
    private void onReceive(Package package)
    {
        var phoenixMessage = package.parse <PhoenixSocketMessage <PhoenixSocketEventPayload> >();

        Debug.Log("received: " + phoenixMessage.@event);
        Debug.Log("payload: " + phoenixMessage.payload.events);
        Debug.Log("topic: " + phoenixMessage.topic);
        Debug.Log("ref: " + phoenixMessage.@ref);

        if (phoenixMessage.payload.events != null)
        {
            foreach (Evnt evnt in phoenixMessage.payload.events)
            {
                Debug.Log(evnt);
                Debug.Log(evnt.type);
                Debug.Log(evnt.id);
                Debug.Log(evnt.name);
                Debug.Log(evnt.GetType());
                if (evnt.type == "evnt2")
                {
                    Debug.Log((evnt as Evnt2).time);
                }
            }
        }

        if (phoenixMessage.@event == "phx_reply")
        {
            var payload = new PhoenixSocketEventPayload();
            payload.status = "ok";
            var evnt1 = new Evnt();
            evnt1.id   = "1";
            evnt1.name = "name";
            var evnt2 = new Evnt2();
            evnt2.id       = "2";
            evnt2.name     = "name1";
            evnt2.time     = 1234;
            payload.events = new List <Evnt>()
            {
                evnt1,
                evnt2
            };

            var msg = new PhoenixSocketMessage <PhoenixSocketEventPayload>(
                "lobby:global",
                "ping",
                payload
                );
            var newPackage = new PhoenixSocketPackage();
            newPackage.pack <PhoenixSocketMessage <PhoenixSocketEventPayload> >(msg);
            connector.send(newPackage);
        }
    }
        public IHttpActionResult Get(int id)
        {
            Evnt ev = this.evrepo.Get(id);

            if (ev != null)
            {
                return(Ok(ev));
            }
            else
            {
                return(NotFound());
            }
        }
示例#7
0
        private async Task GetData()
        {
            App.UserDialogService.ShowLoading();
            Items       = new List <CustomPin>();
            ShowMap     = true;
            ShowMapIcon = ImageSource.FromFile("list");
            AllEvents   = await Evnt.GetAllEvents();

            foreach (Event evt in AllEvents)
            {
                var pin = new CustomPin
                {
                    Pin = new Pin()
                    {
                        Address = evt.Location, Label = evt.Name, Type = PinType.Place, Position = new Position(evt.Latitude, evt.Longitude)
                    },
                    Id   = evt.EventId.ToString(),
                    Type = "Event"
                };


                Items.Add(pin);
            }

            AllProfiles = await Prof.GetAllProfiles();

            foreach (RumbleApp.Core.Models.Profile usr in AllProfiles)
            {
                var pin = new CustomPin
                {
                    Pin = new Pin()
                    {
                        Address = usr.Location, Label = string.Format("{0} {1}", usr.FirstName, usr.LastName), Type = PinType.Place, Position = new Position(usr.Latitude, usr.Longitude)
                    },
                    Id   = usr.ProfileId.ToString(),
                    Type = "Profile"
                };

                Items.Add(pin);
            }

            OnPropertyChanged("ShowMap");
            OnPropertyChanged("ShowMapIcon");
            OnPropertyChanged("Items");
            MessagingCenter.Send <MainMapPageViewModel, List <CustomPin> >(this, Messages.MapPinsReady, Items);
            App.UserDialogService.HideLoading();
        }
        public IHttpActionResult Getevntsbyteacher(string UserName, int EvntId)
        {
            Evnt evnts = this.evrepo.Get(EvntId);

            if (evnts == null)
            {
                return(StatusCode(HttpStatusCode.NoContent));
            }
            else if (evnts.TeacherUserName != UserName)
            {
                return(Unauthorized());
            }
            else
            {
                return(Ok(evnts));
            }
        }
示例#9
0
            public static int Compare(Evnt ev1, Evnt ev2)
            {
                if (ev1.priority > ev2.priority)
                {
                    return(-1);
                }

                if (ev1.priority == ev2.priority)
                {
                    return(0);
                }

                if (ev1.priority < ev2.priority)
                {
                    return(1);
                }

                return(1);
            }
示例#10
0
        public IHttpActionResult GetEvntsByStudent(string UserName, int EvntId)
        {
            Evnt ev = evrepo.Get(EvntId);

            if (ev != null)
            {
                if (ev.EvntEdt >= DateTime.Now && ev.EvntSdt <= DateTime.Now)
                {
                    if (evrepo.CheckEvnt(ev, UserName))
                    {
                        return(Ok(ev));
                    }
                }
                return(Unauthorized());
            }
            else
            {
                return(NotFound());
            }
        }
示例#11
0
        public IHttpActionResult GetcheckEvnt(String id)
        {
            string[] arr      = id.Split(new char[] { ',' });
            int      evntid   = Convert.ToInt32(arr[1]);
            string   username = arr[0];
            Evnt     ev       = evrepo.Get(evntid);

            if (ev.EvntEdt < DateTime.Now)
            {
                return(Unauthorized());
            }
            else if (regrepo.GetEvntResult(username, evntid) != null)
            {
                return(Unauthorized());
            }
            else
            {
                return(Ok(ev));
            }
        }
示例#12
0
        public async void AddEvent()
        {
            App.UserDialogService.ShowLoading("Adding Event...");

            Event evt = new Event();

            evt.Name      = EventName;
            evt.StartDate = StartDateTime;
            evt.Location  = Location;
            evt.Places    = int.Parse(Places);
            evt.ProfileId = App.ThisUser.Profile.ProfileId;
            evt.IsActive  = true;


            await Evnt.AddEvent(evt);

            ResetForm();
            await Navi.PopModal();

            App.UserDialogService.HideLoading();

            App.UserDialogService.Toast("Event Added");
        }
示例#13
0
        public async Task GetData(string id)
        {
            App.UserDialogService.ShowLoading();

            ThisProfile = await Prof.GetProfile(int.Parse(id));

            if (string.IsNullOrWhiteSpace(ThisProfile.ImageUrl))
            {
                PhotoText = "Add Photo";
                UserImage = ImageSource.FromFile("unknown_male");
            }
            else
            {
                PhotoText = "Edit Image";
                UserImage = ImageSource.FromUri(new Uri(ThisProfile.ImageUrl));
            }

            ThisProfile.EventItems = await Evnt.GetAllEventsForUser(ThisProfile.ProfileId);

            OnPropertyChanged("ThisProfile");
            OnPropertyChanged("UserImage");
            OnPropertyChanged("PhotoText");

            var pin = new CustomPin
            {
                Pin = new Pin()
                {
                    Address = ThisProfile.Location, Label = ThisProfile.FirstName, Type = PinType.Place, Position = new Position(ThisProfile.Latitude, ThisProfile.Longitude)
                },
                Id   = ThisProfile.ProfileId.ToString(),
                Type = "nothing"
            };

            MessagingCenter.Send <ProfileViewModel, CustomPin>(this, Messages.MapPinsReady, pin);

            App.UserDialogService.HideLoading();
        }
        public IHttpActionResult PostCreateEvent(string UserName, Evnt ev)
        {
            if (ev.EvntEdt < DateTime.Now)
            {
                return(new System.Web.Http.Results.ResponseMessageResult(
                           Request.CreateErrorResponse(
                               (HttpStatusCode)412,
                               new HttpError("End Time Cant be less than current time")
                               )
                           ));
            }
            else if (ev.EvntEdt < ev.EvntSdt)
            {
                return(new System.Web.Http.Results.ResponseMessageResult(
                           Request.CreateErrorResponse(
                               (HttpStatusCode)412,
                               new HttpError("Event Can't end before it starts")
                               )));
            }
            evrepo.Insert(ev);


            return(Ok(ev));
        }
示例#15
0
 public void Add(Evnt evnt)
 {
     Events.Add(evnt);
     Events.Sort((x, y) => Evnt.Compare(x, y));
 }
        public IHttpActionResult GetAssignStudents(Evnt evnt)
        {
            string thrusername = Thread.CurrentPrincipal.Identity.Name;

            return(Ok());
        }
        /// <summary>
        /// This method will process the events from the CTI system and raise the appropriate events to the UII Cti SubSystem
        /// </summary>
        /// <param name="oData">Object array of prams. </param>
        private void ParseDownStreamEvents(object oData)
        {
            // Example ...

            object[] oEventList = null;
            if (oData is object[])
            {
                oEventList = (object[])oData;
            }

            if (oEventList != null)
            {
                // Base event would be the base event type for the vendor specific CTI events class.
                foreach (/*BaseEvent*/ object Evnt in oEventList)
                {
                    string[] nameSpacePath = Evnt.ToString().Split('.');
                    string   eventName     = nameSpacePath[nameSpacePath.Length - 1];

                    // Add the event to the diag list
                    AddItemToEventList(eventName, Evnt);

                    switch (eventName)
                    {
                    case "AgentStateChange":
                        if (AgentStateChangedEvent != null)
                        {
                            CtiCoreEventArgs args = new CtiCoreEventArgs(eventName, Evnt, string.Empty);
                            AgentStateChangedEvent(this, args);
                        }
                        break;

                    case "AgentLogMessage":
                        if (AgentLogMessageEvent != null)
                        {
                            CtiCoreEventArgs args = new CtiCoreEventArgs(eventName, Evnt, string.Empty);
                            AgentLogMessageEvent(this, args);
                        }
                        break;

                    case "NewCall":
                        if (CallNewCallEvent != null)
                        {
                            // extract vendor the call id from the event...
                            string           CallId = string.Empty;
                            CtiCoreEventArgs args   = new CtiCoreEventArgs(eventName, Evnt, CallId);
                            CallNewCallEvent(this, args);
                        }
                        break;

                    case "CallDestructed":
                        if (CallDestructedEvent != null)
                        {
                            // extract vendor the call id from the event...
                            string           CallId = string.Empty;
                            CtiCoreEventArgs args   = new CtiCoreEventArgs(eventName, Evnt, CallId);
                            CallDestructedEvent(this, args);
                        }
                        break;

                    case "CallStateChange":
                        if (CallStateChangeEvent != null)
                        {
                            // extract vendor the call id from the event...
                            string           CallId = string.Empty;
                            CtiCoreEventArgs args   = new CtiCoreEventArgs(eventName, Evnt, CallId);
                            CallStateChangeEvent(this, args);
                        }
                        break;

                    case "CallInfoNewItem":
                        if (CallNewCallInfoEvent != null)
                        {
                            // extract vendor the call id from the event...
                            string           CallId = string.Empty;
                            CtiCoreEventArgs args   = new CtiCoreEventArgs(eventName, Evnt, CallId);
                            CallNewCallInfoEvent(this, args);
                        }
                        break;

                    case "NewChatItem":
                        if (CallItemEvent != null)
                        {
                            // extract vendor the call id from the event...
                            string           CallId = string.Empty;
                            CtiCoreEventArgs args   = new CtiCoreEventArgs(eventName, Evnt, CallId);
                            CallItemEvent(this, args);
                        }
                        break;

                    case "CallMediaConnected":
                        if (CallMediaConnectedEvent != null)
                        {
                            CtiCoreEventArgs args = new CtiCoreEventArgs(eventName, Evnt, string.Empty);
                            CallMediaConnectedEvent(this, args);
                        }
                        break;

                    default:
                        break;
                    }
                }
            }
        }
 public IHttpActionResult Putevntsbyteacher(Evnt ev)
 {
     evrepo.Update(ev);
     return(Ok());
 }