Пример #1
0
        public static async Task <MeetingDetail> InsertOrMergeEntityAsync(CloudTable table, MeetingDetail entity)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            try
            {
                // Create the InsertOrReplace table operation
                TableOperation insertOrMergeOperation = TableOperation.InsertOrMerge(entity);

                // Execute the operation.
                TableResult result = await table.ExecuteAsync(insertOrMergeOperation);

                MeetingDetail meetingDetail = result.Result as MeetingDetail;

                // Get the request units consumed by the current operation. RequestCharge of a TableResult is only applied to Azure Cosmos DB


                return(meetingDetail);
            }
            catch (Microsoft.Azure.Cosmos.Table.StorageException e)
            {
                throw;
            }
        }
        public ActionResult DeleteConfirmed(int id)
        {
            MeetingDetail meetingDetail = db.MeetingDetails.Find(id);

            db.MeetingDetails.Remove(meetingDetail);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Meeting_ID,Meeting_Title,Meeting_Date,Meeting_StartTime,Meeting_EndTime")] MeetingDetail meetingDetail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(meetingDetail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(meetingDetail));
 }
Пример #4
0
        private async Task <DialogTurnResult> AskForDuration(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            string result = (string)stepContext.Context.TurnState["data"]; //gets attendees' names

            var tokenResponse = (TokenResponse)stepContext.Result;         //gets token

            if (tokenResponse?.Token != null)
            {
                var      client        = new SimpleGraphClient(tokenResponse.Token);
                string[] attendeeNames = string.Concat(result.Where(c => !char.IsWhiteSpace(c))).Split(","); //splits comma separated names of attendees

                List <string> attendeeTableStorage = new List <string>();
                foreach (string name in attendeeNames)
                {
                    List <string> attendeeEmails = await client.GetAttendeeEmailFromName(name); //gets email from attendee's name

                    if (attendeeEmails.Count > 1)                                               //there can be multiple people having same first name, ask user to start again and enter email instead to be more specific
                    {
                        await stepContext.Context.SendActivityAsync("There are " + attendeeEmails.Count + " people whose name start with " + name + ". Please type hi to start again, and instead of first name, enter email to avoid ambiguity.");

                        return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
                    }
                    else if (attendeeEmails.Count == 1)  // attendee found
                    {
                        attendeeTableStorage.Add(attendeeEmails[0]);
                    }
                    else //attendee not found in organization
                    {
                        await stepContext.Context.SendActivityAsync("Attendee not found, please type anything to start again");

                        return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
                    }
                }

                var sb = new System.Text.StringBuilder();
                foreach (string email in attendeeTableStorage)
                {
                    sb.Append(email + ","); //converts emails to comma separated string to store in table
                }
                string finalString = sb.ToString().Remove(sb.Length - 1);
                if (result != null)
                {
                    MeetingDetail meetingDetail = new MeetingDetail(stepContext.Context.Activity.Conversation.Id, userEmail);
                    meetingDetail.Attendees = finalString;

                    await InsertOrMergeEntityAsync(table, meetingDetail); //inserts attendees' emails in table

                    return(await stepContext.PromptAsync(nameof(NumberPrompt <double>), new PromptOptions { Prompt = MessageFactory.Text("What will be duration of the meeting? (in hours)"), RetryPrompt = MessageFactory.Text("Invalid value, please enter a proper value") }, cancellationToken));
                }
            }
            await stepContext.Context.SendActivityAsync("Something went wrong. Please type anything to get started again.");

            return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
        }
