public virtual void ClearAppointmentLog() { foreach (FSAppointmentLog fsAppointmentLogRow in LogRecords.Select().RowCast <FSAppointmentLog>().Where(_ => _.Type != ID.Type_Log.TRAVEL)) { LogRecords.Delete(fsAppointmentLogRow); } }
public virtual string GetItemStatusFromLog(FSAppointmentDet appointmentDet) { if (appointmentDet != null && (appointmentDet.LineType == ID.LineType_ALL.SERVICE || appointmentDet.LineType == ID.LineType_ALL.NONSTOCKITEM)) { IEnumerable <FSAppointmentLog> itemLogRecords = LogRecords.Select().RowCast <FSAppointmentLog>().Where(_ => _.DetLineRef == appointmentDet.LineRef); bool anyInProcess = itemLogRecords.Where(_ => _.Status == ID.Status_Log.IN_PROCESS).Any(); if (anyInProcess == false) { if (itemLogRecords.Count() > 0) { if (appointmentDet.Status == ID.Status_AppointmentDet.COMPLETED || appointmentDet.Status == ID.Status_AppointmentDet.NOT_FINISHED) { return(appointmentDet.Status); } else { return(ID.Status_AppointmentDet.COMPLETED); } } } else { return(ID.Status_AppointmentDet.IN_PROCESS); } } return(ID.Status_AppointmentDet.NOT_STARTED); }
public virtual int CompleteMultipleLogs(DateTime?dateTimeEnd, string newApptDetStatus, bool completeRelatedItemLines, IEnumerable <ILogDetail> completeLogItems, PXSelectBase <FSAppointmentLog> logSelect, params object[] logSelectArgs) { if (dateTimeEnd == null) { dateTimeEnd = PXTimeZoneInfo.Now; } int rowsAffected = 0; List <FSAppointmentDet> apptDetRows = null; if (completeRelatedItemLines == true) { apptDetRows = AppointmentDetails.Select().RowCast <FSAppointmentDet>().ToList(); } if (completeLogItems != null) { var logRows = LogRecords.Select(); foreach (ILogDetail row in completeLogItems) { FSAppointmentLog logRow = logRows.RowCast <FSAppointmentLog>().Where(_ => _.LineRef == row.LineRef).FirstOrDefault(); ProcessCompleteLog(dateTimeEnd.Value, newApptDetStatus, logRow, apptDetRows); rowsAffected++; } } if (logSelect != null) { foreach (FSAppointmentLog logRow in logSelect.Select(logSelectArgs)) { ProcessCompleteLog(dateTimeEnd.Value, newApptDetStatus, logRow, apptDetRows); rowsAffected++; } } return(rowsAffected); }