コード例 #1
0
        private static async Task OnComplete(IDialogContext context, AppointmentReport state)
        {
            // CRMの予定レコードを更新する。
            CrmService service = new Services.CrmService();

            currentAppointment             = appointments.Records.Where(x => x.Subject == state.AppointmentName).First();
            currentAppointment.Description = state.Description;
            currentAppointment.NextAction  = (int)state.NextAction;
            await service.Update("appointments", currentAppointment.Id, currentAppointment);

            string message = (appointments.Records.Count() == 1) ?
                             "本日の未報告の訪問はありません。" :
                             $"活動報告を Dynamics CRM に登録しました。本日はもう {appointments.Records.Count() - 1} 件の訪問が残っています。頑張ってください!!";

            appointments = null;
            await context.PostAsync(message);
        }
コード例 #2
0
        /// <summary>
        /// CRMの予定レコードを取得し、選択肢としてセットする。
        /// </summary>
        /// <param name="state"></param>
        /// <param name="field"></param>
        /// <returns></returns>
        private static async Task <bool> SetAppointments(AppointmentReport state, Field <AppointmentReport> field)
        {
            if (appointments == null)
            {
                CrmService service = new Services.CrmService();
                appointments = await service.GetCRMAppointments();
            }

            foreach (Appointment record in appointments.Records)
            {
                field
                .AddDescription(record.Subject, record.Subject)
                .AddTerms(record.Subject, record.Subject);
            }

            return(true);
        }