Calendar: core: deleted unused code
This commit is contained in:
parent
b974c63b64
commit
e42cfc2945
@ -1,101 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2018
|
||||
*
|
||||
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
|
||||
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
|
||||
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
|
||||
*
|
||||
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
|
||||
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
|
||||
* relevant author attributions when distributing the software. If the display of the logo in its graphic
|
||||
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
|
||||
* in every copy of the program you distribute.
|
||||
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ASC.Common.Utils;
|
||||
using ASC.Web.Core.Calendars;
|
||||
|
||||
namespace ASC.Calendar.BusinessObjects
|
||||
{
|
||||
/*
|
||||
internal class ColumnCollection
|
||||
{
|
||||
private List<SelectColumnInfo> _columns = new List<SelectColumnInfo>();
|
||||
|
||||
public class SelectColumnInfo{
|
||||
|
||||
public string Name{get; set;}
|
||||
public int Ind{get; set;}
|
||||
|
||||
public T Parse<T>(object[] row)
|
||||
{
|
||||
if (typeof(T).Equals(typeof(int)))
|
||||
return (T)((object)Convert.ToInt32(row[this.Ind]));
|
||||
|
||||
if (typeof(T).Equals(typeof(Guid)))
|
||||
return (T)((object)new Guid(Convert.ToString(row[this.Ind])));
|
||||
|
||||
if (typeof(T).Equals(typeof(Boolean)))
|
||||
return (T)((object)(Convert.ToBoolean(row[this.Ind])));
|
||||
|
||||
if (typeof(T).Equals(typeof(DateTime)))
|
||||
return (T)((object)Convert.ToDateTime(row[this.Ind]));
|
||||
|
||||
if (typeof(T).Equals(typeof(RecurrenceRule)))
|
||||
{
|
||||
return (T)((object) RecurrenceRule.Parse(Convert.ToString(row[this.Ind])));
|
||||
}
|
||||
|
||||
if (typeof(T).Equals(typeof(TimeZoneInfo)))
|
||||
{
|
||||
if (IsNull(row))
|
||||
return (T)(object)null;
|
||||
|
||||
var timeZoneId = Convert.ToString(row[this.Ind]);
|
||||
|
||||
return (T)((object)TimeZoneConverter.GetTimeZone(timeZoneId));
|
||||
}
|
||||
|
||||
return (T)(object)(Convert.ToString(row[this.Ind])??"");
|
||||
}
|
||||
|
||||
public bool IsNull(object[] row)
|
||||
{
|
||||
return row[this.Ind] == null || row[this.Ind] == DBNull.Value;
|
||||
}
|
||||
}
|
||||
|
||||
public SelectColumnInfo RegistryColumn(string selectName)
|
||||
{
|
||||
var c = new SelectColumnInfo() { Name = selectName, Ind = _columns.Count};
|
||||
_columns.Add(c);
|
||||
return c;
|
||||
}
|
||||
|
||||
public string[] SelectQuery
|
||||
{
|
||||
get
|
||||
{
|
||||
return _columns.Select(c => c.Name).ToArray();
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
}
|
@ -1911,75 +1911,7 @@ namespace ASC.Calendar.BusinessObjects
|
||||
}
|
||||
CalendarDb.SaveChanges();
|
||||
tx.Commit();
|
||||
/*
|
||||
public List<EventNotificationData> ExtractAndRecountNotifications(DateTime utcDate)
|
||||
{
|
||||
List<EventNotificationData> data;
|
||||
using (var tr = db.BeginTransaction())
|
||||
{
|
||||
var cc = new ColumnCollection();
|
||||
var userIdCol = cc.RegistryColumn("user_id");
|
||||
var tenantCol = cc.RegistryColumn("tenant");
|
||||
var eventIdCol = cc.RegistryColumn("event_id");
|
||||
var notifyDateCol = cc.RegistryColumn("notify_date");
|
||||
var rruleCol = cc.RegistryColumn("rrule");
|
||||
var alertTypeCol = cc.RegistryColumn("alert_type");
|
||||
var timeZoneCol = cc.RegistryColumn("time_zone");
|
||||
|
||||
data = new List<EventNotificationData>(db.ExecuteList(new SqlQuery("calendar_notifications").Select(cc.SelectQuery)
|
||||
.Where(Exp.Le(notifyDateCol.Name, utcDate)))
|
||||
.Select(r => new EventNotificationData
|
||||
{
|
||||
UserId = userIdCol.Parse<Guid>(r),
|
||||
TenantId = tenantCol.Parse<int>(r),
|
||||
EventId = eventIdCol.Parse<int>(r),
|
||||
NotifyUtcDate = notifyDateCol.Parse<DateTime>(r),
|
||||
RRule = rruleCol.Parse<RecurrenceRule>(r),
|
||||
AlertType = (EventAlertType)alertTypeCol.Parse<int>(r),
|
||||
TimeZone = timeZoneCol.Parse<TimeZoneInfo>(r)
|
||||
}));
|
||||
|
||||
|
||||
var events = GetEventsByIds(data.Select(d => (object)d.EventId).Distinct().ToArray(), Guid.Empty);
|
||||
data.ForEach(d => d.Event = events.Find(e => String.Equals(e.Id, d.EventId.ToString(CultureInfo.InvariantCulture), StringComparison.InvariantCultureIgnoreCase)));
|
||||
|
||||
foreach (var d in data)
|
||||
{
|
||||
if (d.RRule.Freq == Frequency.Never)
|
||||
db.ExecuteNonQuery(new SqlDelete("calendar_notifications").Where(Exp.Eq("user_id", d.UserId) & Exp.Eq("event_id", d.EventId)));
|
||||
else
|
||||
{
|
||||
var alertDate = GetNextAlertDate(d.Event.UtcStartDate, d.RRule, d.AlertType, d.TimeZone, d.Event.AllDayLong);
|
||||
if (!alertDate.Equals(DateTime.MinValue))
|
||||
{
|
||||
db.ExecuteNonQuery(new SqlInsert("calendar_notifications", true).InColumnValue("user_id", d.UserId)
|
||||
.InColumnValue("event_id", d.EventId)
|
||||
.InColumnValue("rrule", d.RRule.ToString())
|
||||
.InColumnValue("alert_type", (int)d.AlertType)
|
||||
.InColumnValue("tenant", d.TenantId)
|
||||
.InColumnValue("notify_date", alertDate)
|
||||
.InColumnValue("time_zone", d.TimeZone.Id));
|
||||
}
|
||||
else
|
||||
db.ExecuteNonQuery(new SqlDelete("calendar_notifications").Where(Exp.Eq("user_id", d.UserId) & Exp.Eq("event_id", d.EventId)));
|
||||
}
|
||||
}
|
||||
|
||||
tr.Commit();
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (HttpContext.Current == null && db != null)
|
||||
{
|
||||
db.Dispose();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public string GetSystemAuthorization()
|
||||
|
@ -1,74 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* (c) Copyright Ascensio System Limited 2010-2018
|
||||
*
|
||||
* This program is freeware. You can redistribute it and/or modify it under the terms of the GNU
|
||||
* General Public License (GPL) version 3 as published by the Free Software Foundation (https://www.gnu.org/copyleft/gpl.html).
|
||||
* In accordance with Section 7(a) of the GNU GPL its Section 15 shall be amended to the effect that
|
||||
* Ascensio System SIA expressly excludes the warranty of non-infringement of any third-party rights.
|
||||
*
|
||||
* THIS PROGRAM IS DISTRIBUTED WITHOUT ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. For more details, see GNU GPL at https://www.gnu.org/copyleft/gpl.html
|
||||
*
|
||||
* You can contact Ascensio System SIA by email at sales@onlyoffice.com
|
||||
*
|
||||
* The interactive user interfaces in modified source and object code versions of ONLYOFFICE must display
|
||||
* Appropriate Legal Notices, as required under Section 5 of the GNU GPL version 3.
|
||||
*
|
||||
* Pursuant to Section 7 § 3(b) of the GNU GPL you must retain the original ONLYOFFICE logo which contains
|
||||
* relevant author attributions when distributing the software. If the display of the logo in its graphic
|
||||
* form is not reasonably feasible for technical reasons, you must include the words "Powered by ONLYOFFICE"
|
||||
* in every copy of the program you distribute.
|
||||
* Pursuant to Section 7 § 3(e) we decline to grant you any rights under trademark law for use of our trademarks.
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
using System;
|
||||
using ASC.Web.Core.Calendars;
|
||||
|
||||
namespace ASC.Calendar.BusinessObjects
|
||||
{
|
||||
/*
|
||||
public class EventNotificationData
|
||||
{
|
||||
public int TenantId { get; set; }
|
||||
public Guid UserId { get; set; }
|
||||
public int EventId { get; set; }
|
||||
public Event Event { get; set; }
|
||||
public DateTime NotifyUtcDate { get; set; }
|
||||
public RecurrenceRule RRule { get; set; }
|
||||
public EventAlertType AlertType { get; set; }
|
||||
public TimeZoneInfo TimeZone { get; set; }
|
||||
|
||||
public EventNotificationData()
|
||||
{
|
||||
RRule = new RecurrenceRule();
|
||||
}
|
||||
|
||||
public DateTime GetUtcStartDate()
|
||||
{
|
||||
if(Event==null)
|
||||
return DateTime.MinValue;
|
||||
|
||||
if(RRule.Freq == Frequency.Never)
|
||||
return Event.UtcStartDate;
|
||||
|
||||
return NotifyUtcDate.AddMinutes((-1) * DataProvider.GetBeforeMinutes(AlertType));
|
||||
|
||||
}
|
||||
|
||||
public DateTime GetUtcEndDate()
|
||||
{
|
||||
if(Event==null)
|
||||
return DateTime.MinValue;
|
||||
|
||||
if (RRule.Freq == Frequency.Never || Event.AllDayLong || Event.UtcEndDate == DateTime.MinValue)
|
||||
return Event.UtcEndDate;
|
||||
|
||||
return GetUtcStartDate().Add(Event.UtcEndDate - Event.UtcStartDate);
|
||||
}
|
||||
|
||||
}
|
||||
*/
|
||||
}
|
@ -251,14 +251,6 @@ namespace ASC.Calendar.Controllers
|
||||
AllSeries = 2
|
||||
}
|
||||
|
||||
//[Read("info")]
|
||||
//public Module GetModule()
|
||||
//{
|
||||
// var product = new CalendarProduct();
|
||||
// product.Init();
|
||||
// return new Module(product);
|
||||
//}
|
||||
|
||||
[Read("info")]
|
||||
public Module GetModule()
|
||||
{
|
||||
|
@ -78,86 +78,9 @@ namespace ASC.Calendar.Notification
|
||||
DisplayUserSettingsHelper = displayUserSettingsHelper;
|
||||
|
||||
NotifyContext = new NotifyContext(serviceProvider);
|
||||
_notifyClient = NotifyContext.NotifyService.RegisterClient(CalendarNotifySource, ServiceProvider.CreateScope());
|
||||
_notifyClient = WorkContext.NotifyContext.NotifyService.RegisterClient(CalendarNotifySource, ServiceProvider.CreateScope());
|
||||
}
|
||||
|
||||
private static bool _isRegistered = false;
|
||||
public static void RegisterSendMethod()
|
||||
{
|
||||
if (!_isRegistered)
|
||||
{
|
||||
lock (_syncName)
|
||||
{
|
||||
if (!_isRegistered)
|
||||
{
|
||||
// _notifyClient.RegisterSendMethod(NotifyAbouFutureEvent, "0 * * ? * *");
|
||||
|
||||
_isRegistered = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
/*private void NotifyAbouFutureEvent(DateTime scheduleDate)
|
||||
{
|
||||
try
|
||||
{
|
||||
using (var provider = new DataProvider())
|
||||
{
|
||||
foreach (var data in provider.ExtractAndRecountNotifications(scheduleDate))
|
||||
{
|
||||
if (data.Event == null || data.Event.Status == EventStatus.Cancelled)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var tenant = CoreContext.TenantManager.GetTenant(data.TenantId);
|
||||
if (tenant == null ||
|
||||
tenant.Status != TenantStatus.Active ||
|
||||
TariffState.NotPaid <= CoreContext.PaymentManager.GetTariff(tenant.TenantId).State)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
CoreContext.TenantManager.SetCurrentTenant(tenant);
|
||||
|
||||
var r =
|
||||
CalendarNotifySource.Instance.GetRecipientsProvider().GetRecipient(data.UserId.ToString());
|
||||
if (r == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var startDate = data.GetUtcStartDate();
|
||||
var endDate = data.GetUtcEndDate();
|
||||
|
||||
if (!data.Event.AllDayLong)
|
||||
{
|
||||
startDate = startDate.Add(data.TimeZone.GetOffset());
|
||||
endDate = (endDate == DateTime.MinValue
|
||||
? DateTime.MinValue
|
||||
: endDate.Add(data.TimeZone.GetOffset()));
|
||||
}
|
||||
|
||||
_notifyClient.SendNoticeAsync(CalendarNotifySource.EventAlert,
|
||||
null,
|
||||
r,
|
||||
true,
|
||||
new TagValue("EventName", data.Event.Name),
|
||||
new TagValue("EventDescription", data.Event.Description ?? ""),
|
||||
new TagValue("EventStartDate",
|
||||
startDate.ToShortDateString() + " " + startDate.ToShortTimeString()),
|
||||
new TagValue("EventEndDate",
|
||||
(endDate > startDate)
|
||||
? (endDate.ToShortDateString() + " " + endDate.ToShortTimeString())
|
||||
: ""),
|
||||
new TagValue("Priority", 1));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception error)
|
||||
{
|
||||
LogManager.GetLogger("ASC.Notify.Calendar").Error(error);
|
||||
}
|
||||
} */
|
||||
public void NotifyAboutSharingCalendar(ASC.Calendar.BusinessObjects.Calendar calendar)
|
||||
{
|
||||
NotifyAboutSharingCalendar(calendar, null);
|
||||
@ -239,17 +162,6 @@ namespace ASC.Calendar.Notification
|
||||
public static INotifyAction CalendarSharing = new NotifyAction("CalendarSharingPattern");
|
||||
public static INotifyAction EventAlert = new NotifyAction("EventAlertPattern");
|
||||
|
||||
/*public CalendarNotifySource Instance
|
||||
{
|
||||
get;
|
||||
private set;
|
||||
}
|
||||
|
||||
static CalendarNotifySource()
|
||||
{
|
||||
Instance = new CalendarNotifySource();
|
||||
}*/
|
||||
|
||||
public CalendarNotifySource(UserManager userManager, IRecipientProvider recipientsProvider, SubscriptionManager subscriptionManager)
|
||||
: base(new Guid("{40650DA3-F7C1-424c-8C89-B9C115472E08}"), userManager, recipientsProvider, subscriptionManager)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user