Ejemplo n.º 1
0
        public async Task MeetingControllerGetAdmin()
        {
            var data  = new MeetingApiDataHandler();
            var model = MeetingData.GetFirst();

            data.Result.Setup(m => m.Execute(It.IsAny <Loader <Meeting> >())).Returns(model);

            var controller = new MeetingController(data, Logic)
            {
                CurrentUser = AdminUser
            };
            var result = await controller.Get(MeetingData.FirstId) as OkObjectResult;

            result.Should().NotBeNull();
            result.Should().BeOfType <OkObjectResult>();

            var viewModel = result.Value as MeetingViewModel;

            viewModel.Id.Should().Be(model.Id);
            viewModel.Name.Should().Be(model.Name);
            viewModel.Text.Should().Be(model.Text);

            data.HasExecuted.Should().BeTrue();
            data.Result.Verify(s => s.Execute(It.IsAny <Loader <Meeting> >()), Times.Once());
        }
Ejemplo n.º 2
0
        public async Task MeetingControllerDelete()
        {
            var data  = new MeetingApiDataHandler();
            var model = MeetingData.GetFirst();

            data.Result.Setup(m => m.Execute(It.IsAny <Loader <Meeting> >())).Returns(model);
            data.Result.Setup(m => m.Execute(It.IsAny <Persist <Meeting> >())).Returns(model);

            var controller = new MeetingController(data, Logic)
            {
                CurrentUser = StandardUser
            };
            var result = await controller.Delete(MeetingData.FirstId) as OkObjectResult;

            result.Should().NotBeNull();
            result.Should().BeOfType <OkObjectResult>();

            var viewModel = result.Value as ConfirmViewModel;

            viewModel.Success.Should().BeTrue();

            data.HasExecuted.Should().BeTrue();
            data.HasCommitted.Should().BeTrue();
            data.Result.Verify(s => s.Execute(It.IsAny <Loader <Meeting> >()), Times.Once());
            data.Result.Verify(s => s.Execute(It.IsAny <Persist <Meeting> >()), Times.Once());
        }
Ejemplo n.º 3
0
        async Task SaveValuesAsync(IDialogContext context, AppointmentForm appointment)
        {
            MeetingData mtgData = await new MeetingState().GetAsync(context.Activity) ?? new MeetingData();

            using (var ctx = new MeetingContext())
            {
                ctx.Appointments.Add(
                    new Appointment
                {
                    UserID  = mtgData.UserDBID,
                    VenueID =
                        (from venue in venues
                         where venue.Name == appointment.Venue
                         select venue.VenueID)
                        .Single(),
                    Time = new DateTime(
                        appointment.Date.Year, appointment.Date.Month, appointment.Date.Day,
                        appointment.Time.Hour, appointment.Time.Minute, 0)
                });

                await ctx.SaveChangesAsync();
            }

            await context.PostAsync("Venue added!");
        }
Ejemplo n.º 4
0
        public async Task MeetingControllerFilter()
        {
            var data = new MeetingApiDataHandler();
            var list = new List <MeetingDisplay> {
                MeetingData.GetFirstDisplay(false)
            };
            var filter = new MeetingFilter {
                TenantRestrict = true
            };

            data.Result.Setup(m => m.Execute(It.IsAny <MeetingDisplayByFilter>())).Returns(list);

            var controller = new MeetingController(data, Logic)
            {
                CurrentUser = StandardUser
            };
            var result = await controller.Filter(filter) as OkObjectResult;

            result.Should().NotBeNull();
            result.Should().BeOfType <OkObjectResult>();
            result.Value.Should().NotBeNull();

            var check = result.Value as PagedResult <IEnumerable <MeetingDisplay> >;

            check.Should().NotBeNull();
            check.Data.Count().Should().Be(list.Count);

            Assert.That(check.Data, Is.DeepEqualTo(list));

            data.HasExecuted.Should().BeTrue();
            data.Result.Verify(s => s.Execute(It.IsAny <MeetingDisplayByFilter>()), Times.Once());
        }
    public static MeetingData POST(string UserID, string PinCode)
    {
        MeetingData result = null;

        try
        {
            string url    = WsTool.GetUrl();
            string format = "<?xml version=\"1.0\"?><UserInfo><UserID><![CDATA[{0}]]></UserID><PinCode>{1}</PinCode></UserInfo>";
            format = string.Format(format, UserID, PinCode);
            Dictionary <string, string> dictionary = new Dictionary <string, string>();
            dictionary["XmlDoc"] = format;
            string text = HttpTool.CreateRequest(url + "/NewMeeting", "POST", dictionary);
            if (text.Equals(""))
            {
                return(result);
            }
            result = XmlHelper.XmlDeserialize <MeetingData>(text, Encoding.UTF8);
            return(result);
        }
        catch (Exception ex)
        {
            LogTool.Debug(ex);
            return(result);
        }
    }
