private static CalendarRequest GenerateCalendarRequest(int memoId)
        {
            MemoItem memo = db.DbCalendar.Get(new CalendarSearchParameters {
                ID = memoId
            }).FirstOrDefault();
            LoggedUser user            = db.DbAuth.GetUser(uId);
            var        mailingSettings = db.DbGenericData.GetGenericData <SystemMailingSettings>(new GenericDataSearchParameters {
            }).First();

            return(new CalendarRequest
            {
                FromEmail = mailingSettings.SystemEmailAddress,
                FromName = mailingSettings.SystemName,
                NetworkCredentialPassword = mailingSettings.NetworkCredentialPassword,
                NetworkCredentialUserName = mailingSettings.NetworkCredentialUserName,
                Subject = mailingSettings.EmailsGenericSubject,
                To = new List <string> {
                    user.EmailAdress
                },
                CalendarEvents = new List <MyCalendarEvent>
                {
                    new MyCalendarEvent
                    {
                        BeginDate = memo.Date,
                        EndDate = memo.Date.AddHours(1),
                        Details = memo.Description,
                        LocationText = memo.Display,
                        SummaryText = memo.title,
                    }
                }
            });
        }
        private static void SendViaGoogleApi(CalendarJob userPendingJob)
        {
            LoadApiSettings();

            if (googleApiData.HasData)
            {
                MemoItem memo = db.DbCalendar.Get(new CalendarSearchParameters {
                    ID = userPendingJob.MemoItemId
                }).FirstOrDefault();
                var gar = new GoogleAccountRequest
                {
                    CredentialsJsonString = googleApiData.GenerateJsonString(),
                    CalendarEvent         = new MyCalendarEvent
                    {
                        BeginDate    = memo.Date,
                        EndDate      = memo.Date.AddHours(1),
                        Details      = memo.Description,
                        LocationText = memo.Display,
                        SummaryText  = memo.title,
                    },
                    GoogleDataStore = (IGoogleDataStore)db.DbGoogle
                };
                if (memo.RepeatEvery.HasValue && memo.RepeatEvery.Value != RepeatEvery.None)
                {
                    gar.CalendarEvent.Frequency      = memo.RepeatEvery.GetDescription();
                    gar.CalendarEvent.FrequencyCount = 10;
                }
                GoogleCalendarExecuter.InsertGoogleAPIEvent(gar);
                CloseJob(userPendingJob);
            }
        }
 public static MyCalendarEvent ToCalendarEvent(this MemoItem memo)
 {
     return(new MyCalendarEvent
     {
         BeginDate = memo.Date,
         Details = memo.Description,
         EndDate = memo.Date.AddHours(1),
         SummaryText = memo.title,
         LocationText = memo.Description
     });
 }
Esempio n. 4
0
        protected void rpCalendar_ItemDataBound(object sender, RepeaterItemEventArgs e)
        {
            if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem)
            {
                MemoItem im      = (MemoItem)e.Item.DataItem;
                Label    lblName = (Label)e.Item.FindControl("lblName");
                Label    lblDesc = (Label)e.Item.FindControl("lblDesc");

                lblName.Text = im.Date.HebrewDayName();
                lblDesc.Text = string.Format("{0} -  {1}", im.MarkableName, im.MarkableDescription);
            }
        }
Esempio n. 5
0
 protected void btnadddiary_ServerClick(object sender, EventArgs e)
 {
     if (ValidateInputs(txadddiaryname, txadddiarydesc, txadddiarydate, txadddiaryHour))
     {
         var c = new MemoItem
         {
             UserId       = CurrentUser.Id,
             CreationDate = DateTime.Now,
             title        = txadddiaryname.Value,
             Description  = txadddiarydesc.Value,
             Date         = Convert.ToDateTime(txadddiarydate.Value).AddHours(txadddiaryHour.GetHours() ?? 0).AddMinutes(txadddiaryHour.GetMinutes() ?? 0),
             RepeatEvery  = (RepeatEvery)cmbRepeatEvery.SelectedValue.ToInteger(),
             Shared       = cmbShareVals.SelectedValue.ToInteger() == (int)MemoSharingEnum.YES
         };
         DBController.DbCalendar.Add(c);
         AlertMessage("פעולה זו בוצעה בהצלחה");
         ClearInputs(txadddiaryname, txadddiarydesc, txadddiarydate);
     }
     else
     {
         AlertMessage("אחד או יותר מהשדות ריקים");
     }
 }