/// <summary>
 /// 添加新的工程项目,初始化流程状态
 /// </summary>
 /// <param name="newprj"></param>
 /// <param name="createdby"></param>
 public void AddProject(CustomerProject newprj, int createdby)
 {
     //获取开始节点
     var prjtype = _rep.Single<ProjectType>(x => x.Id == newprj.ProjectTypeId);
     var startnode = prjtype.WorkFlow.TaskNodes.SingleOrDefault(x => x.BuildIn == "1");
     newprj.FlowLogs.Add(new FlowLog
     {
         StartDate = DateTime.Now,
         TaskId = startnode.TaskId,
         IsActive = true,
         TodoBy = createdby,
         CustomerProject = newprj
     });
     _rep.Add(newprj);
     _rep.Save();
 }
 public virtual ActionResult Create(CustProjectModel toadd)
 {
     if (ModelState.IsValid)
     {
         var newprj = new CustomerProject {ProjectTypeId = 9, IsFinished = false, DisContinued = false};
         TryUpdateModel(newprj);
         var service = new CustProjectService(Repository);
         service.AddProject(newprj, CurrentUser.UserId);
         return RedirectToAction(MVC.CustomerProject.TodoList());
     }
     return View(toadd);
 }
        private void FixupCustomerProject(CustomerProject previousValue)
        {
            if (previousValue != null && ReferenceEquals(previousValue.CustomerConstruct, this))
            {
                previousValue.CustomerConstruct = null;
            }

            if (CustomerProject != null)
            {
                CustomerProject.CustomerConstruct = this;
                if (CustomerProjectID != CustomerProject.ID)
                {
                    CustomerProjectID = CustomerProject.ID;
                }
            }
        }
        private void FixupCustomerProject(CustomerProject previousValue)
        {
            if (previousValue != null && previousValue.CustomerEquips.Contains(this))
            {
                previousValue.CustomerEquips.Remove(this);
            }

            if (CustomerProject != null)
            {
                if (!CustomerProject.CustomerEquips.Contains(this))
                {
                    CustomerProject.CustomerEquips.Add(this);
                }
                if (CustomerProjectID != CustomerProject.ID)
                {
                    CustomerProjectID = CustomerProject.ID;
                }
            }
        }
Exemplo n.º 5
0
        private void FixupCustomerProject(CustomerProject previousValue)
        {
            if (previousValue != null && previousValue.FlowLogs.Contains(this))
            {
                previousValue.FlowLogs.Remove(this);
            }

            if (CustomerProject != null)
            {
                if (!CustomerProject.FlowLogs.Contains(this))
                {
                    CustomerProject.FlowLogs.Add(this);
                }
                if (CustProjectId != CustomerProject.ID)
                {
                    CustProjectId = CustomerProject.ID;
                }
            }
            else if (!_settingFK)
            {
                CustProjectId = null;
            }
        }