// // GET: /StakeHolder/Edit/5 public ActionResult Edit(int id) { StakeHolder stakeholder = db.StakeHolders.Find(id); ViewBag.AreaId = new SelectList(db.Areas, "Id", "AreaName", stakeholder.AreaId); return(View(stakeholder)); }
public void StakeHolderAdapterLoadTest() { StakeHolderAdapter sha = new StakeHolderAdapter(); StakeHolder sh = sha.Load("DD03D6D7-817E-4AEA-9B28-E0A732E98ADC", 2); Console.WriteLine(sh == null); }
public ActionResult DeleteConfirmed(int id) { StakeHolder stakeholder = db.StakeHolders.Find(id); db.StakeHolders.Remove(stakeholder); db.SaveChanges(); return(RedirectToAction("Index")); }
//public StakeHolderBLL(IStakeHolderRepository stakeHolderRepository) //{ // _stakeHolderRepository = stakeHolderRepository; //} public void CreateStakeHolder(StakeHolderRegistrationViewModel registrationViewModel) { var stakeHolder = new StakeHolder(); stakeHolder.ClientId = registrationViewModel.StakeholderClientId; var createdStakeHolder = _stakeHolderRepository.Create(stakeHolder); _userRepository.CreateUser(registrationViewModel.StakeHolderUserName, registrationViewModel.StakeHolderPassword, UserType.StakeHolder, createdStakeHolder.StakeHolderId); }
public void StakeHolderAdapterUpdateTest() { StakeHolderAdapter sha = new StakeHolderAdapter(); StakeHolder sh = sha.Load("BCCC9DD1-5497-47D0-B137-303EC3CA1562"); sh.CreatorName = sh.CreatorName + "UDP"; sh.CreateTime = sh.CreateTime.AddYears(100); sh.UserID = 2; sha.Update(sh); }
public void Delete(int stakeHolderId) { var stakeHolder = new StakeHolder { StakeHolderId = stakeHolderId }; var dataContext = _dataContext as DataContext; dataContext.Entry(stakeHolder).State = EntityState.Deleted; _dataContext.Save(); }
public ActionResult Edit(StakeHolder stakeholder) { if (ModelState.IsValid) { db.Entry(stakeholder).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AreaId = new SelectList(db.Areas, "Id", "AreaName", stakeholder.AreaId); return(View(stakeholder)); }
public ActionResult Create(StakeHolder stakeholder) { if (ModelState.IsValid) { db.StakeHolders.Add(stakeholder); db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.AreaId = new SelectList(db.Areas, "Id", "AreaName", stakeholder.AreaId); return(View(stakeholder)); }
// POST api/values public void Post( [FromBody]StakeHolderData stdata) { StakeHolder st = new StakeHolder(); st.Name = stdata.Name; st.Username = stdata.Username; st.Email = stdata.Email; st.Password = stdata.Password; st.Type = stdata.Type; st.Mobile = Convert.ToInt64(stdata.Mobile); logic.InsertStakeHolder( st ); }
/// <summary> /// 构建流程干系人 /// </summary> /// <param name="nodeInstance"></param> /// <returns></returns> public static StakeHolder BuildStakeHolder(ProcessNodeInstance nodeInstance) { StakeHolder holder = new StakeHolder(); holder.NodeType = nodeInstance.NodeType; holder.BizProcessID = nodeInstance.BizProcessID; holder.CreatedTime = WebHelper.DateTimeNow; holder.ProcessID = nodeInstance.ProcessID; holder.ProcessInstanceID = nodeInstance.ProcessInstanceID; holder.cUserID = nodeInstance.cUserID == 0 ? 0 : nodeInstance.cUserID; holder.UserCode = string.IsNullOrEmpty(nodeInstance.UserCode) ? "" : nodeInstance.UserCode; holder.UserID = nodeInstance.UserID; holder.UserName = nodeInstance.UserName; //add czq holder.CreateTime = WebHelper.DateTimeNow; holder.CreatorName = WebHelper.GetCurrentUser().LoginName; holder.IsDeleted = false; holder.ModifyTime = WebHelper.DateTimeNow; holder.ModifierName = WebHelper.GetCurrentUser().LoginName; return(holder); }
public void StakeHolderAdapterInsertTest() { StakeHolderAdapter sha = new StakeHolderAdapter(); StakeHolder sh = new StakeHolder() { BizProcessID = "Unit_test", //??? CreatedTime = DateTime.Now, CreateTime = DateTime.Now, CreatorName = "unit_test", cUserID = "unit_test", ID = Guid.NewGuid().ToString(), IsDeleted = false, NodeType = 0, ProcessID = "347D876A-1845-4F14-9532-6E454065F8D8", ProcessInstanceID = "59588CFB-CAC0-4E2E-8973-844C505700D5", UserCode = "unit_test", UserID = 0, UserName = "******" }; sha.Insert(sh); }
//public StakeHolderRepository(IReqDataSource dataContext) //{ // _dataContext = dataContext; //} public StakeHolder Create(StakeHolder stakeHolder) { ((DbSet <StakeHolder>)(_dataContext.StakeHolders)).Add(stakeHolder); _dataContext.Save(); return(stakeHolder); }
/// <summary> /// 更新节点使用 /// </summary> /// <param name="bizID">BizProcessID</param> /// <param name="nodeID">NodeInstanceID</param> /// <param name="uid">UserID</param> /// <param name="userName">UserName</param> /// <returns></returns> public int UpdateNodeInstance(int bizID, int nodeID, int uid, string userName) { WorkflowInstance instance = WorkflowEngine.WorkflowService.GetWorkflowInstance(bizID); List <ProcessNodeInstance> nodeInstanceList = ProcessNodeInstanceAdapter.Instance.LoadList(instance.ProcessInstance.ID); ProcessNodeInstance nodeInstance = nodeInstanceList.Find(p => p.ID == nodeID); TodoWork todo = null; int result = 0; foreach (var item in instance.TodoWorks) { if (item.TodoType == (int)Wanda.Lib.LightWorkflow.CommonConsts.TodoType.TODO) { todo = item; using (TransactionScope trans = TransactionScopeFactory.Create()) { //待办的处理方式: //删除待办 WorkflowEngine.WorkflowService.CloseWorkflowTodo(todo); //生成已办日志 ApprovalLog log = new ApprovalLog(); log.NodeType = todo.NodeType; log.ApprovalNote = string.Format("{0}将节点更新至{1}", userName, nodeInstance.UserName); log.BizProcessID = todo.BizProcessID; log.CompletedTime = WebHelper.DateTimeNow; log.CreatedTime = todo.CreatedTime; log.InstanceName = todo.InstanceName; log.NodeInstanceID = todo.NodeInstanceID;//TODO:huwz log.NodeName = todo.NodeName; log.OperationType = (int)Wanda.Lib.LightWorkflow.CommonConsts.NodeOperationType.ChangeNode; log.ProcessID = todo.ProcessID; log.ProcessInstanceID = todo.ProcessInstanceID; log.PreviousNodeInstanceID = todo.PreviousNodeInstanceID; log.Status = 0;//保留字段 //log.cUserID = todo.cUserID; //log.UserCode = todo.UserCode; log.CreateTime = WebHelper.DateTimeNow; log.CreatorName = userName; log.UserID = todo.UserID; log.UserName = todo.UserName; log.ID = 0; log.ModifyTime = WebHelper.DateTimeNow; log.ModifierName = userName; ApprovalLogAdapter.Instance.Insert(log); //计算下个节点,生成待办 TodoWork todoNew = WorkflowEngine.BuildTodo(Wanda.Lib.LightWorkflow.CommonConsts.TodoType.TODO, instance.ProcessInstance, nodeInstance); WorkflowEngine.WorkflowService.CreateWorkflowTodo(todoNew); //更新流程节点 int curSqu = -1; foreach (var temp in nodeInstanceList) { if (temp.NodeSeq > nodeInstance.NodeSeq) { temp.Status = (int)Wanda.Lib.LightWorkflow.CommonConsts.NodeStatus.NotExecute; ProcessNodeInstanceAdapter.Instance.Update(temp); continue; } if (temp.NodeSeq < nodeInstance.NodeSeq) { temp.Status = (int)Wanda.Lib.LightWorkflow.CommonConsts.NodeStatus.Executed; if (temp.ID == todo.NodeInstanceID) { curSqu = temp.NodeSeq; } if (curSqu != -1 && temp.NodeSeq >= curSqu) { temp.OperationType = (int)Wanda.Lib.LightWorkflow.CommonConsts.NodeOperationType.ChangeNode; ProcessNodeInstanceAdapter.Instance.Update(temp); } } else { temp.Status = (int)Wanda.Lib.LightWorkflow.CommonConsts.NodeStatus.Executing; temp.OperationType = (int)Wanda.Lib.LightWorkflow.CommonConsts.NodeOperationType.ChangeNode; ProcessNodeInstanceAdapter.Instance.Update(temp); } } if (nodeInstance.NodeType == (int)CommonConsts.NodeType.Archive) { ProcessInstance p = instance.ProcessInstance; p.Status = (int)CommonConsts.ProcessInstanceStatus.Archiving; ProcessInstanceAdapter.Instance.Update(p); } //添加StakeHolder人员 StakeHolder holder = WorkflowEngine.BuildStakeHolder(nodeInstance); StakeHolderAdapter.Instance.Insert(holder); result = nodeID; trans.Complete(); } break; } } return(result); }
public void InsertStakeHolder(StakeHolder st) { db.StakeHolders.Add(st); db.SaveChanges(); SMSSender.sendMessage(st.Mobile); }
public void UpdateStakeHolder(StakeHolder stakeHolder) { _stakeHolderRepository.Update(stakeHolder); }
// // GET: /StakeHolder/Details/5 public ViewResult Details(int id) { StakeHolder stakeholder = db.StakeHolders.Find(id); return(View(stakeholder)); }
// // GET: /StakeHolder/Delete/5 public ActionResult Delete(int id) { StakeHolder stakeholder = db.StakeHolders.Find(id); return(View(stakeholder)); }