Пример #5
0
        public async Task <ActionResult> Login12(LoginViewModel model, string returnUrl)
        {
            // HttpCookie cookie = new HttpCookie("Login");


            var user = await UserManager.FindByNameAsync(model.Email);

            if (user != null)
            {
                var result = await SignInManager.PasswordSignInAsync(model.Email, model.Password, false, false);

                switch (result)
                {
                case SignInStatus.Success:

                    if (dbOperations.ValidateUserWithMeetingDetails(model.Email) == false)
                    {
                        return(View("InValid", "In Valid User"));
                    }

                    //if (model.RememberMe)
                    //{
                    //    cookie.Values.Add("Email", model.Email);
                    //    cookie.Values.Add("Password", model.Password);
                    //    cookie.Expires = DateTime.Now.AddDays(15);
                    //    Response.Cookies.Add(cookie);
                    //}
                    //else
                    //{
                    //    Response.Cookies.Remove("Login");
                    //    cookie.Expires = DateTime.Now.AddDays(-15);
                    //    cookie.Value = null;
                    //    Response.SetCookie(cookie);
                    //}


                    _meetingDetails = (new CommonOperations()).GetMeetingDetail(0, model.Email);
                    MeetingID       = _meetingDetails.MeetingID;
                    //bool checktype=(new CommonOperations()).GetUserType(model.Email);
                    //if (checktype)
                    _meetingDetails.SuperAdmin = true;
                    ViewBag.MeetingDetails     = MeetingDetails;

                    ViewBag.IsSubmitted = ReadOnly;
                    SetInformationTabDetails(1);
                    return(RedirectToAction("InformationView"));

                default:
                    ViewBag.InvalidUser = true;
                    return(View("Login"));
                }
            }
            return(View("InValid", "In Valid User"));
        }
        public ActionResult Create([Bind(Include = "Meeting_ID,Meeting_Title,Meeting_Date,Meeting_StartTime,Meeting_EndTime")] MeetingDetail meetingDetail)
        {
            if (ModelState.IsValid)
            {
                db.MeetingDetails.Add(meetingDetail);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(meetingDetail));
        }
        // GET: MeetingDetails/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            MeetingDetail meetingDetail = db.MeetingDetails.Find(id);

            if (meetingDetail == null)
            {
                return(HttpNotFound());
            }
            return(View(meetingDetail));
        }
 public void SetMeeting(MeetingInfo meeting)
 {
     using (var context = new RepoDemo.MeetingDemoEntities())
     {
         var meetingInfo = new MeetingDetail
         {
             MeetingAgenda    = meeting.MeetingAgenda,
             MeetingAttendees = meeting.MeetingAttendees,
             MeetingDateTime  = meeting.MeetingDateTime,
             MeetingSubject   = meeting.MeetingSubject
         };
         context.MeetingDetails.Add(meetingInfo);
         context.SaveChanges();
     }
 }
 public void UpdateMeetingById(MeetingInfo meeting)
 {
     using (var context = new RepoDemo.MeetingDemoEntities())
     {
         var meetingInfo = new MeetingDetail
         {
             MeetingAgenda    = meeting.MeetingAgenda,
             MeetingAttendees = meeting.MeetingAttendees,
             MeetingDateTime  = meeting.MeetingDateTime,
             MeetingId        = meeting.MeetingId,
             MeetingSubject   = meeting.MeetingSubject
         };
         context.Entry(meetingInfo).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Пример #10
0
        private async Task <DialogTurnResult> AskForDescription(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var result = (string)stepContext.Result;

            if (result != null)
            {
                MeetingDetail meetingDetail = new MeetingDetail(stepContext.Context.Activity.Conversation.Id, userEmail);
                meetingDetail.Title = result;

                await InsertOrMergeEntityAsync(table, meetingDetail); //inserts title in table

                return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions { Prompt = MessageFactory.Text("Please enter description of the meeting") }, cancellationToken));
            }
            await stepContext.Context.SendActivityAsync("Something went wrong. Please type anything to get started again.");

            return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
        }
        /// <summary>
        /// Updates the Meeting.
        /// </summary>
        /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param>
        /// <param name="meetingUpdateItem"><see cref="MeetingUpdateItem" /></param>
        /// <returns>
        ///   <see cref="ApiStatus" />
        /// </returns>
        public static ApiStatus MeetingUpdate(this AdobeConnectXmlAPI adobeConnectXmlApi, MeetingUpdateItem meetingUpdateItem)
        {
            MeetingDetail meetingDetail = null;

            if (meetingUpdateItem == null)
            {
                return(null);
            }

            if (String.IsNullOrEmpty(meetingUpdateItem.ScoId))
            {
                return(Helpers.WrapStatusException(StatusCodes.Invalid, StatusSubCodes.Format, new ArgumentNullException("MeetingItem", "ScoId must be set to update existing item")));
            }

            meetingUpdateItem.FolderId = null;

            return(adobeConnectXmlApi.ScoUpdate(meetingUpdateItem, out meetingDetail));
        }
Пример #12
0
        public ActionResult LogOff(string Email)
        {
            if (!string.IsNullOrEmpty(Email))
            {
                var user = db.Repository <ApplicationUser>().GetAll().Where(a => a.Email == Email).FirstOrDefault();
                if (user != null)
                {
                    user.LastLoginDate = DateTime.Now;
                    db.Repository <ApplicationUser>().Update(user);
                    db.SaveChanges();
                }
                AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);

                _meetingDetails = null;
                MeetingID       = 0;
            }
            AuthenticationManager.SignOut(DefaultAuthenticationTypes.ApplicationCookie);
            return(RedirectToAction("Login", "Participant"));
        }
