public Task <bool> TaskAllocation(tbAllocation taskAllocation) { return(Task.Run(() => { try { if (tbAllocations.Where(rec => rec.ContractAddress == taskAllocation.ContractAddress).Select(s => s).SingleOrDefault() == null) { TaskAllocationInsert(taskAllocation); } else { TaskAllocationUpdate(taskAllocation); } SubmitChanges(); return true; } catch (Exception err) { string logCode = string.Empty; proc_EventLog(err.Message, (short)EventType.Error, ref logCode); return false; } })); }
private void TaskAllocationUpdate(tbAllocation newAllocation) { tbAllocation existingAllocation = tbAllocations.Where(m => m.ContractAddress == newAllocation.ContractAddress).Single(); existingAllocation.TaskStatusCode = newAllocation.TaskStatusCode; existingAllocation.UnitCharge = newAllocation.UnitCharge; existingAllocation.TaxRate = newAllocation.TaxRate; existingAllocation.ActionOn = newAllocation.ActionOn; existingAllocation.QuantityOrdered = newAllocation.QuantityOrdered; }
private void TaskAllocationInsert(tbAllocation taskAllocation) { tbAllocations.InsertOnSubmit(taskAllocation); }