public ActionResult Edit(ClubSchedulesModel modifiedModel, string FILTER_Keyword, string FILTER_Custom) { if (ModelState.IsValid) { standardizeTimeToIgnoreDate(modifiedModel); if (isExists(modifiedModel.Id, modifiedModel.Description, modifiedModel.DayOfWeek, modifiedModel.StartTime, modifiedModel.EndTime)) { ModelState.AddModelError(ClubSchedulesModel.COL_DayOfWeek.Name, "Kombinasi sudah terdaftar"); } else { ClubSchedulesModel originalModel = get(modifiedModel.Id); string log = string.Empty; log = Helper.append(log, originalModel.DayOfWeek, modifiedModel.DayOfWeek, ClubSchedulesModel.COL_DayOfWeek.LogDisplay); log = Helper.append(log, originalModel.StartTime, modifiedModel.StartTime, ClubSchedulesModel.COL_StartTime.LogDisplay); log = Helper.append(log, originalModel.EndTime, modifiedModel.EndTime, ClubSchedulesModel.COL_EndTime.LogDisplay); log = Helper.append(log, originalModel.Description, modifiedModel.Description, ClubSchedulesModel.COL_Description.LogDisplay); log = Helper.append(log, originalModel.OnlineLink, modifiedModel.OnlineLink, ClubSchedulesModel.COL_OnlineLink.LogDisplay); log = Helper.append(log, originalModel.Active, modifiedModel.Active, ClubSchedulesModel.COL_Active.LogDisplay); log = Helper.append(log, originalModel.Notes, modifiedModel.Notes, ClubSchedulesModel.COL_Notes.LogDisplay); if (!string.IsNullOrEmpty(log)) { update(modifiedModel, log); } return(RedirectToAction(nameof(Index), new { FILTER_Keyword = FILTER_Keyword })); } } setViewBag(FILTER_Keyword); return(View(modifiedModel)); }
public void update(ClubSchedulesModel model, string log) { LIBWebMVC.WebDBConnection.Update(db.Database, "ClubSchedules", DBConnection.getSqlParameter(ClubSchedulesModel.COL_Id.Name, model.Id), DBConnection.getSqlParameter(ClubSchedulesModel.COL_Languages_Id.Name, model.Languages_Id), DBConnection.getSqlParameter(ClubSchedulesModel.COL_Description.Name, model.Description), DBConnection.getSqlParameter(ClubSchedulesModel.COL_OnlineLink.Name, model.OnlineLink), DBConnection.getSqlParameter(ClubSchedulesModel.COL_DayOfWeek.Name, model.DayOfWeek), DBConnection.getSqlParameter(ClubSchedulesModel.COL_StartTime.Name, model.StartTime), DBConnection.getSqlParameter(ClubSchedulesModel.COL_EndTime.Name, model.EndTime), DBConnection.getSqlParameter(ClubSchedulesModel.COL_Active.Name, model.Active), DBConnection.getSqlParameter(ClubSchedulesModel.COL_Notes.Name, model.Notes) ); ActivityLogsController.AddEditLog(db, Session, model.Id, log); db.SaveChanges(); }
/* EDIT ***********************************************************************************************************************************************/ public ActionResult Edit(Guid?id, string FILTER_Keyword, string FILTER_Custom) { if (!UserAccountsController.getUserAccess(Session).ClubSchedules_View) { return(RedirectToAction(nameof(HomeController.Index), "Home")); } if (id == null) { return(RedirectToAction(nameof(Index))); } setViewBag(FILTER_Keyword); ClubSchedulesModel model = get((Guid)id); return(View(model)); }
public void add(ClubSchedulesModel model) { LIBWebMVC.WebDBConnection.Insert(db.Database, "ClubSchedules", DBConnection.getSqlParameter(ClubSchedulesModel.COL_Id.Name, model.Id), DBConnection.getSqlParameter(ClubSchedulesModel.COL_Languages_Id.Name, model.Languages_Id), DBConnection.getSqlParameter(ClubSchedulesModel.COL_Description.Name, model.Description), DBConnection.getSqlParameter(ClubSchedulesModel.COL_OnlineLink.Name, model.OnlineLink), DBConnection.getSqlParameter(ClubSchedulesModel.COL_DayOfWeek.Name, model.DayOfWeek), DBConnection.getSqlParameter(ClubSchedulesModel.COL_StartTime.Name, model.StartTime), DBConnection.getSqlParameter(ClubSchedulesModel.COL_EndTime.Name, model.EndTime), DBConnection.getSqlParameter(ClubSchedulesModel.COL_Branches_Id.Name, model.Branches_Id), DBConnection.getSqlParameter(ClubSchedulesModel.COL_Active.Name, model.Active), DBConnection.getSqlParameter(ClubSchedulesModel.COL_Notes.Name, model.Notes) ); ActivityLogsController.AddCreateLog(db, Session, model.Id); db.SaveChanges(); }
public ActionResult Create(ClubSchedulesModel model, string FILTER_Keyword, string FILTER_Custom) { if (ModelState.IsValid) { standardizeTimeToIgnoreDate(model); model.Branches_Id = Helper.getActiveBranchId(Session); if (isExists(null, model.Description, model.DayOfWeek, model.StartTime, model.EndTime)) { ModelState.AddModelError(ClubSchedulesModel.COL_DayOfWeek.Name, "Kombinasi sudah terdaftar"); } else { add(model); return(RedirectToAction(nameof(Index), new { id = model.Id, FILTER_Keyword = FILTER_Keyword, FILTER_Custom = FILTER_Custom })); } } setViewBag(FILTER_Keyword); return(View(model)); }
/* CREATE *********************************************************************************************************************************************/ public ActionResult Create(string FILTER_Keyword, string FILTER_Custom, DayOfWeekEnum?DayOfWeek, string StartTime, Guid?Id) { if (!UserAccountsController.getUserAccess(Session).ClubSchedules_View) { return(RedirectToAction(nameof(HomeController.Index), "Home")); } setViewBag(FILTER_Keyword); ClubSchedulesModel model = new ClubSchedulesModel(); if (DayOfWeek != null) { model.DayOfWeek = (DayOfWeekEnum)DayOfWeek; } if (!string.IsNullOrEmpty(StartTime)) { model.StartTime = Util.standardizeTimeToIgnoreDate(StartTime); model.EndTime = model.StartTime.AddHours(1); } return(View(model)); }
public static void standardizeTimeToIgnoreDate(ClubSchedulesModel model) { model.StartTime = Util.standardizeTimeToIgnoreDate(model.StartTime); model.EndTime = Util.standardizeTimeToIgnoreDate(model.EndTime); }