private void InsertRecord(Message message, MainDbContext context) { var newUser = new AdminRights() { IdUser = message.From.Id }; context.AllAdmins.Add(newUser); context.SaveChanges(); }
public UserInfo(string user, string pass, string first, string last, string email, int age, bool male, AdminRights rights) { UserName = user; Password = pass; First = first; Last = last; EMail = email; Age = age; IsMale = male; Rights = rights; }
public string ExecuteWF(User user, bool reject = false) { string retMsg = "SuccessWF"; if (user == null || user.WorkflowInstId == Guid.Empty) { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("model", user); instance = new WorkflowApplication(new AdminRights(), dic); this.InitWorkflowApplication(); instance.Run(); } else { AdminRights rights = new AdminRights(); instance = new WorkflowApplication(rights); this.InitWorkflowApplication(); instance.Load(user.WorkflowInstId); string approver = "SuperAdmin"; if (reject) { //更新状态 WFinstanceDAL wfDal = new WFinstanceDAL(); wfDal.Add(user.WorkflowInstId.ToString(), approver, "驳回"); WFCurrentNodeInfoDAL infoDal = new WFCurrentNodeInfoDAL(); infoDal.UpdateExitTime(user.WorkflowInstId.ToString(), DateTime.Now); instance.Cancel(); retMsg = "驳回成功"; } if (instance.GetBookmarks().Count > 0) { Dictionary <string, object> dic = new Dictionary <string, object>(); dic.Add("model", user); dic.Add("curApproveUser", approver); instance.ResumeBookmark("BookmarkTest", dic); } } user.WorkflowInstId = instance.Id; //等待工作线程结束 idleEvent.WaitOne(); instance.Unload(); return(retMsg); }
public Admin(long memberId, AdminRights rights) { MemberId = memberId; Rights = rights; }