本文整理汇总了C#中IProjectService.GetProject方法的典型用法代码示例。如果您正苦于以下问题:C# IProjectService.GetProject方法的具体用法?C# IProjectService.GetProject怎么用?C# IProjectService.GetProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IProjectService
的用法示例。
在下文中一共展示了IProjectService.GetProject方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetProjectInfo
public void SetProjectInfo(IProjectService projectService, int projectId, int projectStepId, string userId)
{
Check.Require(projectService != null, "projectService is required.");
Check.Require(!string.IsNullOrWhiteSpace(userId), "userId is required.");
this.Project = projectService.GetProject(projectId, userId);
this.ProjectStep = projectService.GetProjectStep(projectStepId, userId);
Check.Ensure(this.Project != null, "this.Project is required.");
Check.Ensure(this.ProjectStep != null, "this.ProjectStep is required.");
Check.Ensure(this.Project.Id == this.ProjectStep.Project.Id, Messages.ProjectStepMismatch);
}
示例2: Create
public static PRAUCEditViewModel Create(SquareContext db, IProjectService projectService, int projectStepId, int projectId, string userId, Risk risk = null)
{
var viewModel = new PRAUCEditViewModel()
{
ProjectStep = projectService.GetProjectStep(projectStepId, userId),
Project = projectService.GetProject(projectId, userId),
RiskLevels = db.RiskLevels.OrderBy(a=>a.Order).ToList(),
Risk = risk ?? new Risk()
};
Check.Ensure(viewModel.Risk.Project.Id == viewModel.Project.Id, "Risk does not belong to the intended project.");
return viewModel;
}
示例3: Create
public static ProjectDetailsViewModel Create(SquareContext db, IProjectService projectService, int id, string loginId)
{
Check.Require(db != null, "SquareContext is required.");
Check.Require(projectService != null, "Project service is required.");
Check.Require(!string.IsNullOrEmpty(loginId), "login id is required.");
var viewModel = new ProjectDetailsViewModel()
{
Project = projectService.GetProject(id, loginId),
SquareTypes = db.SquareTypes.ToList()
//ProjectSteps = SquareContext.ProjectSteps.Where(a=>a.Project.id == id).ToList()
};
return viewModel;
}
示例4: Create
public static RiskAssessmentViewModel Create(SquareContext db, IProjectService projectService, int projectStepId, int projectId, string userId)
{
Check.Require(db != null, "db is required.");
var projectStep = projectService.GetProjectStep(projectStepId, userId);
var viewModel = new RiskAssessmentViewModel()
{
ProjectStep = projectStep,
Project = projectService.GetProject(projectId, userId),
Risks = db.Risks.Include("Likelihood").Include("Impact").Include("Magnitude").Include("RiskLevel").Include("RiskRecommendations").Include("Damage")
.Where(a => a.Project.Id == projectStep.Project.Id
&& a.SquareType.Id == projectStep.Step.SquareType.Id)
.OrderByDescending(a=>a.RiskLevel.Order).ToList()
};
return viewModel;
}
示例5: Create
public static NIST800_30EditViewModel Create(SquareContext db, IProjectService projectService, int projectStepId, int projectId, string userId, Risk risk = null)
{
Check.Require(db != null, "db is required.");
var viewModel = new NIST800_30EditViewModel()
{
ProjectStep = projectService.GetProjectStep(projectStepId, userId),
Project = projectService.GetProject(projectId, userId),
RiskLevels = db.RiskLevels.OrderBy(a=>a.Order).ToList(),
Impacts = db.Impacts.ToList(),
Risk = risk ?? new Risk(),
RiskLevelColor = string.Empty
};
// figure out the risk level color, if not null
if (risk != null)
{
viewModel.RiskLevelColor = risk.RiskLevel != null ? risk.RiskLevel.Color : string.Empty;
}
Check.Ensure(viewModel.Risk.Project.Id == viewModel.Project.Id, "Risk does not belong to the intended project.");
return viewModel;
}
示例6: IndexModule
public IndexModule(IUserRepository userRepository, IProjectService projectService)
{
Get["/"] = parameters =>
{
return View["tsmain"];
};
Get["login"] = parameters =>
{
return View["login"];
};
Get["js"] = parameters =>
{
return View["main"];
};
Get["treetest"] = parameters =>
{
return View["treetest"];
};
Get["test"] = parameters =>
{
return View["test"];
};
Get["views/{name}"] = parameters =>
{
return View[parameters.name];
};
Get["project/{projid}"] = parameters =>
{
var p = projectService.GetProject(Bootstrapper.ProjectIdUsedDuringDevelopment);
var pc = new ProjectAndChart {project = p};
pc.chartCommands = new List<Tuple<string, List<ChartGraphicsCommand>>>();
foreach(var p2 in p.P2Pipes)
pc.chartCommands.Add(new Tuple<string, List<ChartGraphicsCommand>>(p2.Id.ToString(), Chart.CreateChart(p2.Root).Paint()));
return pc.ToJson();
};
Get["radiators"] = parameters =>
{
var j = System.IO.File.ReadAllText(@"c:\temp\radiators.json").FromJson<Radiator[]>().ToList();
//j.RemoveAll(_ => _.Name != "TPR33-518");
return j.ToJson();
};
Get["radiatortypes"] = parameters =>
{
return System.IO.File.ReadAllText(@"c:\temp\radiatortyp.json");
};
Get["luftdon"] = parameters =>
{
return System.IO.File.ReadAllText(@"c:\temp\luftdon.json");
};
Get["treedata"] = parameters =>
{
var user = Samples.SampleUser(Samples.SampleProject());
var sb = new StringBuilder();
userRepository.GetUser(Bootstrapper.UserIdUsedDuringDevelopment).Folders.ToWidgetTreeString(sb);
return sb.ToString();
};
Post["project/updatenode/{projid}"] = parameters =>
{
var data = this.Bind<NodePipe2Radiator>();
var p = projectService.GetProject(Bootstrapper.ProjectIdUsedDuringDevelopment);
var subProjectAndNode = p.Find(data.Id);
subProjectAndNode.Node.Update(data);
var subProject = (Part2Pipe) subProjectAndNode.SubProject;
return new
{
chart = Chart.CreateChart(subProject.Root).Paint()
}.ToJson();
};
Patch["nodedirection/{projid}/{nodeid}/{dir}/{bend}"] = parameters =>
{
var p = projectService.GetProject(Bootstrapper.ProjectIdUsedDuringDevelopment);
var subProjectAndNode = p.Find((Guid) parameters.nodeid);
subProjectAndNode.Node.Direction = (Dir)(int)parameters.dir;
subProjectAndNode.Node.BendTo = (Dir)(int)parameters.bend;
var p2 = (Part2Pipe) subProjectAndNode.SubProject;
dynamic tmp = new
{
subProjectId = subProjectAndNode.SubProject.Id,
node = subProjectAndNode.Node,
chart = Chart.CreateChart(p2.Root).Paint()
};
return ExtensionMethods.ToJson(tmp);
};
}