protected virtual void UpdateScheduleRunInfo(ScheduledItem scheduledItem, Activity activity) { if (scheduledItem != null) { int count = 3; do { try { if (scheduledItem.FrequencyType == ScheduledFrequencyType.OnceThenDelete) { ScheduleManager.Delete(scheduledItem.Id); } else { scheduledItem.LastExecutedOn = DateTime.Now; scheduledItem.LastExecuteActivityId = activity.Id; scheduledItem.NextRunOn = ScheduledItem.CalcNextRunTime(scheduledItem.NextRunOn, scheduledItem.FrequencyType, scheduledItem.Frequency, true, scheduledItem.StartOn, scheduledItem.EndOn, scheduledItem.IsActive); scheduledItem = ScheduleManager.Update(scheduledItem, false); } count = 0; } catch (Exception e) { LOG.Error("Error in UpdateScheduleRunInfo().", e); } }while (--count > 0); } }
//NOTE: Use Save() when calling directly, it will generate correct salt. //NOTE: Add and Update should be used only by Replication on the remote side, so that they don't regenerate salt again !!! public static void Update(string pSalt, PartnerDto pPartner) { using (Rbr_Db _db = new Rbr_Db()) { using (Transaction _tx = new Transaction(_db, pSalt, pPartner)) { PartnerDto _originalPartner = PartnerManager.Get(_db, pPartner.PartnerId); ContactInfoManager.Update(_db, pPartner.ContactInfo); //TODO: NEW DAL - handle Person deletion... if (pPartner.Employees != null) { foreach (PersonDto _employee in pPartner.Employees) { _employee.PartnerId = pPartner.PartnerId; PersonManager.Save(_db, pSalt, _employee); } } if (pPartner.BillingSchedule != null) { ScheduleManager.Save(_db, pPartner.BillingSchedule); } else if (_originalPartner.BillingSchedule != null) { ScheduleManager.Delete(_db, _originalPartner.BillingSchedule.ScheduleId); } PartnerManager.Update(_db, pPartner); _tx.Commit(); } } }
private void scheduleDelete_Click(object sender, EventArgs e) { var selectedRow = dgw.CurrentRow; if (selectedRow != null) { var deletedSchedule = new Schedule { Id = (int)selectedRow.Cells[0].Value }; scheduleManager.Delete(deletedSchedule); SetDGW(); } else { MessageBox.Show("Satır seçmeniz gerek"); } }
public IHttpActionResult Delete(Schedule schedule) { try { var Mngr = new ScheduleManager(); Mngr.Delete(schedule); ApiResponse ApiResp = new ApiResponse { Message = "Horario eliminado exitosamente" }; return(Ok(ApiResp)); } catch (BusinessException bex) { return(InternalServerError(new Exception(bex.ExceptionId + "-" + bex.AppMessage.Message))); } }