/// <summary> /// add new release and relationships to release tab /// Note: in relationships who's added: releaseid is 0, after add release in database remember update releaseid /// </summary> /// <param name="releaseId"></param> /// <returns></returns> public Release GetNewReleseAndRelationships() { Release Release = new Release { }; using (IReleaseMilestoneRepository db = new ReleaseMilestoneRepository()) { Release.ReleaseMilestones = db.AddReleaseMilestone(); } using (IReleaseFamilyProductRepository db = new ReleaseFamilyProductRepository()) { Release.ReleaseFamilyProducts = db.AddFamilyProduct(); } using (IReleaseProductRepository db = new ReleaseProductRepository()) { Release.ReleaseProducts = db.AddProduct(); } using (IReleaseStakeholderRepository db = new ReleaseStakeholderRepository()) { Release.ReleaseStakeholders = db.AddStakeHolder(); } using (IReleaseAreaOwnerRepository db = new ReleaseAreaOwnerRepository()) { Release.ReleaseAreaOwners = db.AddAreaOwner(); } using (IReleaseCharacteristicRepository db = new ReleaseCharacteristicRepository()) { Release.ReleaseCharacteristics = db.AddCharacteristic(); } return(Release); }
public string GetParameterTableName(string tableName, int ReleaseParameterID) { if (tableName == "Milestone") { using (IReleaseMilestoneRepository dbr = new ReleaseMilestoneRepository()) { var ReleaseMilestone = dbr.Where(a => a.ReleaseMilestoneID == ReleaseParameterID).Include(a => a.Milestone).FirstOrDefault(); return(ReleaseMilestone != null && ReleaseMilestone.Milestone != null ? ReleaseMilestone.Milestone.Name : ""); } } else if (tableName == "Product") { using (IReleaseProductRepository dbr = new ReleaseProductRepository()) { var ReleaseProduct = dbr.Where(a => a.ReleaseProductID == ReleaseParameterID).Include(a => a.Product).FirstOrDefault(); return(ReleaseProduct != null && ReleaseProduct.Product != null ? ReleaseProduct.Product.Name : ""); } } else if (tableName == "FamilyProduct") { using (IReleaseFamilyProductRepository dbr = new ReleaseFamilyProductRepository()) { var ReleaseFamilyProduct = dbr.Where(a => a.ReleaseFamilyProductID == ReleaseParameterID).Include(a => a.FamilyProduct).FirstOrDefault(); return(ReleaseFamilyProduct != null && ReleaseFamilyProduct.FamilyProduct != null ? ReleaseFamilyProduct.FamilyProduct.Name : ""); } } else if (tableName == "Stakeholder") { using (IReleaseStakeholderRepository dbr = new ReleaseStakeholderRepository()) { var ReleaseStakeholder = dbr.Where(a => a.ReleaseStakeholderID == ReleaseParameterID).Include(a => a.Stakeholder).FirstOrDefault(); return(ReleaseStakeholder != null && ReleaseStakeholder.Stakeholder != null ? ReleaseStakeholder.Stakeholder.Name : ""); } } else if (tableName == "Area") { using (IReleaseAreaOwnerRepository dbr = new ReleaseAreaOwnerRepository()) { var ReleaseAreaOwner = dbr.Where(a => a.ReleaseAreaOwnerID == ReleaseParameterID).Include(a => a.Area).FirstOrDefault(); return(ReleaseAreaOwner != null && ReleaseAreaOwner.Area != null ? ReleaseAreaOwner.Area.Name : ""); } } return(null); }