public int UpdateJobLatLong(List <JOBDC> objMANAGE_JOBs, bool OnlyUpdateLatLong = false) { int updatedCount = 0; DBConnection objConnection = new DBConnection(); JOBDA objMANAGE_JOBDA = new JOBDA(); try { objConnection.Open(true); foreach (JOBDC obj in objMANAGE_JOBs) { updatedCount = objMANAGE_JOBDA.Update(objConnection, obj, OnlyUpdateLatLong); } objConnection.Commit(); } catch (Exception exp) { objConnection.Rollback(); throw exp; } finally { objConnection.Close(); } return(updatedCount); }
public int Update(List <JOBDC> objMANAGE_JOBs, ref List <EXCEPTIONDC> lstExceptions, bool OnlyUpdateLatLong = false) { int updatedCount = 0; DBConnection objConnection = new DBConnection(); JOBDA objMANAGE_JOBDA = new JOBDA(); try { foreach (JOBDC obj in objMANAGE_JOBs) { objConnection.Open(true); try { updatedCount = objMANAGE_JOBDA.Update(objConnection, obj, OnlyUpdateLatLong); if (obj.IsDirty) { break; } objConnection.Commit(); } catch (Exception exp) { EXCEPTIONDC objExcption = new EXCEPTIONDC(); objExcption.FIELD_ID = obj.JOB_ID; objExcption.EXCEPTION_MESSAGE = exp.Message; objExcption.STACK_TRACK = exp.StackTrace; lstExceptions.Add(objExcption); objConnection.Rollback(); } } if (lstExceptions.Count > 0) { throw new Exception(lstExceptions[0].EXCEPTION_MESSAGE); } } catch (Exception exp) { throw exp; } finally { objConnection.Close(); } return(updatedCount); }