Пример #1
0
        public static CustomAppointment CreateCustomAppointment(string subject, object resourceId, int status, int label, int id, DateTime start, DateTime end)
        {
            CustomAppointment apt = new CustomAppointment();

            apt.ID        = id;
            apt.Subject   = subject;
            apt.OwnerId   = Convert.ToInt32(resourceId);
            apt.StartTime = start;
            apt.EndTime   = end;
            apt.Status    = status;
            apt.Label     = label;
            return(apt);
        }
Пример #2
0
        public static List <CustomAppointment> GetAppointments(List <CustomResource> resources)
        {
            List <CustomAppointment> appointments = new List <CustomAppointment>();

            foreach (CustomResource item in resources)
            {
                string subjPrefix = item.Name + "'s ";
                appointments.Add(CustomAppointment.CreateCustomAppointment(subjPrefix + "meeting", item.ResID, 2, 5, lastInsertedID++));
                appointments.Add(CustomAppointment.CreateCustomAppointment(subjPrefix + "travel", item.ResID, 3, 6, lastInsertedID++));
                appointments.Add(CustomAppointment.CreateCustomAppointment(subjPrefix + "phone call", item.ResID, 0, 10, lastInsertedID++));
            }
            return(appointments);
        }
Пример #3
0
        public static CustomAppointment CreateCustomAppointment(string subject, object resourceId, int status, int label, int id)
        {
            CustomAppointment apt = new CustomAppointment();

            apt.ID        = id;
            apt.Subject   = subject;
            apt.OwnerId   = String.Format("<ResourceIds>\r\n<ResourceId Type=\"System.Int32\" Value=\"{0}\"/>\r\n</ResourceIds>", resourceId);
            apt.StartTime = DateTime.Now.AddHours(id);
            apt.EndTime   = apt.StartTime.AddHours(3);
            apt.Status    = status;
            apt.Label     = label;
            return(apt);
        }
Пример #4
0
        public static void RemoveAppointments(CustomAppointment[] appts)
        {
            if (appts.Length == 0)
            {
                return;
            }

            List <CustomAppointment> appointmnets = HttpContext.Current.Session["AppointmentsList"] as List <CustomAppointment>;

            for (int i = 0; i < appts.Length; i++)
            {
                CustomAppointment sourceObject = appointmnets.First <CustomAppointment>(apt => apt.ID == appts[i].ID);
                appointmnets.Remove(sourceObject);
            }
        }
Пример #5
0
 public static List <CustomAppointment> GetAppointments(List <CustomResource> resources)
 {
     //if (_appointments == null) {
     _appointments = new List <CustomAppointment>();
     foreach (CustomResource item in resources)
     {
         for (int i = -30; i < 30; i++)
         {
             string subjPrefix = item.Name + "'s ";
             _appointments.Add(CustomAppointment.CreateCustomAppointment(subjPrefix + "meeting", item.ResID, 2, 5, lastInsertedID++, DateTime.Now.AddDays(i), DateTime.Now.AddDays(i).AddHours(3)));
             _appointments.Add(CustomAppointment.CreateCustomAppointment(subjPrefix + "travel", item.ResID, 3, 6, lastInsertedID++, DateTime.Now.AddDays(i), DateTime.Now.AddDays(i).AddHours(4)));
             _appointments.Add(CustomAppointment.CreateCustomAppointment(subjPrefix + "phone call", item.ResID, 0, 10, lastInsertedID++, DateTime.Now.AddDays(i), DateTime.Now.AddDays(i).AddHours(2)));
         }
     }
     //}
     return(_appointments);
 }