Пример #13
0
        private async Task <DialogTurnResult> ShowMeetingTimeSuggestions(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            double duration      = Convert.ToDouble(stepContext.Context.TurnState["data"]);
            var    tokenResponse = (TokenResponse)stepContext.Result;

            if (tokenResponse?.Token != null)
            {
                // Pull in the data from the Microsoft Graph.
                var           client        = new SimpleGraphClient(tokenResponse.Token);
                MeetingDetail meetingDetail = await RetrieveMeetingDetailsAsync(table, userEmail, stepContext.Context.Activity.Conversation.Id); //retrives data from table

                timeSuggestions = await client.FindMeetingTimes(meetingDetail.Attendees, duration);                                              //returns meeting times

                if (timeSuggestions.Count == 0)
                {
                    await stepContext.Context.SendActivityAsync("No appropriate meeting slot found. Please try again by typing 'hi' and change date this time");

                    return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
                }
                var cardOptions = new List <Choice>();
                for (int i = 0; i < timeSuggestions.Count; i++)
                {
                    cardOptions.Add(new Choice()
                    {
                        Value = timeSuggestions[i].Start.DateTime + " - " + timeSuggestions[i].End.DateTime
                    });                                                                                                                    //creates list of meeting time choices
                }



                return(await stepContext.PromptAsync(nameof(ChoicePrompt), new PromptOptions
                {
                    Prompt = MessageFactory.Text("These are the time suggestions. Click on the time slot for when you want the meeting to be set."),
                    RetryPrompt = MessageFactory.Text("Sorry, Please the valid choice"),
                    Choices = cardOptions,
                    Style = ListStyle.HeroCard, //displays choices as buttons
                }, cancellationToken));
            }
            await stepContext.Context.SendActivityAsync("Something went wrong. Please type anything to get started again.");

            return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
        }
Пример #14
0
        public static async Task <MeetingDetail> RetrieveMeetingDetailsAsync(CloudTable table, string partitionKey, string rowKey)
        {
            try
            {
                TableOperation retrieveOperation = TableOperation.Retrieve <MeetingDetail>(partitionKey, rowKey);
                TableResult    result            = await table.ExecuteAsync(retrieveOperation);

                MeetingDetail meetingDetail = result.Result as MeetingDetail;
                if (meetingDetail != null)
                {
                    return(meetingDetail);
                }

                return(null);
            }
            catch (StorageException e)
            {
                throw;
            }
        }
Пример #15
0
        private async Task <DialogTurnResult> SendMeetingInvite(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            string description   = (string)stepContext.Context.TurnState["data"];
            var    tokenResponse = (TokenResponse)stepContext.Result;

            if (tokenResponse?.Token != null)
            {
                var           client        = new SimpleGraphClient(tokenResponse.Token);
                MeetingDetail meetingDetail = await RetrieveMeetingDetailsAsync(table, userEmail, stepContext.Context.Activity.Conversation.Id);                            //retrieves current meeting details

                await client.SendMeetingInviteAsync(timeSuggestions[Int32.Parse(meetingDetail.TimeSlotChoice)], meetingDetail.Attendees, meetingDetail.Title, description); //creates event

                await stepContext.Context.SendActivityAsync("Meeting has been scheduled. Thank you!");
            }
            else
            {
                await stepContext.Context.SendActivityAsync("Something went wrong. Please type anything to get started again.");
            }
            return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
        }
Пример #16
0
        private async Task <DialogTurnResult> AskForAttendees(WaterfallStepContext stepContext, CancellationToken cancellationToken)
        {
            var tokenResponse = (TokenResponse)stepContext.Result; // Get the token from the previous step.

            if (tokenResponse?.Token != null)
            {
                // Pull in the data from the Microsoft Graph.
                var client = new SimpleGraphClient(tokenResponse.Token);
                var me     = await client.GetMeAsync();

                userEmail = me.UserPrincipalName;
                table     = CreateTableAsync("botdata");              //creates table if does not exist already
                MeetingDetail meetingDetail = new MeetingDetail(stepContext.Context.Activity.Conversation.Id, userEmail);
                await InsertOrMergeEntityAsync(table, meetingDetail); //inserts user's email in table

                return(await stepContext.PromptAsync(nameof(TextPrompt), new PromptOptions { Prompt = MessageFactory.Text("With whom would you like to set up a meeting?") }, cancellationToken));
            }

            await stepContext.Context.SendActivityAsync("Something went wrong. Please type anything to get started again.");

            return(await stepContext.EndDialogAsync(cancellationToken : cancellationToken));
        }
Пример #17
0
        public ActionResult Login()
        {
            MeetingID              = 0;
            _meetingDetails        = null;
            ViewBag.MeetingDetails = null;

            DAL.LoginViewModel model = new DAL.LoginViewModel();

            if (User.Identity.IsAuthenticated == false)
            {
                // ViewBag.ReturnUrl = returnUrl;
                if (Request.Cookies["Login"] != null)
                {
                    model.Email      = Request.Cookies["Login"].Values["Email"];
                    model.Password   = Request.Cookies["Login"].Values["Password"];
                    model.RememberMe = true;
                }
            }


            return(View(model));
        }
