Exemple #1
0
 public static bool CreateNewEvent(string Title, string Description, string NewEventDate, string NewEventTime, string NewEventDuration, EventType eventType, int EventID = 0)
 {
     try
     {
         DiaryContainer   ent = new DiaryContainer();
         AppointmentDiary rec = new AppointmentDiary();
         rec.Title             = Title; rec.Description = Description; rec.EventType = (int)eventType;
         rec.DateTimeScheduled = DateTime.ParseExact(NewEventDate + " " + NewEventTime, "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture);
         rec.AppointmentLength = Int32.Parse(NewEventDuration);
         if (EventID > 0)
         {
             rec.ID = EventID;
             ent.Entry(rec).State = System.Data.Entity.EntityState.Modified;
             ent.SaveChanges();
         }
         else
         {
             ent.AppointmentDiary.Add(rec);
             ent.SaveChanges();
         }
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }
Exemple #2
0
        public static bool InitialiseDiary()
        {
            // init connection to database
            DiaryContainer ent = new DiaryContainer();
            try
            {
                for (int i = 0; i < 30; i++)
                {
                    AppointmentDiary item = new AppointmentDiary();
                    // record ID is auto generated
                    item.Title = "Appt: " + i.ToString();
                    item.SomeImportantKey = i;
                    item.StatusENUM = GetRandomValue(0, 3); // random is exclusive - we have three status enums
                    if (i <= 5) // create a few appointments for todays date
                    {
                        item.DateTimeScheduled = GetRandomAppointmentTime(false, true);
                    }
                    else
                    {  // rest of appointments on previous and future dates
                        if (i % 2 == 0)
                            item.DateTimeScheduled = GetRandomAppointmentTime(true, false); // flip/flop between date ahead of today and behind today
                        else item.DateTimeScheduled = GetRandomAppointmentTime(false, false);
                    }
                    item.AppointmentLength = GetRandomValue(1, 5) * 15; // appoiment length in blocks of fifteen minutes in this demo
                    ent.AppointmentDiary.Add(item);
                    ent.SaveChanges();
                }
            }
            catch (Exception)
            {
                return false;
            }

            return ent.AppointmentDiary.Count() > 0;
        }
Exemple #3
0
        public JsonResult SendContact(ContactInfo model)
        {
            //   bool isOK = false;

            var contact = new ContactInfo {
                FullName = model.FullName, Email = model.Email, Phone = model.Phone, Message = model.Message, DateSent = DateTime.Now
            };
            DiaryContainer db = new DiaryContainer();

            db.ContactInfo.Add(contact);
            db.SaveChanges();
            return(Json("Your message has been sent successfully. We will contact you with feedback shortly.", JsonRequestBehavior.DenyGet));
        }
Exemple #4
0
        public static bool InitialiseDiary()
        {
            DiaryContainer ent = new DiaryContainer();

            try
            {
                for (int i = 0; i < 30; i++)
                {
                    AppointmentDiary item = new AppointmentDiary();

                    //record ID is auto generated
                    item.Title            = "Appt : " + i.ToString();
                    item.SomeImportantKey = i;
                    item.StatuENUM        = GetRandomValue(0, 3); //radom is exclusive - we have three status enums

                    if (i <= 5)                                   //create ten appointments for todays date
                    {
                        item.DateTimeSchedule = GetRandomAppointmentTime(false, true);
                    }
                    else
                    {
                        //rest of appointments on previous and future dates

                        if (i % 2 == 0)
                        {
                            item.DateTimeSchedule = GetRandomAppointmentTime(true, false);

                            //flip/flop between date ahead of today and behind today
                        }
                        else
                        {
                            item.DateTimeSchedule = GetRandomAppointmentTime(false, false);
                        }

                        item.AppointmentLength = GetRandomValue(1, 5) * 15;

                        //appointment length always less than an hour in blocks of fifteen

                        ent.AppointmentDiaries.Add(item);
                        ent.SaveChanges();
                    }
                }
            }
            catch (Exception)
            {
                return(false);
            }

            return(ent.AppointmentDiaries.Count() > 0);
        }
 public static void UpdateDiaryEvent(int id, string NewEventStart, string NewEventEnd)
 {
     // EventStart comes ISO 8601 format, eg:  "2000-01-10T10:00:00Z" - need to convert to DateTime
     using (DiaryContainer ent = new DiaryContainer()) {
         var rec = ent.AppointmentDiary.FirstOrDefault(s => s.ID == id);
         if (rec != null)
         {
             DateTime DateTimeStart = DateTime.Parse(NewEventStart, null, DateTimeStyles.RoundtripKind).ToLocalTime(); // and convert offset to localtime
             rec.DateTimeScheduled = DateTimeStart;
             if (!String.IsNullOrEmpty(NewEventEnd))
             {
                 TimeSpan span = DateTime.Parse(NewEventEnd, null, DateTimeStyles.RoundtripKind).ToLocalTime() - DateTimeStart;
                 rec.AppointmentLength = Convert.ToInt32(span.TotalMinutes);
             }
             ent.SaveChanges();
         }
     }
 }
 public static bool CreateNewEvent(string Title, string NewEventDate, string NewEventTime, string NewEventDuration)
 {
     try
     {
         DiaryContainer   ent = new DiaryContainer();
         AppointmentDiary rec = new AppointmentDiary();
         rec.Title             = Title;
         rec.DateTimeScheduled = DateTime.ParseExact(NewEventDate + " " + NewEventTime, "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture);
         rec.AppointmentLength = Int32.Parse(NewEventDuration);
         ent.AppointmentDiary.Add(rec);
         ent.SaveChanges();
     }
     catch (Exception)
     {
         return(false);
     }
     return(true);
 }
        public ActionResult Create(RegisterViewModel icmb)
        {
            if (ModelState.IsValid)
            {
                var member = new IcomMembers
                {
                    Country    = icmb.Country,
                    FullName   = icmb.FullName,
                    State      = icmb.State,
                    Address    = icmb.Address,
                    City       = icmb.City,
                    DOB        = icmb.DOB,
                    Email      = icmb.Email,
                    Phone      = icmb.Phone,
                    PostalCode = icmb.PostalCode
                };

                member.DateRegistered = DateTime.Now;
                db.IcomMembers.Add(member);
                db.SaveChanges();

                //var dOB = member.DOB;
                //var fullName = member.FullName;
                //db.FamilyMembers.Add(new FamilyMembers { DOB = dOB, FullName = fullName, IcomMembersId = member.IcomMembersId, DateAdded = DateTime.Now });
                //db.SaveChanges();

                icmb.Family = icmb.Family.Concat(new List <FamilyViewModel>()
                {
                    new FamilyViewModel {
                        FamilyDOB = member.DOB, FamilyFullName = member.FullName, IncIndex = 1, IsPrimary = true
                    }
                });
                //mList.Add
                icmb.IcomMembersId = member.IcomMembersId;

                SaveFamilies(icmb.IcomMembersId, icmb.Family);
                Response.Redirect("https://services.madinaapps.com/donation/clients/icom/paymentOptions/308");
            }

            return(View(icmb));
        }
Exemple #8
0
        public ActionResult SaveSalaat(string Fajr, string Dhuhr, string Asr, string Maghrib, string Isha, string Khutbah1, string Khutbah2, string Jumma1, string Jumma2)
        {
            var Sataals = db.Salaat.FirstOrDefault();

            Sataals.Asr       = Asr;
            Sataals.Fajr      = Fajr;
            Sataals.DateAdded = DateTime.Now;
            Sataals.Dhuhr     = Dhuhr;
            Sataals.Maghrib   = Maghrib;
            Sataals.Isha      = Isha;
            Sataals.Khutbah1  = Khutbah1;
            Sataals.Jumma1    = Jumma1;
            Sataals.Khutbah2  = Khutbah2;
            Sataals.Jumma2    = Jumma2;

            db.Entry(Sataals).State = EntityState.Modified;// System.Data.EntityState.Modified;
            db.SaveChanges();

            return(RedirectToAction("SetSalaat"));
        }
Exemple #9
0
        public static void UpdateDiaryEvent(int id, string NewEventStart, string NewEventEnd)
        {
            // EventStart comes ISO 8601 format, eg:  "2000-01-10T10:00:00Z" - need to convert to DateTime
            using (DiaryContainer ent = new DiaryContainer())
            {
                var rec = ent.AppointmentDiary.FirstOrDefault(s => s.ID == id);
                if (rec != null)
                {
                    DateTime DateTimeStart = DateTime.Parse(NewEventStart, null, DateTimeStyles.RoundtripKind).ToLocalTime(); // and convert offset to localtime
                    rec.DateTimeScheduled = DateTimeStart;
                    if (!String.IsNullOrEmpty(NewEventEnd))
                    {
                        TimeSpan span = DateTime.Parse(NewEventEnd, null, DateTimeStyles.RoundtripKind).ToLocalTime() - DateTimeStart;
                        rec.AppointmentLength = Convert.ToInt32(span.TotalMinutes);
                    }
                    ent.SaveChanges();
                }
            }

        }
Exemple #10
0
 public static bool CreateNewEvent(string Title, string NewEventDate, string NewEventTime, string NewEventDuration)
 {
     try
     {
         DiaryContainer ent = new DiaryContainer();
         AppointmentDiary rec = new AppointmentDiary();
         rec.Title = Title;
         rec.DateTimeScheduled = DateTime.ParseExact(NewEventDate + " " + NewEventTime, "dd/MM/yyyy HH:mm", CultureInfo.InvariantCulture);
         rec.AppointmentLength = Int32.Parse(NewEventDuration);
         ent.AppointmentDiary.Add(rec);
         ent.SaveChanges();
     }
     catch (Exception)
     {
         return false;
     }
     return true;
 }