Ejemplo n.º 6
0
        async Task SaveValuesAsync(IDialogContext context, RegisterForm registration)
        {
            MeetingData mtgData = await new MeetingState().GetAsync(context.Activity) ?? new MeetingData();

            //using (var ctx = new MeetingContext())
            //{
            //    User user =
            //        await
            //        (from usr in ctx.Users
            //         where usr.UserID == mtgData.UserDBID ||
            //               usr.Email == registration.Email
            //         select usr)
            //        .SingleOrDefaultAsync();

            //    if (user == null)
            //    {
            //        user = new User
            //        {
            //            Email = registration.Name,
            //            Name = registration.Email
            //        };
            //        ctx.Users.Add(user);
            //    }
            //    else
            //    {
            //        user.Name = registration.Name;
            //        user.Email = registration.Email;
            //    }

            //    await ctx.SaveChangesAsync();
            //}

            await context.PostAsync("Registration succeeded!");
        }
Ejemplo n.º 7
0
 private void SetMockMeetings()
 {
     MockMeetings = new Mock <DbSet <Meeting> >().SetupData(MeetingData.Data());
     MockMeetings.Setup(x => x.Find(It.IsAny <object[]>())).Returns <object[]>(ids => MeetingData.Data().FirstOrDefault(d => d.MeetingId == (int)ids[0]));
     MockMeetings.Setup(x => x.FindAsync(It.IsAny <object[]>())).Returns <object[]>(ids => Task.FromResult(MeetingData.Data().FirstOrDefault(d => d.MeetingId == (int)ids[0])));
     MockContext.Setup(x => x.Meetings).Returns(MockMeetings.Object);
 }
Ejemplo n.º 8
0
        private void btnDownload_btnPausing_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            Action <MeetingData>        action = null;
            _003C_003Ec__DisplayClass21 _003C_003Ec__DisplayClass = new _003C_003Ec__DisplayClass21();

            _003C_003Ec__DisplayClass.sender            = sender;
            _003C_003Ec__DisplayClass._003C_003E4__this = this;
            e.Handled = true;
            MouseTool.ShowLoading();
            if (NetworkTool.CheckNetwork() > 0)
            {
                string iD      = userMeeting.ID;
                string userID  = UserID;
                string userPWD = UserPWD;
                if (action == null)
                {
                    action = new Action <MeetingData>(_003C_003Ec__DisplayClass._003CbtnDownload_btnPausing_MouseLeftButtonDown_003Eb__1f);
                }
                GetMeetingData.AsyncPOST(iD, userID, userPWD, action);
            }
            else
            {
                DataTable dataTable = MSCE.GetDataTable("select MeetingJson from MeetingData where MeetingID=@1 and UserID =@2", userMeeting.ID, UserID);
                if (dataTable.Rows.Count > 0)
                {
                    MeetingData md = JsonConvert.DeserializeObject <MeetingData>(dataTable.Rows[0]["MeetingJson"].ToString());
                    GetMeetingData_DoAction(md, (Image)_003C_003Ec__DisplayClass.sender);
                }
                else
                {
                    AutoClosingMessageBox.Show("無法取得資料,請稍後再試");
                    MouseTool.ShowArrow();
                }
            }
        }