Пример #18
0
        public MeetingDetail GetMeetingDetail(int meetingID, string email = null)
        {
            MeetingDetail model = new MeetingDetail();

            if (meetingID == 0 && string.IsNullOrEmpty(email))
            {
                return(null);
            }
            using (meetingContext = new OCASIAMeetingContext())
            {
                if (meetingID == 0)
                {
                    model = meetingContext.UserDetails.Where(el => el.IsActive && el.Email == email).Select(el =>
                                                                                                            new MeetingDetail()
                    {
                        MeetingID        = el.MeetingID.Value,
                        MeetingName      = el.Meetings.MeetingName,
                        UserDetailsID    = el.UserDetailID,
                        Tabs             = el.Meetings.RegistrationTabs,
                        EmailAddress     = el.Meetings.OfficalEmail,
                        PageBanner       = el.Meetings.PageBannerPath,
                        FaqDescription   = el.Meetings.FaqDescription,
                        FaqPath          = el.Meetings.FaqPath,
                        UserName         = el.GivenName,
                        StartDate        = el.Meetings.EventStartDate,
                        ContactNumber    = el.Meetings.PhoneNumber,
                        ReadOnly         = el.IsSubmitted == null ? false : el.IsSubmitted.Value,
                        IsPersonalFilled = string.IsNullOrEmpty(el.PassportNumber) ? false : true
                    }
                                                                                                            ).FirstOrDefault();
                    if (model == null)
                    {
                        return(null);
                    }
                    model.IsTravelFilled = meetingContext.TravelDetails.Where(el => el.IsActive && el.UserDetailID == model.UserDetailsID).FirstOrDefault() == null ? true : false;
                    model.IsGuestsFilled = meetingContext.UserDetails.Where(el => el.IsActive && el.GuestOf == model.UserDetailsID.ToString()).FirstOrDefault() == null ? true : false;
                }
                else
                {
                    model = meetingContext.Meetings.Where(el => el.IsActive && el.AllowRegistration && el.IsActive && el.MeetingID == meetingID).Select(el => new MeetingDetail()
                    {
                        MeetingID      = el.MeetingID,
                        MeetingName    = el.MeetingName,
                        StartDate      = el.EventStartDate,
                        Tabs           = el.RegistrationTabs,
                        ContactNumber  = el.PhoneNumber,
                        EmailAddress   = el.OfficalEmail,
                        FaqDescription = el.FaqDescription,
                        FaqPath        = el.FaqPath,
                        PageBanner     = el.PageBannerPath
                    }).FirstOrDefault();
                }
                if (model == null)
                {
                    return(null);
                }

#if DEBUG
                model.PageBanner = "../Content/banners.jpg";
                model.FaqPath    = "../Content/banners.jpg";
#else
                model.PageBanner = model.PageBanner?.Replace("~", Helper.FilePath);
                model.FaqPath    = model.FaqPath?.Replace("~", Helper.FilePath);
#endif
            }
            return(model);
        }
Пример #19
0
        /// <summary>
        /// Creates a new Meeting.
        /// </summary>
        /// <param name="adobeConnectXmlApi">The adobe connect XML API.</param>
        /// <param name="meetingUpdateItem"><see cref="MeetingUpdateItem" /></param>
        /// <param name="meetingDetail"><see cref="MeetingDetail" /></param>
        /// <returns>
        ///   <see cref="ApiStatus" />
        /// </returns>
        public static ApiStatus MeetingCreate(this AdobeConnectXmlAPI adobeConnectXmlApi, MeetingUpdateItem meetingUpdateItem, out MeetingDetail meetingDetail)
        {
            meetingDetail = null;
            if (meetingUpdateItem == null)
            {
                return(null);
            }

            if (String.IsNullOrEmpty(meetingUpdateItem.FolderId))
            {
                return(Helpers.WrapStatusException(StatusCodes.Invalid, StatusSubCodes.Format, new ArgumentNullException("MeetingItem", "FolderID must be set to create new item")));
            }

            if (meetingUpdateItem.MeetingItemType == SCOtype.NotSet)
            {
                return(Helpers.WrapStatusException(StatusCodes.Invalid, StatusSubCodes.Format, new ArgumentNullException("MeetingItem", "SCOtype must be set")));
            }

            meetingUpdateItem.ScoId = null;

            return(adobeConnectXmlApi.ScoUpdate(meetingUpdateItem, out meetingDetail));
        }
Пример #20
0
 public MeetingController()
 {
     meetingDetail = new MeetingDetail();
 }