public static ClientDataSet.RecurringScheduleDataTable GetRecurringSchedulesByRecurrenceRule(Guid organizationId, Guid?instanceId, string definition) { using (RecurringScheduleTableAdapter adapter = new RecurringScheduleTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { return(adapter.GetRecurringScheduleByRecurrenceRule(organizationId, instanceId, definition)); } }
public static ClientDataSet.RecurringScheduleDataTable GetRecurringSchedulesByEntityId(Guid organizationId, Guid?instanceId, string localEntityType, string localEntityId) { using (RecurringScheduleTableAdapter adapter = new RecurringScheduleTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { return(adapter.GetRecurringScheduleByEntityId(organizationId, instanceId, localEntityType, localEntityId)); } }
public static ClientDataSet.RecurringScheduleRow GetRecurringSchedulesRow(Guid recurringScheduleId, Guid organizationId) { using (RecurringScheduleTableAdapter adapter = new RecurringScheduleTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { ClientDataSet.RecurringScheduleDataTable table = adapter.GetRecurringScheduleById(recurringScheduleId); return((table.Count > 0) ? table[0] : null); } }
public static void UpdateRecurringSchedule(Guid recurringScheduleId, Guid organizationId, Guid?instanceId, string localEntityType, string localEntityId , string name, DateTime startDate, DateTime endDate, string recurrenceRule, DateTime updatedTime, Guid updatedBy, bool deleted) { if (recurringScheduleId.Equals(Guid.Empty) || organizationId.Equals(Guid.Empty) || string.IsNullOrEmpty(name)) { throw new ArgumentNullException("recurringScheduleId", Properties.Resources.ExceptionMessage_ArgumentsIsEmpty); } ClientDataSet.RecurringScheduleDataTable table = new ClientDataSet.RecurringScheduleDataTable(); ClientDataSet.RecurringScheduleRow row = GetRecurringSchedulesRow(recurringScheduleId, organizationId); if (row == null) { row = table.NewRecurringScheduleRow(); } row.RecurringScheduleId = recurringScheduleId; row.OrganizationId = organizationId; if (instanceId.HasValue) { row.InstanceId = instanceId.Value; } else { row.SetInstanceIdNull(); } row.LocalEntityType = localEntityType; row.LocalEntityId = localEntityId; row.Name = name; row.StartDate = startDate; row.EndDate = endDate; row.RecurrenceRule = recurrenceRule; row.UpdatedTime = updatedTime; row.UpdatedBy = updatedBy; row.Deleted = deleted; if (row.RowState == DataRowState.Detached) { table.AddRecurringScheduleRow(row); } using (RecurringScheduleTableAdapter adapter = new RecurringScheduleTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { adapter.Update(row); } }
public static Collection <string> GetEntityTypes(Guid organizationId, Guid?instanceId) { Collection <string> result = new Collection <string>(); ClientDataSet.RecurringScheduleDataTable table = null; using (RecurringScheduleTableAdapter adapter = new RecurringScheduleTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { table = adapter.GetRecurringScheduleEntityTypes(organizationId, instanceId); } foreach (ClientDataSet.RecurringScheduleRow row in table) { result.Add(row.LocalEntityType); } return(result); }
public static void DeleteRecurringSchedule(Guid recurringScheduleId, Guid organizationId) { if (recurringScheduleId.Equals(Guid.Empty)) { throw new ArgumentNullException("recurringScheduleId", Properties.Resources.ExceptionMessage_ArgumentsIsEmpty); } ClientDataSet.RecurringScheduleRow row = GetRecurringSchedulesRow(recurringScheduleId, organizationId); if (row != null) { row.Deleted = true; using (RecurringScheduleTableAdapter adapter = new RecurringScheduleTableAdapter(OrganizationProvider.GetConnectionString(organizationId))) { adapter.Update(row); } } }