public string InsertOrUpdate(TaskProcessDTO taskProcess) { try { var validate = Validate(taskProcess); if (!string.IsNullOrEmpty(validate)) { return(validate); } if (ObjectExists(taskProcess)) { return(GenericMessages.DatabaseErrorRecordAlreadyExists + Environment.NewLine + "With the same Number"); } _taskProcessRepository.InsertUpdate(taskProcess); _unitOfWork.Commit(); return(string.Empty); } catch (Exception exception) { return(exception.Message); } }
public string Validate(TaskProcessDTO taskProcess) { if (null == taskProcess) { return(GenericMessages.ObjectIsNull); } return(string.Empty); }
private void AddNewProcess() { if (Categories != null) { SelectedCategory = Categories.FirstOrDefault(); } SelectedProcess = new TaskProcessDTO { CompanyAddress = new AddressDTO { Country = "Ethiopia", City = "Addis Abeba" } }; }
public string Disable(TaskProcessDTO taskProcess) { if (taskProcess == null) { return(GenericMessages.ObjectIsNull); } string stat; try { _taskProcessRepository.Update(taskProcess); _unitOfWork.Commit(); stat = string.Empty; } catch (Exception exception) { stat = exception.Message; } return(stat); }
public bool ObjectExists(TaskProcessDTO taskProcess) { //var objectExists = false; //var iDbContext = DbContextUtil.GetDbContextInstance(); //try //{ // var catRepository = new Repository<TaskProcessDTO>(iDbContext); // var catExists = catRepository.Query() // .Filter(bp => bp.Description == taskProcess.Description && bp.Id != taskProcess.Id) // .Get() // .FirstOrDefault(); // if (catExists != null) // objectExists = true; //} //finally //{ // iDbContext.Dispose(); //} //return objectExists; return(false); }