public bool updateToOrganize(int ActivityId, string start, string end, string title, string body, string color) { OrganizeDataAccess oda = new OrganizeDataAccess(); List <OrganizeSchedular> organizeSchedular = new List <OrganizeSchedular>(); organizeSchedular = oda.GetEventsByActivityID(ActivityId); oda.DeleteEvents(organizeSchedular); bool success = addToOrganize(ActivityId, start, end, title, body, color); oda.Save(); return(success); }
public bool addToOrganize(int id, string start, string end, string title, string location, string color) { OrganizeDataAccess oda = new OrganizeDataAccess(); OrganizeSchedular organizeSchedular = new OrganizeSchedular(); organizeSchedular = null; DateTime startDate; DateTime lastDate; try { startDate = Convert.ToDateTime(start); } catch { startDate = System.DateTime.Now; } try { lastDate = Convert.ToDateTime(end); } catch { lastDate = startDate.AddHours(1); } organizeSchedular = new OrganizeSchedular(); organizeSchedular.ID = Guid.NewGuid().ToString(); organizeSchedular.Title = title; organizeSchedular.InstanceID = ProjectHelpers.RunrentInstanceId; organizeSchedular.ActivityId = id; organizeSchedular.OpenUserID = ProjectHelpers.RunrentOpenUserID; organizeSchedular.StartSchedule = startDate; organizeSchedular.EndSchedule = lastDate; organizeSchedular.Color = color; organizeSchedular.Location = location; organizeSchedular.LastUpdatedDate = DateTime.Now; organizeSchedular.CreateDate = DateTime.Now; oda.AddEvent(organizeSchedular); try { oda.Save(); return(true); } catch (Exception) { } return(false); }
public bool addToOrganize(int id, string start, string end, string title, string location, string color) { OrganizeDataAccess oda = new OrganizeDataAccess(); OrganizeSchedular organizeSchedular = new OrganizeSchedular(); organizeSchedular = null; DateTime startDate; DateTime lastDate; try { startDate = Convert.ToDateTime(start); } catch { startDate = System.DateTime.Now; } try { lastDate = Convert.ToDateTime(end); } catch { lastDate = startDate.AddHours(1); } organizeSchedular = new OrganizeSchedular(); organizeSchedular.ID = Guid.NewGuid().ToString(); organizeSchedular.Title = title; organizeSchedular.InstanceID = ProjectHelpers.RunrentInstanceId; organizeSchedular.ActivityId = id; organizeSchedular.OpenUserID = ProjectHelpers.RunrentOpenUserID; organizeSchedular.StartSchedule = startDate; organizeSchedular.EndSchedule = lastDate; organizeSchedular.Color = color; organizeSchedular.Location = location; organizeSchedular.LastUpdatedDate = DateTime.Now; organizeSchedular.CreateDate = DateTime.Now; oda.AddEvent(organizeSchedular); try { oda.Save(); return true; } catch (Exception) { } return false; }
public bool updateToOrganize(int ActivityId, string start, string end, string title, string body, string color) { OrganizeDataAccess oda = new OrganizeDataAccess(); List<OrganizeSchedular> organizeSchedular = new List<OrganizeSchedular>(); organizeSchedular = oda.GetEventsByActivityID(ActivityId); oda.DeleteEvents(organizeSchedular); bool success = addToOrganize(ActivityId, start, end, title, body, color); oda.Save(); return success; }