Exemple #1
0
        private void FindSites()
        {
            string[] lines = Body.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
            string   check = "sites#";

            foreach (var line in lines)
            {
                string input = line.ToLower();

                if (input.Contains(check))
                {
                    // Extracts the content to the right of the searchkey.
                    string lineNoComma = line.Remove(0, check.Length).Trim();
                    lineNoComma = lineNoComma.Replace(",", "|");

                    foreach (var item in t.TextLst(lineNoComma))
                    {
                        AppointmentSite appointmentSite = new AppointmentSite()
                        {
                            MicrotingSiteUid = int.Parse(item),
                            ProcessingState  = Constants.ProcessingState.Processed
                        };
                        AppointmentSites.Add(appointmentSite);
                    }

                    AppointmentSites = AppointmentSites.Distinct().ToList();

                    continue;
                }
            }
        }
Exemple #2
0
        public static Appointment AppointmentsFind(AppointmentPnDbContext dbContext, string globalId)
        {
//            log.LogStandard(t.GetMethodName("SQLController"), "AppointmentsFind looking for one with globalId " + globalId);

            try
            {
                var match = dbContext.Appointments.SingleOrDefault(x => x.GlobalId == globalId);
                if (match != null)
                {
                    bool        color_rule = match.ColorRule == 0 ? true : false;
                    Appointment appo       = new Appointment()
                    {
                        GlobalId        = match.GlobalId,
                        Start           = (DateTime)match.StartAt,
                        Duration        = (int)match.Duration,
                        Subject         = match.Subject,
                        ProcessingState = match.ProcessingState,
                        Body            = match.Body,
                        ColorRule       = color_rule,
                        Id = match.Id
                    };
                    appo.Completed = match.Completed == 0 ? false : true;
                    try {
                        appo.TemplateId = (int)match.SdkeFormId;
                    }
                    catch { }

                    foreach (Microting.AppointmentBase.Infrastructure.Data.Entities.AppointmentSite appointmentSite in match.AppointmentSites)
                    {
                        AppointmentSite obj = new AppointmentSite()
                        {
                            Id = appointmentSite.Id,
                            MicrotingSiteUid = appointmentSite.MicrotingSiteUid,
                            ProcessingState  = appointmentSite.ProcessingState,
                            SdkCaseId        = appointmentSite.SdkCaseId
                        };
                        appo.AppointmentSites.Add(obj);
                    }

                    foreach (Microting.AppointmentBase.Infrastructure.Data.Entities.AppointmentPrefillFieldValue pfv in match.AppointmentPrefillFieldValues)
                    {
                        AppointmentPrefillFieldValue appointmentPrefillFieldValue = new AppointmentPrefillFieldValue()
                        {
                            Id            = pfv.Id,
                            FieldId       = pfv.FieldId,
                            AppointmentId = (int)pfv.AppointmentId,
                            FieldValue    = pfv.FieldValue
                        };
                        appo.AppointmentPrefillFieldValues.Add(appointmentPrefillFieldValue);
                    }
                    return(appo);
                }
                else
                {
                    return(null);
                }
            }
            catch (Exception ex)
            {
//                log.LogException(t.GetMethodName("SQLController"), "failed", ex, false);
                return(null);
            }
        }