Ejemplo n.º 9
0
        private void _003CPreLoadMeeting_003Eb__3(MeetingData md)
        {
            ThreadStart threadStart = null;

            try
            {
                PreLoadMeetingData = md;
                if (CacheMinuteTTL > 0)
                {
                    if (CacheThread != null)
                    {
                        CacheThread.Abort();
                    }
                    if (threadStart == null)
                    {
                        threadStart = new ThreadStart(_003CPreLoadMeeting_003Eb__4);
                    }
                    CacheThread = new Thread(threadStart);
                    CacheThread.IsBackground = false;
                    CacheThread.Start();
                }
            }
            catch (Exception ex)
            {
                LogTool.Debug(ex);
            }
        }
        public void _003CAsyncPOST_003Eb__0(HttpWebResponse response)
        {
            MeetingData obj = null;

            try
            {
                string text = "";
                using (Stream stream = response.GetResponseStream())
                {
                    using (StreamReader streamReader = new StreamReader(stream, Encoding.UTF8))
                    {
                        text = streamReader.ReadToEnd();
                    }
                }
                if (!text.Equals(""))
                {
                    obj = XmlHelper.XmlDeserialize <MeetingData>(text, Encoding.UTF8);
                }
                DoAction(obj);
            }
            catch (Exception ex)
            {
                if (ErrorAction != null)
                {
                    ErrorAction();
                }
                LogTool.Debug(ex);
            }
        }
Ejemplo n.º 11
0
        private void btnDownload_btnPausing_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            e.Handled = true;

            // 先撈一次MeetingData
            MouseTool.ShowLoading();
            //GetMeetingData.AsyncPOST(userMeeting.ID, UserID, UserPWD, (md) => { GetMeetingData_DoAction(md,(Image)sender); });
            if (NetworkTool.CheckNetwork() > 0)
            {
                GetMeetingData.AsyncPOST(userMeeting.ID, UserID, UserPWD, (md) => { GetMeetingData_DoAction(md, (Image)sender); });
            }
            else
            {
                //DB查詢登入
                DataTable dt = MSCE.GetDataTable("select MeetingJson from MeetingData where MeetingID=@1 and UserID =@2"
                                                 , userMeeting.ID
                                                 , UserID);

                if (dt.Rows.Count > 0)
                {
                    MeetingData md = JsonConvert.DeserializeObject <MeetingData>(dt.Rows[0]["MeetingJson"].ToString());
                    GetMeetingData_DoAction(md, (Image)sender);
                }
                else
                {
                    AutoClosingMessageBox.Show("無法取得資料,請稍後再試");
                    MouseTool.ShowArrow();
                }
            }
        }
Ejemplo n.º 12
0
        async Task SaveValuesAsync(IDialogContext context, RegisterForm registration)
        {
            MeetingData mtgData = await new MeetingState().GetAsync(context.Activity) ?? new MeetingData();

            using (var ctx = new MeetingContext())
            {
                User user =
                    await
                        (from usr in ctx.Users
                        where usr.UserID == mtgData.UserDBID ||
                        usr.Email == registration.Email
                        select usr)
                    .SingleOrDefaultAsync();

                if (user == null)
                {
                    user = new User
                    {
                        Email = registration.Name,
                        Name  = registration.Email
                    };
                    ctx.Users.Add(user);
                }
                else
                {
                    user.Name  = registration.Name;
                    user.Email = registration.Email;
                }

                await ctx.SaveChangesAsync();
            }

            await context.PostAsync("Registration succeeded!");
        }
Ejemplo n.º 13
0
 public ActionResult MeetingApplicationfirm(meetings Meeting)
 {
     try
     {
         string Result = MeetingCheck(Meeting, "");
         if (Result.Contains("OK"))
         {
             //_db.SaveChanges();
             TempData["message"] = "已新增會議!!";
             MeetingData meetingData = new MeetingData
             {
                 SID       = System.Guid.NewGuid().ToString("N"),//生成UUID編號
                 Applicant = Meeting.Applicant,
                 Room      = Meeting.Room,
                 Event     = Meeting.Event,
                 STime     = Meeting.Date + " " + Meeting.STime,
                 ETime     = Meeting.Date + " " + Meeting.ETime,
             };
             _db.MeetingData.Add(meetingData);
             _db.SaveChanges();
         }
         else
         {
             TempData["message"] = Result;
             return(RedirectToAction("MeetingApplication"));
         }
     }
     catch (ArgumentNullException ex)
     {
         TempData["message"] = ex.ToString();
     }
     return(RedirectToAction("MeetingApplication"));
 }
