Ejemplo n.º 1
0
        private void scheduler_UserEditingAppointment(object sender, C1.WPF.Schedule.AppointmentActionEventArgs e)
        {
            e.Handled = true;
            ICRMWindowRouter     CRMWindowRouter = AifServiceContainer.Instance.GetService <ICRMWindowRouter>();
            Guid                 id   = (Guid)e.Appointment.Key[0];
            SchedulerAppointment appt = appointmentList.FirstOrDefault(a => a.Id == id);

            if (appt != null)
            {
                CRMWindowRouter.DoRoutePopup(localSession, this.ApplicationName, appt.ActivityType, appt.Id.ToString(), String.Empty);
            }
        }
Ejemplo n.º 2
0
        private void FillDataSet(SchedulerAppointmentList apptList, Dictionary <string, Dictionary <string, object> > response)
        {
            if (response == null)
            {
                return;
            }
            bool checkForDups = true;

            if (apptList.Count() == 0)
            {
                checkForDups = false;
            }
            foreach (string key in response.Keys)
            {
                try
                {
                    SchedulerAppointment schedAppt = new SchedulerAppointment();

                    schedAppt.Subject    = "[" + (string)response[key]["activitytypecode"] + "] " + (String)(response[key].ContainsKey("subject") ? response[key]["subject"] : "");
                    schedAppt.Id         = (Guid)(response[key]["activityid"]);
                    schedAppt.Start      = (DateTime)(response[key].ContainsKey("scheduledstart") ? DateTime.Parse((string)response[key]["scheduledstart"]) : DateTime.Now);
                    schedAppt.End        = (DateTime)(response[key].ContainsKey("scheduledend") ? DateTime.Parse((string)response[key]["scheduledend"]) : DateTime.Now);
                    schedAppt.Body       = (String)(response[key].ContainsKey("description") ? response[key]["description"] : "");
                    schedAppt.StatusCode = (String)(response[key].ContainsKey("statuscode") ? response[key]["statuscode"] : "");
                    schedAppt.StateCode  = (String)(response[key].ContainsKey("statecode") ? response[key]["statecode"] : "");
                    schedAppt.Location   = "";
                    schedAppt.Properties = "";
                    if (response[key]["activitytypecode_Property"] is KeyValuePair <string, object> )
                    {
                        schedAppt.ActivityType = ((KeyValuePair <string, object>)response[key]["activitytypecode_Property"]).Value as string;
                    }
                    else
                    {
                        schedAppt.ActivityType = (string)response[key]["activitytypecode"];
                    }
                    if (checkForDups == true)
                    {
                        SchedulerAppointment existingAppt = apptList.FirstOrDefault(a => a.Id == schedAppt.Id);
                        if (existingAppt != null)
                        {
                            apptList.Remove(existingAppt);
                            if (schedAppt.StateCode != "Completed" &&
                                schedAppt.StateCode != "Cancelled")
                            {
                                apptList.Add(schedAppt);
                            }
                            continue;
                        }
                        else
                        {
                            if (schedAppt.StateCode == "Completed" ||
                                schedAppt.StateCode == "Cancelled")
                            {
                                continue;
                            }
                        }
                    }
                    apptList.Add(schedAppt);
                }
                catch
                {
                }
            }
        }