public override Common.OperationResult Delete(Common.DataContract.WorkgroupDataContract dataContract) { if (dataContract == null) { throw new ArgumentException("Cannot be Null", "dataContract"); } try { SGW_Workgroup wg = Core.MainDataContextInstance().SGW_Workgroups.Where(w => w.WorkgroupId.Equals(dataContract.Id)).FirstOrDefault(); if (wg == null) { return(new Common.OperationResult(Common.OperationResultStatus.ValidationFailure, "Grupo não encontrado.")); } Core.MainDataContextInstance().SGW_Workgroups.DeleteOnSubmit(wg); Core.MainDataContextInstance().SubmitChanges(); return(new Common.OperationResult()); } catch (Exception ex) { throw ex; } }
public Common.OperationResult Add(Common.DataContract.WorkgroupDataContract dataContract) { var handler = DataAccess.Core.GetFactory().GetInstance <IWorkgroupHandler>(); dataContract.CreatedBy = Common.SessionData.ResourceId; dataContract.CreatedOn = DateTime.Now; return(handler.Add(dataContract)); }
public override SGW_Workgroup GetLinqObj(Common.DataContract.WorkgroupDataContract dataContract, SGW_Workgroup linq) { if (dataContract == null) { return(null); } linq.Name = dataContract.Description; linq.WorkgroupId = dataContract.Id; linq.CreatedOn = dataContract.CreatedOn; linq.CreatedBy = dataContract.CreatedBy; linq.UpdatedOn = dataContract.UpdatedOn; linq.UpdatedBy = dataContract.UpdatedBy; linq.ParentWorkgroupId = dataContract.ParentWorkgroupId; linq.WorkgroupPath = dataContract.Path; return(linq); }
public override Common.DataContract.WorkgroupDataContract GetDataContract(SGW_Workgroup linqObj) { if (linqObj == null) { return(null); } Common.DataContract.WorkgroupDataContract dataContract = new Common.DataContract.WorkgroupDataContract(); dataContract.Id = linqObj.WorkgroupId; dataContract.Description = linqObj.Name; dataContract.CreatedBy = linqObj.CreatedBy; dataContract.CreatedOn = linqObj.CreatedOn; dataContract.UpdatedBy = linqObj.UpdatedBy; dataContract.UpdatedOn = linqObj.UpdatedOn; dataContract.ParentWorkgroupId = linqObj.ParentWorkgroupId; dataContract.Path = linqObj.WorkgroupPath; return(dataContract); }
public override Common.OperationResult Add(Common.DataContract.WorkgroupDataContract dataContract) { if (dataContract == null) { throw new ArgumentException("Cannot be Null", "dataContract"); } try { var wg = GetLinqObj(dataContract); wg.WorkgroupPath = GetWorkgroupPath(dataContract); Core.MainDataContextInstance().SGW_Workgroups.InsertOnSubmit(wg); Core.MainDataContextInstance().SubmitChanges(); return(new Common.OperationResult()); } catch (Exception ex) { throw ex; } }
public override SGW_Workgroup GetLinqObj(Common.DataContract.WorkgroupDataContract dataContract) { return(GetLinqObj(dataContract, new SGW_Workgroup())); }
public Common.OperationResult Delete(Common.DataContract.WorkgroupDataContract dataContract) { var handler = DataAccess.Core.GetFactory().GetInstance <IWorkgroupHandler>(); return(handler.Delete(dataContract)); }