Ejemplo n.º 14
0
        public ActionResult MeetingDeleteComfirm(string SID)
        {
            MeetingData Mdata = _db.MeetingData.Find(SID);

            _db.MeetingData.Remove(Mdata);
            _db.SaveChanges();
            return(RedirectToAction("MeetingList"));
        }
Ejemplo n.º 15
0
        public void AddNewMeting(MeetingData meetingData)
        {
            _meetings.Add(meetingData._meetingTopic, new Meeting(meetingData));

            Console.WriteLine("Got a new meeting: " + meetingData._meetingTopic);

            UpdateMeetingInvolvedClients(_meetings[meetingData._meetingTopic]);
        }
Ejemplo n.º 16
0
        /// <summary>
        /// 会議情報を新規登録するAPIコール
        /// </summary>
        /// <param name="uri">コールするURL</param>
        /// <param name="meetingData">新規登録する会議情報</param>
        /// <param name="labels">会議に紐づくラベルリスト</param>
        /// <returns>CreateMeetingParam</returns>
        public async Task <CreateMeetingParam> CreateMeetingDataAsync(string uri, MeetingData meetingData, ObservableCollection <MeetingLabelData> labels)
        {
            var json = JsonConvert.SerializeObject(meetingData);
            var jobj = JObject.Parse(json);

            //MeetingDataモデルからJSON化に不要な属性を削除
            jobj.Remove("StartTime");
            jobj.Remove("EndTime");
            jobj.Remove("Date");
            jobj.Remove("IsOwner");
            jobj.Remove("IsGeneral");

            json = JsonConvert.SerializeObject(jobj);


            var createMeetingParam = new CreateMeetingParam();

            try
            {
                var content = new StringContent(json, Encoding.UTF8, "application/json");


                var response = await _client.PostAsync(uri, content);

                if (response.IsSuccessStatusCode)
                {
                    string responseContent = await response.Content.ReadAsStringAsync();

                    Console.WriteLine(responseContent);

                    //midを取得し会議ラベルDBにLabels分をPOSTする処理
                    var responseMeetingData = JsonConvert.DeserializeObject <MeetingData>(responseContent);
                    var mid = responseMeetingData.Id;

                    foreach (var label in labels)
                    {
                        await CreateMeetingLabelDataAsync(MeetingConstants.OPENMeetingLabelEndPoint, label.LabelName, mid);
                    }

                    createMeetingParam.IsSuccessed = response.IsSuccessStatusCode;
                    return(createMeetingParam);
                }
                else
                {
                    createMeetingParam.HasError     = true;
                    createMeetingParam.ApiCallError = true;
                    return(createMeetingParam);
                }
            }
            catch (Exception ex)
            {
                Debug.WriteLine("\tERROR {0}", ex.Message);
                createMeetingParam.HasError = true;
            }
            return(createMeetingParam);
        }
 // Token: 0x06000DD7 RID: 3543 RVA: 0x00053C04 File Offset: 0x00051E04
 internal static CalendarRepairLogMeetingEntry CreateInstance(MeetingData meeting, bool subjectLoggingEnabled)
 {
     return(new CalendarRepairLogMeetingEntry
     {
         HasFixableInconsistency = false,
         meeting = meeting,
         attendeeEntries = new List <CalendarRepairLogAttendeeEntry>(),
         duplicates = new List <CalendarRepairDuplicateMeetingLogEntry>(),
         subjectLoggingEnabled = subjectLoggingEnabled,
         hasDuplicates = false
     });
 }
Ejemplo n.º 18
0
        protected override void SetupDatabase(IDocumentStore store)
        {
            store.ExecuteIndex(new AttendanceIndex());

            using var session = store.OpenSession();
            session.Store(AttendanceData.GetFirst());
            session.Store(MeetingData.GetFirst());
            session.Store(UserData.GetFirst());
            session.SaveChanges();

            WaitForIndexing(store);
        }
