/// <summary> /// 弹出选择用户登录的弹出框 /// </summary> private void selUser(string wftStepID) { List<DataType.UserOrGroupSelected> oldSelectedUserList = new List<DataType.UserOrGroupSelected>(); // WfAppID //判定当前节点已经设定的签批用户 IList<WF_APP_HANDLE> list = WorkFlow.NewInstance.GetWFAppStepHandle(this.WfAppID, wftStepID); IList<WF_APP_USER> UserList = WorkFlow.NewInstance.GetWFAppStepUser(this.wfAppID,wftStepID); if (list == null) { } else { DataType.UserOrGroupSelected item; foreach (WF_APP_HANDLE han in list) { item = new DataType.UserOrGroupSelected(); item.Value = han.OBJECTVALUE; item.ObjectType = DataType.AuthObjectType.SingleUser; oldSelectedUserList.Add(item); } } stbUser = new StringBuilder(); UserAndUserRoleForm frm = new UserAndUserRoleForm(); //DialogResult dialogResult = frm.ShowDialog(); frm.OldSelectedUserList = oldSelectedUserList; if (frm.ShowDialog() == DialogResult.OK) { //先删除,如果有的话,最终签批用后以本次的为准 // IList<WF_APP_HANDLE> list = WorkFlow.NewInstance.GetWFAppStepHandle(this.WfAppID, wftStepID); foreach (WF_APP_HANDLE l in list) { l.Delete(); } foreach (WF_APP_USER user in UserList) { user.Delete(); } selectedUserOrGroupList = frm.SelectedUserOrGroupList; if (selectedUserOrGroupList == null || selectedUserOrGroupList.Count == 0) { stbUser = new StringBuilder(""); return; } else { stbUser = new StringBuilder("\n"); foreach (DataType.UserOrGroupSelected sel in selectedUserOrGroupList) { //添加 //防呆 判定改用户是否已经存在了,存在了就不需要再一次更新 WF_APP_HANDLE wfah = new HYPDM.Entities.WF_APP_HANDLE(); wfah.WFAH_ID = Guid.NewGuid().ToString(); wfah.LASTUPDATEDATE = ""; wfah.LASTUPDATEUSER = ""; wfah.CREATEDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); wfah.CREATEUSER = CommonFuns.NewInstance.LoginInfo.LoginID; wfah.DEL_FLAG = "N"; wfah.WFA_ID = this.wfAppID; wfah.Current_STEP_ID = WorkFlow.NewInstance.GetWFStepInfoByStepID(wftStepID).WFT_CURRENT_STEP_ID; wfah.OBJECTTYPE = sel.ObjectType.ToString(); wfah.OBJECTVALUE = sel.Value.ToString(); wfah.WFT_STEP_ID = wftStepID; wfah.IS_THROUGH = ""; WF_APP_USER wfuser = new WF_APP_USER(); wfuser.WFAU_ID = Guid.NewGuid().ToString(); wfuser.CREATEDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); wfuser.CREATEUSER = CommonFuns.NewInstance.LoginInfo.LoginID; wfuser.DEL_FLAG = "N"; wfuser.WFA_ID = this.wfAppID; wfuser.Current_STEP_ID = WorkFlow.NewInstance.GetWFStepInfoByStepID(wftStepID).WFT_CURRENT_STEP_ID; wfuser.OBJECTTYPE = sel.ObjectType.ToString(); wfuser.OBJECTVALUE = sel.Value.ToString(); wfuser.WFT_STEP_ID = wftStepID; try { wfah.Save(); wfuser.Save(); if (wfah.OBJECTTYPE == DataType.AuthObjectType.SingleUser.ToString()) { stbUser.Append("用户:【" + wfah.OBJECTVALUE + "】" + "\n"); } else { stbUser.Append("群组:【" + wfah.OBJECTVALUE + "】" + "\n"); } } catch (Exception ex) { MessageBox.Show("处理人设定信息存储异常:" + ex.Message.ToString(), "工作流实例建立向导提示您:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); return; } } // stbUser.Remove(stbUser.Length-1, 1); } } }
/// <summary> /// 弹出选择用户登录的弹出框 /// </summary> private void selUser(string wftStepID) { List <DataType.UserOrGroupSelected> oldSelectedUserList = new List <DataType.UserOrGroupSelected>(); // WfAppID //判定当前节点已经设定的签批用户 IList <WF_APP_HANDLE> list = WorkFlow.NewInstance.GetWFAppStepHandle(this.WfAppID, wftStepID); IList <WF_APP_USER> UserList = WorkFlow.NewInstance.GetWFAppStepUser(this.wfAppID, wftStepID); if (list == null) { } else { DataType.UserOrGroupSelected item; foreach (WF_APP_HANDLE han in list) { item = new DataType.UserOrGroupSelected(); item.Value = han.OBJECTVALUE; item.ObjectType = DataType.AuthObjectType.SingleUser; oldSelectedUserList.Add(item); } } stbUser = new StringBuilder(); UserAndUserRoleForm frm = new UserAndUserRoleForm(); //DialogResult dialogResult = frm.ShowDialog(); frm.OldSelectedUserList = oldSelectedUserList; if (frm.ShowDialog() == DialogResult.OK) { //先删除,如果有的话,最终签批用后以本次的为准 // IList<WF_APP_HANDLE> list = WorkFlow.NewInstance.GetWFAppStepHandle(this.WfAppID, wftStepID); foreach (WF_APP_HANDLE l in list) { l.Delete(); } foreach (WF_APP_USER user in UserList) { user.Delete(); } selectedUserOrGroupList = frm.SelectedUserOrGroupList; if (selectedUserOrGroupList == null || selectedUserOrGroupList.Count == 0) { stbUser = new StringBuilder(""); return; } else { stbUser = new StringBuilder("\n"); foreach (DataType.UserOrGroupSelected sel in selectedUserOrGroupList) { //添加 //防呆 判定改用户是否已经存在了,存在了就不需要再一次更新 WF_APP_HANDLE wfah = new HYPDM.Entities.WF_APP_HANDLE(); wfah.WFAH_ID = Guid.NewGuid().ToString(); wfah.LASTUPDATEDATE = ""; wfah.LASTUPDATEUSER = ""; wfah.CREATEDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); wfah.CREATEUSER = CommonFuns.NewInstance.LoginInfo.LoginID; wfah.DEL_FLAG = "N"; wfah.WFA_ID = this.wfAppID; wfah.Current_STEP_ID = WorkFlow.NewInstance.GetWFStepInfoByStepID(wftStepID).WFT_CURRENT_STEP_ID; wfah.OBJECTTYPE = sel.ObjectType.ToString(); wfah.OBJECTVALUE = sel.Value.ToString(); wfah.WFT_STEP_ID = wftStepID; wfah.IS_THROUGH = ""; WF_APP_USER wfuser = new WF_APP_USER(); wfuser.WFAU_ID = Guid.NewGuid().ToString(); wfuser.CREATEDATE = System.DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); wfuser.CREATEUSER = CommonFuns.NewInstance.LoginInfo.LoginID; wfuser.DEL_FLAG = "N"; wfuser.WFA_ID = this.wfAppID; wfuser.Current_STEP_ID = WorkFlow.NewInstance.GetWFStepInfoByStepID(wftStepID).WFT_CURRENT_STEP_ID; wfuser.OBJECTTYPE = sel.ObjectType.ToString(); wfuser.OBJECTVALUE = sel.Value.ToString(); wfuser.WFT_STEP_ID = wftStepID; try { wfah.Save(); wfuser.Save(); if (wfah.OBJECTTYPE == DataType.AuthObjectType.SingleUser.ToString()) { stbUser.Append("用户:【" + wfah.OBJECTVALUE + "】" + "\n"); } else { stbUser.Append("群组:【" + wfah.OBJECTVALUE + "】" + "\n"); } } catch (Exception ex) { MessageBox.Show("处理人设定信息存储异常:" + ex.Message.ToString(), "工作流实例建立向导提示您:", MessageBoxButtons.OK, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button1); return; } } // stbUser.Remove(stbUser.Length-1, 1); } } }