Ejemplo n.º 19
0
        public override void OnListItemClick(ListView l, View v, int position, long id)
        {
            MeetingData data = adapter.GetSelectedItem(position);

            if (data.GetName() == null)
            {
                // add new
            }
            else
            {
                // check current
            }
        }
Ejemplo n.º 20
0
        public async Task MeetingByIdDataTest()
        {
            using var store   = GetDocumentStore();
            using var session = store.OpenAsyncSession();
            var loader = new MeetingById()
            {
                Session = session, Id = MeetingData.FirstId
            };
            await loader.Execute();

            loader.Result.Should().NotBeNull();
            loader.Result.Id.Should().Be(MeetingData.FirstId);
            Assert.That(loader.Result, Is.DeepEqualTo(MeetingData.GetFirst()));
        }
Ejemplo n.º 21
0
        public BookingRequest Build()
        {
            var meetingDataArray = MeetingData.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);
            var meeting          = Helper.CreateMeeting($"{meetingDataArray[0]} {meetingDataArray[1]}", meetingDataArray[2]);

            var requestDataArray = RequestData.Split(" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries);

            return(new BookingRequest
            {
                SubmissionTime = DateTime.Parse($"{requestDataArray[0]} {requestDataArray[1]}"),
                EmployeeId = requestDataArray[2],
                Meeting = meeting,
                Office = Office
            });
        }
Ejemplo n.º 22
0
        async Task RegisterFormDialogResumedAsync(IDialogContext context, IAwaitable <RegisterForm> result)
        {
            var         mtgState = new MeetingState();
            MeetingData mtgData  = await mtgState.GetAsync(context.Activity) ?? new MeetingData();

            RegisterForm form = await result;

            mtgData.UserDBID      = form.UserID;
            mtgData.UserChannelID = context.Activity.From.Id;

            MtgData = mtgData;
            //await mtgState.UpdateAsync(context.Activity, mtgData);

            context.Wait(MessageReceivedAsync);
        }
Ejemplo n.º 23
0
        public void MeetingMasterTest()
        {
            var config = new MapperConfiguration(cfg =>
            {
                cfg.CreateMap <Meeting, MeetingMaster>();
                cfg.CreateMap <MeetingMaster, Meeting>();
            });

            var mapper   = new Mapper(config);
            var master   = mapper.Map <MeetingMaster>(MeetingData.GetFirst());
            var document = mapper.Map <Meeting>(master);

            master.Should().NotBeNull();
            document.Should().NotBeNull();
        }
Ejemplo n.º 24
0
 public ActionResult MeetingEdit(string SID) //會議編輯
 {
     try
     {
         SelectList Room = new SelectList(MR, "Value", "Description");
         ViewBag.Room = Room;
         MeetingData Mdata = _db.MeetingData.Find(SID);
         Mdata.Room = Mdata.Room.Trim(' ');
         return(View(Mdata));
     }
     catch (Exception)
     {
         throw new HttpException(404, "Fail");
     }
 }
Ejemplo n.º 25
0
        protected override void SetupDatabase(IDocumentStore store)
        {
            store.ExecuteIndex(new MeetingIndex());
            store.ExecuteIndex(new FavFanIndex());

            using (var session = store.OpenSession())
            {
                session.Store(MeetingData.GetFirst());
                session.Store(MeetingTypeData.GetFirst());
                session.Store(MeetingTypeData.GetSecond());
                session.Store(UserData.GetFirst());
                session.SaveChanges();
            }

            WaitForIndexing(store);
        }
Ejemplo n.º 26
0
 public ActionResult MeetingDelete(string SID)  //會議刪除
 {
     try
     {
         if (SID == null)
         {
             throw new HttpException(404, "Fail");
         }
         MeetingData Mdata = _db.MeetingData.Find(SID);
         return(View(Mdata));
     }
     catch (Exception)
     {
         throw new HttpException(404, "Fail");
     }
 }
Ejemplo n.º 27
0
        public async Task MeetingControllerPostEdit()
        {
            var data       = new MeetingApiDataHandler();
            var model      = MeetingData.GetFirst();
            var attendance = new List <Attendance>()
            {
                AttendanceData.GetFirst(), AttendanceData.GetSecond()
            };
            var users = new List <User>()
            {
                UserData.GetFirst(), UserData.GetSecond()
            };

            data.Result.Setup(m => m.Execute(It.IsAny <Loader <Meeting> >())).Returns(model);
            data.Result.Setup(m => m.Execute(It.IsAny <Persist <Meeting> >())).Returns(model);
            data.Result.Setup(m => m.Execute(It.IsAny <Loaders <Attendance> >())).Returns(attendance);
            data.Result.Setup(m => m.Execute(It.IsAny <Loaders <User> >())).Returns(users);

            var controller = new MeetingController(data, new LogicHandler()
            {
                DataHandler = data
            })
            {
                CurrentUser = StandardUser
            };
            var viewModel = controller.Mapper.Map <MeetingViewModel>(model);

            viewModel.Attendees = new List <ResultProfile>()
            {
                UserData.GetFirstProfile(), UserData.GetSecondProfile()
            };

            var result = await controller.Post(viewModel) as OkObjectResult;

            result.Should().NotBeNull();
            result.Should().BeOfType <OkObjectResult>();
            result.Value.Should().NotBeNull();

            var check = result.Value as ConfirmViewModel;

            check.Identity.Should().Be(model.Id);

            data.HasExecuted.Should().BeTrue();
            data.HasCommitted.Should().BeTrue();
            data.Result.Verify(s => s.Execute(It.IsAny <Loader <Meeting> >()), Times.AtLeastOnce);
            data.Result.Verify(s => s.Execute(It.IsAny <Persist <Meeting> >()), Times.Never());
        }
Ejemplo n.º 28
0
        /// <summary>
        /// 初始化窗体
        /// </summary>
        /// <param name="row">要显示的信息</param>
        void InitForm(DataRow row)
        {
            cmdImportance.Items.AddRange(Enum.GetNames(typeof(TaskImportance)));

            if (row != null)
            {
                MeetingData data = m_meetingServer.GetMeetingData(row);

                m_meetingData = data;

                RefreshData(data);
            }
            else
            {
                btnNew.PerformClick();
            }
        }
        public MeetingsPageViewModel MapFrom(MeetingData[] meetingsData, MeetingEventsData[] theEventsData)
        {
            var pageViewModel = new MeetingsPageViewModel();
            foreach (var meetingData in meetingsData)
            {
                pageViewModel.Meetings.Add(new SelectListItem() {Text = meetingData.Name, Value = meetingData.Id});
            }

            if (theEventsData !=null)
            {
                foreach (var meetingEventsData in theEventsData)
                {
                   pageViewModel.Events.Add(new Event(){ EventName = meetingEventsData.EventName, StartsAt = meetingEventsData.StartsAt});
                }
            }
            return pageViewModel;
        }
Ejemplo n.º 30
0
        public async Task MeetingDisplayByIdDataTest()
        {
            using var store   = GetDocumentStore();
            using var session = store.OpenAsyncSession();

            var query = new MeetingDisplayById {
                Session = session, Id = MeetingData.FirstId
            };
            await query.Execute();

            query.Result.Should().NotBeNull();
            query.Result.Id.Should().Be(MeetingData.FirstId);
            Assert.That(query.Result, Is.DeepEqualTo(MeetingData.GetFirstDisplay(false)));
            query.Result.Searchable.Should().BeNullOrEmpty();
            query.Result.Searchable = new List <string> {
                "something!"
            };
        }
Ejemplo n.º 31
0
        public async Task MeetingDisplayByFilterDataTestTenant()
        {
            var filter = new MeetingFilter {
                TenantRestrict = true, Take = 10
            };

            using var store   = GetDocumentStore();
            using var session = store.OpenAsyncSession();

            var query = new MeetingDisplayByFilter {
                Session = session, Filter = filter, CurrentUser = StandardUser
            };
            await query.Execute();

            query.Result.Should().NotBeNull();
            query.Result.Count().Should().Be(1);
            Assert.That(query.Result.First(), Is.DeepEqualTo(MeetingData.GetFirstDisplay(false)));
        }
 public MeetingsPageViewModel MapFrom(MeetingData[] meetingsData)
 {
     return MapFrom(meetingsData, null);
 }