private void InitParas(string roleID) { ServiceClient = new PermissionServiceClient(); ServiceClient.GetSysDictionaryByCategoryCompleted += new EventHandler <GetSysDictionaryByCategoryCompletedEventArgs>(ServiceClient_GetSysDictionaryByCategoryCompleted); ServiceClient.SysRoleInfoAddCompleted += new EventHandler <SysRoleInfoAddCompletedEventArgs>(SysRoleClient_SysRoleInfoAddCompleted); //ServiceClient.SysRoleInfoUpdateCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(SysRoleClient_SysRoleInfoUpdateCompleted); ServiceClient.SysRoleInfoUpdateCompleted += new EventHandler <SysRoleInfoUpdateCompletedEventArgs>(ServiceClient_SysRoleInfoUpdateCompleted); ServiceClient.GetSysRoleSingleInfoByIdCompleted += new EventHandler <GetSysRoleSingleInfoByIdCompletedEventArgs>(SysRoleClient_GetSysRoleSingleInfoByIdCompleted); if (!string.IsNullOrEmpty(roleID)) { tmpRoleId = roleID; //ServiceClient.GetSysRoleByIDAsync(roleID); } //绑定系统类型 ServiceClient.GetSysDictionaryByCategoryAsync("SYSTEMTYPE"); if (FormType == FormTypes.New) { SysRole = new T_SYS_ROLE(); this.txtCompanyName.Text = string.IsNullOrEmpty(Common.CurrentLoginUserInfo.UserPosts[0].CompanyName) ? "" : Common.CurrentLoginUserInfo.UserPosts[0].CompanyName; //公司名称 StrCompanyID = string.IsNullOrEmpty(Common.CurrentLoginUserInfo.UserPosts[0].CompanyID) ? "" : Common.CurrentLoginUserInfo.UserPosts[0].CompanyID; //公司ID this.txtDepartmentName.Text = string.IsNullOrEmpty(Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName) ? "" : Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName; //部门名称 this.StrDepartmentID = string.IsNullOrEmpty(Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID) ? "" : Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID; //部门ID SysRole.ROLEID = Guid.NewGuid().ToString(); //GetCompanyNameByCompanyID(Common.CurrentLoginUserInfo.UserPosts[0].CompanyID); } }
private void SetUserRoleInfos() { if (tmpRoleList.Count() == 0) { return; } if (DtGrid.ItemsSource != null) { foreach (object obj in DtGrid.ItemsSource) { T_SYS_ROLE menu = new T_SYS_ROLE(); if (DtGrid.Columns[0].GetCellContent(obj) != null) { CheckBox cb1 = DtGrid.Columns[0].GetCellContent(obj).FindName("myChkBtn") as CheckBox; //cb为 menu = cb1.Tag as T_SYS_ROLE; var bb = from a in tmpRoleList where a.T_SYS_ROLE.ROLEID == menu.ROLEID select a; if (bb.Count() > 0) { cb1.IsChecked = true; }//bb.cout } } } }
/// <summary> /// 员工入职的话自动添加一个默认的角色信息 /// </summary> /// <param name="user"></param> /// <param name="companyID"></param> /// <param name="compayName"></param> /// <param name="deptID"></param> /// <param name="postID"></param> /// <param name="employeeID"></param> /// <param name="employeePostID"></param> /// <returns></returns> public bool EmployeeEntryAddDefaultRole(T_SYS_USER user, string companyID, string compayName, string deptID, string postID, string employeeID, string employeePostID) { bool flag = false; try { SysRoleBLL bll = new SysRoleBLL(); T_SYS_ROLE role = bll.GetEntryDefaultRole(companyID, compayName, deptID, postID, employeeID); if (role != null) { T_SYS_USERROLE userRole = new T_SYS_USERROLE(); userRole.USERROLEID = System.Guid.NewGuid().ToString(); userRole.CREATEDATE = System.DateTime.Now; userRole.OWNERCOMPANYID = companyID; userRole.POSTID = postID; userRole.EMPLOYEEPOSTID = employeePostID; userRole.T_SYS_USERReference.EntityKey = new System.Data.EntityKey("SMT_System_EFModelContext.T_SYS_USER", "SYSUSERID", user.SYSUSERID); userRole.T_SYS_ROLEReference.EntityKey = new System.Data.EntityKey("SMT_System_EFModelContext.T_SYS_ROLE", "ROLEID", role.ROLEID); userRole.CREATEUSER = employeeID; int i = dal.Add(userRole); if (i > 0) { flag = true; } } } catch (Exception ex) { Tracer.Debug("EmployeeEntryAddDefaultRole错误:" + ex.ToString()); flag = false; } return(flag); }
private void CustomAuthorizationBtn_Click(object sender, RoutedEventArgs e) { string strRoleID = string.Empty; if (DtGrid.SelectedItems == null) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "EDIT"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } if (DtGrid.SelectedItems.Count == 0) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "EDIT"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } T_SYS_ROLE entRole = DtGrid.SelectedItems[0] as T_SYS_ROLE; //SysRoleSetMenu UserInfo = new SysRoleSetMenu(AuthorRole); strRoleID = entRole.ROLEID; //RoleCustomMenuPermission UserInfo = new RoleCustomMenuPermission(FormTypes.Edit, strRoleID);//自定义权限 EntityMenuCustomerPermission2 UserInfo = new EntityMenuCustomerPermission2(FormTypes.Edit, strRoleID);//自定义权限 EntityBrowser browser = new EntityBrowser(UserInfo); browser.MinWidth = 850; browser.MinHeight = 520; browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent); browser.Show <string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => {}, true); }
void btnAudit_Click(object sender, RoutedEventArgs e) { if (DtGrid.SelectedItems == null) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "AUDIT"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } if (DtGrid.SelectedItems.Count == 0) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "AUDIT"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } T_SYS_ROLE ent = DtGrid.SelectedItems[0] as T_SYS_ROLE; if (ent.CHECKSTATE == ((int)CheckStates.Approving).ToString() || ent.CHECKSTATE == ((int)CheckStates.WaittingApproval).ToString() || ent.CHECKSTATE == ((int)CheckStates.UnSubmit).ToString()) { UserRoleApplyForm frm = new UserRoleApplyForm(FormTypes.Audit, ent.ROLEID); //frm.ApprovalInfo = roleInfo; EntityBrowser browser = new EntityBrowser(frm); browser.FormType = FormTypes.Audit; browser.MinWidth = 760; browser.MinHeight = 340; browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent); browser.Show <string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { }, true); } else { Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("SELECTRECORDNOTOPERATEPLEASEAGAIN")); return; } }
/// <summary> /// 查看已分配的用户 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void RoleUsedCount_Click(object sender, RoutedEventArgs e) { string strRoleID = string.Empty; if (DtGrid.SelectedItems == null) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "EDIT"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } if (DtGrid.SelectedItems.Count == 0) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "EDIT"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } T_SYS_ROLE entRole = DtGrid.SelectedItems[0] as T_SYS_ROLE; //SysRoleSetMenu UserInfo = new SysRoleSetMenu(AuthorRole); strRoleID = entRole.ROLEID; Form.AssignUserByRole editForm = new SMT.SaaS.Permission.UI.Form.AssignUserByRole(strRoleID); EntityBrowser browser = new EntityBrowser(editForm); browser.TitleContent = "查看角色对应员工"; browser.MinHeight = 400; browser.MinWidth = 550; browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent); browser.Show <string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { }); }
private void DaGr_LoadingRow(object sender, DataGridRowEventArgs e) { //T_OA_SENDDOC OrderInfoT = (T_OA_SENDDOC)e.Row.DataContext; T_SYS_ROLE RoleT = (T_SYS_ROLE)e.Row.DataContext; CheckBox mychkBox = DtGrid.Columns[0].GetCellContent(e.Row).FindName("myChkBtn") as CheckBox; mychkBox.Tag = RoleT; }
private void DataGrid_CurrentCellChanged(object sender, EventArgs e) { DataGrid grid = sender as DataGrid; if (grid.SelectedItem != null) { Role = (T_SYS_ROLE)grid.SelectedItems[0];//获取当前选中的行数据并转换为对应的实体 } }
public SetRoleMenu(T_SYS_ROLE RoleObj) { tmpRole = RoleObj; //this.tblTitle.Text = tmpUser.USERNAME.ToString() + "授权"; InitializeComponent(); InitControlEvent(); LoadData(); //tvRoleMenu.ItemContainerStyle = this.Resources["RedItemStyle"] as Style; }
private void DaGr_LoadingRow(object sender, DataGridRowEventArgs e) { //T_OA_SENDDOC OrderInfoT = (T_OA_SENDDOC)e.Row.DataContext; T_SYS_ROLE RoleT = (T_SYS_ROLE)e.Row.DataContext; Button MyAuthorBtn = DtGrid.Columns[5].GetCellContent(e.Row).FindName("AuthorizationBtn") as Button; MyAuthorBtn.Tag = RoleT; SetRowLogo(DtGrid, e.Row, "T_SYS_ROLE"); }
public SysRoleSetMenu(T_SYS_ROLE obj) { InitializeComponent(); PARENT.Children.Add(loadbar); tmprole = obj; this.tblRoleName.Text = obj.ROLENAME; InitControlEvent();//初始化控件事件 GetRoleIDRoleEntityInfos(); LoadData(); }
public SysRoleSetMenuPermisstion(T_SYS_ROLE obj) { InitializeComponent(); tmprole = obj; HiddenTabitem();//将各个标签项先禁用 加载完菜单后再释放 //this.tblRoleName.Text = obj.ROLENAME; StrTitle = obj.ROLENAME; InitControlEvent(); //RoleClient.GetPermissionByRoleIDAsync(tmprole.ROLEID); //RoleClient.GetPermissionByRoleIDSecondAsync(tmprole.ROLEID); //LoadPermissionInfos(); InitDataGridCloumn(); }
private void AuthorizationBtn_Click(object sender, RoutedEventArgs e) { Button AuthorBtn = sender as Button; T_SYS_ROLE AuthorRole = AuthorBtn.Tag as T_SYS_ROLE; //SysRoleSetMenu UserInfo = new SysRoleSetMenu(AuthorRole); SysRoleSetMenuPermisstion UserInfo = new SysRoleSetMenuPermisstion(AuthorRole);//龙康才新增 EntityBrowser browser = new EntityBrowser(UserInfo); browser.MinWidth = 850; browser.MinHeight = 500; browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent); browser.Show <string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => {}, true); }
private void AddUserRole() { if (string.IsNullOrEmpty(StrCompanyID)) { //Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("")); //return; } ComboBox cbxSystemType = Utility.FindChildControl <ComboBox>(gridfirst, "cbxPosition"); SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST dict = cbxSystemType.SelectedItem as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST; if (dict != null) { StrPositionID = dict.T_HR_POST.POSTID; } T_SYS_ROLE RoleT = new T_SYS_ROLE(); if (this.DtGrid_user.SelectedItems.Count > 0) { ViewInfosList.Clear(); for (int i = 0; i < DtGrid_user.SelectedItems.Count; i++) { Role = (T_SYS_ROLE)DtGrid_user.SelectedItems[i];//获取当前选中的行数据并转换为对应的实体 var q = from a in ViewRoleList where a == Role select a; if (!(q.Count() > 0)) { ViewRoleList.Add(Role);//添加角色 T_SYS_USERROLE role = new T_SYS_USERROLE(); role.USERROLEID = System.Guid.NewGuid().ToString(); role.CREATEDATE = System.DateTime.Now; role.OWNERCOMPANYID = StrCompanyID; role.POSTID = StrPositionID; //修改成了公司ID。主要用来权限验证 role.EMPLOYEEPOSTID = StrCompanyID; role.T_SYS_ROLEReference = new EntityReferenceOfT_SYS_ROLENb42Hbcw(); role.T_SYS_ROLEReference.EntityKey = Role.EntityKey; role.T_SYS_USERReference = new EntityReferenceOfT_SYS_USERNb42Hbcw(); role.T_SYS_USERReference.EntityKey = tmpUser.EntityKey; role.CREATEUSER = Common.CurrentLoginUserInfo.SysUserID; ViewInfosList.Add(role);//添加角色用户 } } } }
private void btnEdit_Click(object sender, RoutedEventArgs e) { ObservableCollection <T_SYS_ROLE> roleInfoList = GetSelectedList(Permissions.Edit); if (DtGrid.SelectedItems == null) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "EDIT"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } if (DtGrid.SelectedItems.Count == 0) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "EDIT"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } roleInfo = roleInfoList[0]; //if (SMT.SaaS.FrameworkUI.Common.Utility.ToolBarButtonOperationPermission(roleInfo, "T_SYS_ROLEAPP", OperationType.Edit, Common.CurrentLoginUserInfo.EmployeeID)) //{ if (roleInfo.CHECKSTATE == ((int)CheckStates.UnSubmit).ToString()) { //ApprovalForm_upd frm = new ApprovalForm_upd(FormTypes.Edit, roleInfo.APPROVALID); UserRoleApplyForm frm = new UserRoleApplyForm(FormTypes.Edit, roleInfo.ROLEID); //frm.ApprovalInfo = roleInfo; EntityBrowser browser = new EntityBrowser(frm); browser.FormType = FormTypes.Edit; browser.MinWidth = 860; browser.MinHeight = 500; browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent); browser.Show <string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { }, true); } else { //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("NOTONLYCANMODIFYTHEDATASUBMITTED")); ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("NOTONLYCANMODIFYTHEDATASUBMITTED"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); return; } //} //else //{ // ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("YOUDONOTHAVEPERMISSIONTOOPERATETHEDATA"), // Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); //} }
private void OKButton_Click(object sender, RoutedEventArgs e) { string SysRoleID = ""; T_SYS_ROLE RoleT = new T_SYS_ROLE(); if (this.DtGrid.ItemsSource != null) { foreach (object obj in DtGrid.ItemsSource) { if (DtGrid.Columns[0].GetCellContent(obj) != null) { CheckBox cb1 = DtGrid.Columns[0].GetCellContent(obj).FindName("myChkBtn") as CheckBox; //cb为 if (cb1.IsChecked == true) { RoleT = cb1.Tag as T_SYS_ROLE; //SysRoleID = RoleT.ROLEID; //DelInfosList.Add(SysRoleID); ViewRoleList.Add(RoleT); } } } } if (ViewRoleList.Count > 0) { T_SYS_USER rolewsuser = new T_SYS_USER(); rolewsuser.SYSUSERID = tmpUser.SYSUSERID; rolewsuser.EMPLOYEEID = tmpUser.EMPLOYEEID; rolewsuser.EMPLOYEECODE = tmpUser.EMPLOYEECODE; rolewsuser.EMPLOYEENAME = tmpUser.EMPLOYEENAME; rolewsuser.CREATEDATE = tmpUser.CREATEDATE; rolewsuser.CREATEUSER = tmpUser.CREATEUSER; rolewsuser.PASSWORD = tmpUser.PASSWORD; rolewsuser.UPDATEDATE = tmpUser.UPDATEDATE; rolewsuser.UPDATEUSER = tmpUser.UPDATEUSER; rolewsuser.USERNAME = tmpUser.USERNAME; rolewsuser.STATE = tmpUser.STATE; ServiceClient.UserRoleBatchAddInfosAsync(ViewRoleList, rolewsuser, "admin", System.DateTime.Now); } else { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), "请您选择角色!", Utility.GetResourceStr("CONFIRMBUTTON")); } }
void permClient_GetSysRoleSingleInfoByIdCompleted(object sender, GetSysRoleSingleInfoByIdCompletedEventArgs e) { if (e.Result != null) { tmprole = e.Result as T_SYS_ROLE; tmpDictionaryValue = tmprole.SYSTEMTYPE; //string aa = GetDictionaryInfo(tmpDictionaryValue); GetDictionaryInfo(tmprole.SYSTEMTYPE); roleInfo = tmprole; //this.txtRemark.Text = tmprole.REMARK != null ? tmprole.REMARK : ""; if (!string.IsNullOrEmpty(tmprole.OWNERID)) { //personnelClient.GetEmployeeDetailByIDAsync(tmprole.OWNERID); } //this.txtRoleName.Text = tmprole.ROLENAME; } }
/// <summary> /// 获取某一角色的详细信息 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void SysRoleClient_GetSysRoleSingleInfoByIdCompleted(object sender, GetSysRoleSingleInfoByIdCompletedEventArgs e) { if (e.Result != null) { sysRole = e.Result as T_SYS_ROLE; tmpDictionaryValue = sysRole.SYSTEMTYPE; //string aa = GetDictionaryInfo(tmpDictionaryValue); this.cbxSystemType.SelectedItem = GetDictionaryInfo(tmpDictionaryValue); this.txtRemark.Text = sysRole.REMARK != null ? sysRole.REMARK : ""; if (!string.IsNullOrEmpty(sysRole.OWNERCOMPANYID)) { GetCompanyNameByCompanyID(sysRole.OWNERCOMPANYID); GetDepartmentNameByDepartmentID(sysRole.OWNERDEPARTMENTID); } this.txtRoleName.Text = sysRole.ROLENAME; //this.txtRemark.Text = HttpUtility.HtmlDecode(sysRole.REMARK); // this.txtRemark.Text = sysRole.REMARK; } }
void btnReSubmit_Click(object sender, RoutedEventArgs e) { ObservableCollection <T_SYS_ROLE> selectItems = GetSelectedList(Permissions.Edit); if (selectItems != null) { roleInfo = selectItems.FirstOrDefault(); UserRoleApplyForm form = new UserRoleApplyForm(FormTypes.Resubmit, roleInfo.ROLEID); //form.ApprovalInfo = roleInfo; EntityBrowser browser = new EntityBrowser(form); browser.FormType = FormTypes.Resubmit; browser.MinWidth = 750; browser.MinHeight = 400; browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent); browser.Show <string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { }, true); } else { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "ReSubmit"), Utility.GetResourceStr("CONFIRMBUTTON")); } }
void BtnView_Click(object sender, RoutedEventArgs e) { ObservableCollection <T_SYS_ROLE> roleInfoList = GetSelectedList(Permissions.Browse); if (roleInfoList == null) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "VIEW"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } roleInfo = roleInfoList.FirstOrDefault(); UserRoleApplyForm frm = new UserRoleApplyForm(FormTypes.Browse, roleInfo.ROLEID); EntityBrowser browser = new EntityBrowser(frm); browser.FormType = FormTypes.Browse; browser.MinWidth = 760; browser.MinHeight = 360; browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent); browser.Show <string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { }, true); }
void ServiceClient_GetSysRoleInfosCompleted(object sender, GetSysRoleInfosCompletedEventArgs e) { cbxRole.ItemsSource = null; if (e.Result != null) { //绑定权限名称 List <T_SYS_ROLE> ents = e.Result.ToList(); cbxRole.ItemsSource = ents; cbxRole.DisplayMemberPath = "ROLENAME"; foreach (var item in cbxRole.Items) { T_SYS_ROLE tmpRole = item as T_SYS_ROLE; if (tmpRole != null && RoleMenu != null && RoleMenu.T_SYS_ROLE != null && tmpRole.ROLEID == this.RoleMenu.T_SYS_ROLE.ROLEID) { cbxRole.SelectedItem = item; break; } } } }
/// <summary> /// 添加用户角色 /// </summary> /// <param name="UserID"></param> /// <param name="RoleInfo"></param> /// <returns></returns> public bool AddUserRoleInfo(string UserID, T_SYS_ROLE RoleInfo) { bool IsReturn = true; try { SysUserBLL userbll = new SysUserBLL(); T_SYS_USER UserInfo; UserInfo = userbll.GetUserByEmployeeID(UserID); if (UserInfo == null)//没有用户则终止 { return(false); } T_SYS_USERROLE AddUserRole = new T_SYS_USERROLE(); AddUserRole.USERROLEID = System.Guid.NewGuid().ToString(); AddUserRole.T_SYS_ROLEReference.EntityKey = new System.Data.EntityKey("SMT_System_EFModelContext.T_SYS_ROLE", "ROLEID", RoleInfo.ROLEID); AddUserRole.T_SYS_USERReference.EntityKey = new System.Data.EntityKey("SMT_System_EFModelContext.T_SYS_USER", "SYSUSERID", UserInfo.SYSUSERID); AddUserRole.OWNERCOMPANYID = UserInfo.OWNERCOMPANYID; AddUserRole.POSTID = UserInfo.OWNERPOSTID; AddUserRole.UPDATEDATE = System.DateTime.Now; AddUserRole.UPDATEUSER = UserID; AddUserRole.CREATEUSER = UserID; AddUserRole.CREATEDATE = System.DateTime.Now; int i = UserRoleDal.Add(AddUserRole); if (!(i > 0)) { IsReturn = false; } } catch (Exception ex) { Tracer.Debug("用户角色SysUserRoleBLL-AddUserRoleInfo" + System.DateTime.Now.ToString() + " " + ex.ToString()); IsReturn = false; } return(IsReturn); }
private void btnEdit_Click(object sender, RoutedEventArgs e) { ObservableCollection<T_SYS_ROLE> roleInfoList = GetSelectedList(Permissions.Edit); if (DtGrid.SelectedItems == null) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "EDIT"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } if (DtGrid.SelectedItems.Count == 0) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "EDIT"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } roleInfo = roleInfoList[0]; //if (SMT.SaaS.FrameworkUI.Common.Utility.ToolBarButtonOperationPermission(roleInfo, "T_SYS_ROLEAPP", OperationType.Edit, Common.CurrentLoginUserInfo.EmployeeID)) //{ if (roleInfo.CHECKSTATE == ((int)CheckStates.UnSubmit).ToString() ) { //ApprovalForm_upd frm = new ApprovalForm_upd(FormTypes.Edit, roleInfo.APPROVALID); UserRoleApplyForm frm = new UserRoleApplyForm(FormTypes.Edit, roleInfo.ROLEID); //frm.ApprovalInfo = roleInfo; EntityBrowser browser = new EntityBrowser(frm); browser.FormType = FormTypes.Edit; browser.MinWidth = 860; browser.MinHeight = 500; browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent); browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { }, true); } else { //Utility.ShowCustomMessage(MessageTypes.Error, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("NOTONLYCANMODIFYTHEDATASUBMITTED")); ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("NOTONLYCANMODIFYTHEDATASUBMITTED"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); return; } //} //else //{ // ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("TIPS"), Utility.GetResourceStr("YOUDONOTHAVEPERMISSIONTOOPERATETHEDATA"), // Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); //} }
void BtnView_Click(object sender, RoutedEventArgs e) { ObservableCollection<T_SYS_ROLE> roleInfoList = GetSelectedList(Permissions.Browse); if (roleInfoList == null) { ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "VIEW"), Utility.GetResourceStr("CONFIRMBUTTON")); return; } roleInfo = roleInfoList.FirstOrDefault(); UserRoleApplyForm frm = new UserRoleApplyForm(FormTypes.Browse, roleInfo.ROLEID); EntityBrowser browser = new EntityBrowser(frm); browser.FormType = FormTypes.Browse; browser.MinWidth = 760; browser.MinHeight = 360; browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent); browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { }, true); }
void DataGrid_CurrentCellChanged(object sender, EventArgs e) { DataGrid grid = sender as DataGrid; if (grid.SelectedItem != null) { roleInfo = (T_SYS_ROLE)grid.SelectedItems[0];//获取当前选中的行数据并转换为对应的实体 } }
private void AuthorizationBtn_Click(object sender, RoutedEventArgs e) { Button AuthorBtn = sender as Button; T_SYS_ROLE_V AuthorRole = AuthorBtn.Tag as T_SYS_ROLE_V; T_SYS_ROLE role = new T_SYS_ROLE(); role.ROLEID = AuthorRole.ROLEID; //SysRoleSetMenu UserInfo = new SysRoleSetMenu(AuthorRole); SysRoleSetMenu2 UserInfo = new SysRoleSetMenu2(role);//龙康才新增 EntityBrowser browser = new EntityBrowser(UserInfo); browser.MinWidth = 850; browser.MinHeight = 500; browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent); browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) =>{},true); }
public bool UserRoleApplyBatchAddRoleEntityPermissionInfos(T_SYS_ROLE EntRole, string StrTmpList, string StrAdduser) { using (RoleEntityMenuBLL bll = new RoleEntityMenuBLL()) { string keyString = "RoleEntityID" + EntRole.ROLEID; String KeyNewString = "GetRoleEntityIDListInfosByRoleIDNew" + EntRole.ROLEID;//修改后的视图的显示 string keyStringPermission = "GetPermissionByRoleIDSecond" + EntRole.ROLEID; //WCFCache.Current.Remove(WCFCache.Current[keyString]); WCFCache.Current[keyString] = null; WCFCache.Current[KeyNewString] = null; //WCFCache.Current.Remove(WCFCache.Current[keyStringPermission]); WCFCache.Current[keyStringPermission] = null; return bll.UserRoleApplyEntityMenuBatchAddInfosList(EntRole, StrTmpList, StrAdduser); //return bll.RoleEntityMenuBatchAddInfosList(StrTmpList, EntRole.ROLEID, StrAdduser); //return false; } }
//改 public void SysRoleInfoUpdate(T_SYS_ROLE obj, ref string StrResult) { using (SysRoleBLL RoleBll = new SysRoleBLL()) { StrResult = RoleBll.SysRoleUpdate(obj, ref StrResult); } }
public static T_SYS_ROLE CreateT_SYS_ROLE(string rOLEID) { T_SYS_ROLE t_SYS_ROLE = new T_SYS_ROLE(); t_SYS_ROLE.ROLEID = rOLEID; return t_SYS_ROLE; }
private void CheckAllRole(bool IsChecked, T_SYS_ROLE RoleT) { }
void btnReSubmit_Click(object sender, RoutedEventArgs e) { ObservableCollection<T_SYS_ROLE> selectItems = GetSelectedList(Permissions.Edit); if (selectItems != null) { roleInfo = selectItems.FirstOrDefault(); UserRoleApplyForm form = new UserRoleApplyForm(FormTypes.Resubmit, roleInfo.ROLEID); //form.ApprovalInfo = roleInfo; EntityBrowser browser = new EntityBrowser(form); browser.FormType = FormTypes.Resubmit; browser.MinWidth = 750; browser.MinHeight = 400; browser.ReloadDataEvent += new EntityBrowser.refreshGridView(browser_ReloadDataEvent); browser.Show<string>(DialogMode.Default, Common.ParentLayoutRoot, "", (result) => { }, true); } else ComfirmWindow.ConfirmationBox(Utility.GetResourceStr("CONFIRMINFO"), Utility.GetResourceStr("SELECTERROR", "ReSubmit"), Utility.GetResourceStr("CONFIRMBUTTON")); }
private void InitParas(string roleID) { ServiceClient = new PermissionServiceClient(); ServiceClient.GetSysDictionaryByCategoryCompleted += new EventHandler<GetSysDictionaryByCategoryCompletedEventArgs>(ServiceClient_GetSysDictionaryByCategoryCompleted); ServiceClient.SysRoleInfoAddCompleted += new EventHandler<SysRoleInfoAddCompletedEventArgs>(SysRoleClient_SysRoleInfoAddCompleted); //ServiceClient.SysRoleInfoUpdateCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(SysRoleClient_SysRoleInfoUpdateCompleted); ServiceClient.SysRoleInfoUpdateCompleted += new EventHandler<SysRoleInfoUpdateCompletedEventArgs>(ServiceClient_SysRoleInfoUpdateCompleted); ServiceClient.GetSysRoleSingleInfoByIdCompleted += new EventHandler<GetSysRoleSingleInfoByIdCompletedEventArgs>(SysRoleClient_GetSysRoleSingleInfoByIdCompleted); if (!string.IsNullOrEmpty(roleID)) { tmpRoleId = roleID; //ServiceClient.GetSysRoleByIDAsync(roleID); } //绑定系统类型 ServiceClient.GetSysDictionaryByCategoryAsync("SYSTEMTYPE"); if (FormType == FormTypes.New) { SysRole = new T_SYS_ROLE(); this.txtCompanyName.Text = string.IsNullOrEmpty(Common.CurrentLoginUserInfo.UserPosts[0].CompanyName) ? "" : Common.CurrentLoginUserInfo.UserPosts[0].CompanyName;//公司名称 StrCompanyID = string.IsNullOrEmpty(Common.CurrentLoginUserInfo.UserPosts[0].CompanyID) ? "" : Common.CurrentLoginUserInfo.UserPosts[0].CompanyID;//公司ID this.txtDepartmentName.Text = string.IsNullOrEmpty(Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName) ? "" : Common.CurrentLoginUserInfo.UserPosts[0].DepartmentName;//部门名称 this.StrDepartmentID = string.IsNullOrEmpty(Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID) ? "" : Common.CurrentLoginUserInfo.UserPosts[0].DepartmentID;//部门ID SysRole.ROLEID = Guid.NewGuid().ToString(); //GetCompanyNameByCompanyID(Common.CurrentLoginUserInfo.UserPosts[0].CompanyID); } }
//增 public string SysRoleInfoAdd(T_SYS_ROLE obj) { using (SysRoleBLL RoleBll = new SysRoleBLL()) { string returnStr = ""; if (!this.IsExistSysRoleInfoByRoleNameAndCompanyAndDepartmentid(obj.ROLENAME, obj.OWNERCOMPANYID,obj.OWNERDEPARTMENTID)) { bool sucess = RoleBll.AddSysRoleInfo(obj); if (sucess == false) { returnStr = "添加系统角色失败"; } } else { returnStr = "系统角色已经存在"; } return returnStr; } }
static void Main(string[] args) { string strSql = @"select c.cname, dd.departmentname, pd.postname, e.employeecname, ei.entrydate, pm.cardid, ei.employeeentryid, e.employeeid, ep.employeepostid, p.postid, d.departmentid, c.companyid from t_hr_company c inner join t_hr_department d on c.companyid =d.companyid inner join t_hr_departmentdictionary dd on d.departmentdictionaryid=dd.departmentdictionaryid inner join t_hr_post p on d.departmentid=p.departmentid inner join t_hr_postdictionary pd on p.postdictionaryid=pd.postdictionaryid inner join t_hr_employeepost ep on ep.postid=p.postid inner join t_hr_employee e on e.employeeid=ep.employeeid left join T_HR_EmployeeEntry ei on e.employeeid=ei.employeeid left join T_HR_PensionMaster pm on e.employeeid=pm.employeeid --where e.employeecname='初始化管理员' order by c.cname"; object obj = ExecuteCustomerSql(strSql, null); using (SMT_System_EFModelContext context = new SMT_System_EFModelContext()) { T_SYS_ROLE role = new T_SYS_ROLE(); //create //T_HR_DICTIONARY entUser = new T_HR_DICTIONARY(); //entUser.DICTIONARYID = "user1"; //try //{ // context.AddToTEST_USERS(entUser); // context.SaveChanges(); //} //catch (Exception ex) //{ //} //read var ta = from a in context.T_SYS_USER select a; ta.ToList(); //foreach (var d in ta) //{ // Console.WriteLine(d.NICKNAME+" "+d.PASSWORD+" "+ d.USERNAME+" "+d.PASSWORD+" "+d.EMAIL); //} Console.ReadLine(); ////delete //var deluser = (from a in context.TEST_USERS // where a.USERNAME.Contains("entityFramwork2") // select a).FirstOrDefault(); //context.DeleteObject(deluser); //context.SaveChanges(); //update //var updateEnt = (from ent in context.TEST_USERS // where ent.USERNAME.Equals("entityFramwork2") // select ent).FirstOrDefault(); //updateEnt.PASSWORD = "******"; //context.SaveChanges(); } }
//添加用户角色 public bool UserRoleBatchAddInfos(T_SYS_ROLE[] RoleList, T_SYS_USER userobj, string StrUserName, DateTime AddDate) { using (SysUserRoleBLL UserRoleBll = new SysUserRoleBLL()) { //先清缓存GetSysUserRoleByUser string keyString = "GetSysUserRoleByUser" + userobj.SYSUSERID; WCFCache.Current[keyString] = null; return UserRoleBll.BatchAddUserRoleInfo(userobj, RoleList, StrUserName, AddDate); } }
private void SetUserRoleInfos() { if (tmpRoleList.Count() == 0) return; if (DtGrid.ItemsSource != null) { foreach (object obj in DtGrid.ItemsSource) { T_SYS_ROLE menu = new T_SYS_ROLE(); if (DtGrid.Columns[0].GetCellContent(obj) != null) { CheckBox cb1 = DtGrid.Columns[0].GetCellContent(obj).FindName("myChkBtn") as CheckBox; //cb为 menu = cb1.Tag as T_SYS_ROLE; var bb = from a in tmpRoleList where a.T_SYS_ROLE.ROLEID == menu.ROLEID select a; if (bb.Count() > 0) { cb1.IsChecked = true; }//bb.cout } } } }
public bool UserRoleApplyBatchAddRoleEntityPermissionInfos(T_SYS_ROLE EntRole, string StrTmpList, string StrAdduser) { Tracer.Debug("修改角色权限,传递的字符串:" + System.Environment.NewLine + StrTmpList); using (RoleEntityMenuBLL bll = new RoleEntityMenuBLL()) { string keyString = "RoleEntityID" + EntRole.ROLEID; String KeyNewString = "GetRoleEntityIDListInfosByRoleIDNew" + EntRole.ROLEID;//修改后的视图的显示 string keyStringPermission = "GetPermissionByRoleIDSecond" + EntRole.ROLEID; WCFCache.Current[keyString] = null; WCFCache.Current[KeyNewString] = null; WCFCache.Current[keyStringPermission] = null; return bll.UserRoleApplyEntityMenuBatchAddInfosList(EntRole, StrTmpList, StrAdduser); } }
public void AddToT_SYS_ROLE(T_SYS_ROLE t_SYS_ROLE) { base.AddObject("T_SYS_ROLE", t_SYS_ROLE); }
private void AddUserRole() { if (string.IsNullOrEmpty(StrCompanyID)) { //Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("ERROR"), Utility.GetResourceStr("")); //return; } ComboBox cbxSystemType = Utility.FindChildControl<ComboBox>(gridfirst, "cbxPosition"); SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST dict = cbxSystemType.SelectedItem as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST; if(dict !=null) StrPositionID = dict.T_HR_POST.POSTID; T_SYS_ROLE RoleT = new T_SYS_ROLE(); if (this.DtGrid_user.SelectedItems.Count >0) { ViewInfosList.Clear(); for (int i = 0; i < DtGrid_user.SelectedItems.Count; i++) { Role = (T_SYS_ROLE)DtGrid_user.SelectedItems[i];//获取当前选中的行数据并转换为对应的实体 var q = from a in ViewRoleList where a == Role select a; if (!(q.Count() > 0)) { ViewRoleList.Add(Role);//添加角色 T_SYS_USERROLE role = new T_SYS_USERROLE(); role.USERROLEID = System.Guid.NewGuid().ToString(); role.CREATEDATE = System.DateTime.Now; role.OWNERCOMPANYID = StrCompanyID; role.POSTID = StrPositionID; //修改成了公司ID。主要用来权限验证 role.EMPLOYEEPOSTID = StrCompanyID; role.T_SYS_ROLEReference=new EntityReferenceOfT_SYS_ROLENb42Hbcw(); role.T_SYS_ROLEReference.EntityKey = Role.EntityKey; role.T_SYS_USERReference=new EntityReferenceOfT_SYS_USERNb42Hbcw(); role.T_SYS_USERReference.EntityKey = tmpUser.EntityKey; role.CREATEUSER = Common.CurrentLoginUserInfo.SysUserID; ViewInfosList.Add(role);//添加角色用户 } } } }
private void DtGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { //if (StrAction == "1") //{ // foreach (object obj in DtGrid.ItemsSource) // { // if (DtGrid.Columns[0].GetCellContent(obj) != null) // { // CheckBox cb1 = DtGrid.Columns[0].GetCellContent(obj).FindName("myChkBtn") as CheckBox; //cb为 // cb1.IsChecked = false; // } // } // //cb.IsChecked = true; //} if (string.IsNullOrEmpty(StrCompanyID)) { Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("SELECTCOMPANY")); return; } if (string.IsNullOrEmpty(StrPositionID)) { Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("SELECTPOSITION")); return; } DataGrid grid = sender as DataGrid; if (grid.SelectedItems.Count == 0) { return; } if (grid.SelectedItems.Count > 0) { Role = (T_SYS_ROLE)grid.SelectedItems[0];//获取当前选中的行数据并转换为对应的实体 ComboBox cbxSystemType = Utility.FindChildControl <ComboBox>(gridfirst, "cbxPosition"); SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST dict = cbxSystemType.SelectedItem as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST; if (dict != null) { StrPositionID = dict.T_HR_POST.POSTID; } //T_SYS_ROLE RoleT = new T_SYS_ROLE(); //RoleT = cb.Tag as T_SYS_ROLE; var q = from a in ViewRoleList where a == Role select a; if (!(q.Count() > 0)) { ViewRoleList.Add(Role); T_SYS_USERROLE role = new T_SYS_USERROLE(); role.USERROLEID = System.Guid.NewGuid().ToString(); role.CREATEDATE = System.DateTime.Now; role.OWNERCOMPANYID = StrCompanyID; role.POSTID = StrPositionID; role.EMPLOYEEPOSTID = StrPositionID; role.T_SYS_USER = tmpUser; role.T_SYS_ROLE = Role; role.CREATEUSER = Common.CurrentLoginUserInfo.SysUserID; ViewInfosList.Add(role); } } }
private void DtGrid_SelectionChanged(object sender, SelectionChangedEventArgs e) { //if (StrAction == "1") //{ // foreach (object obj in DtGrid.ItemsSource) // { // if (DtGrid.Columns[0].GetCellContent(obj) != null) // { // CheckBox cb1 = DtGrid.Columns[0].GetCellContent(obj).FindName("myChkBtn") as CheckBox; //cb为 // cb1.IsChecked = false; // } // } // //cb.IsChecked = true; //} if (string.IsNullOrEmpty(StrCompanyID)) { Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("SELECTCOMPANY")); return; } if (string.IsNullOrEmpty(StrPositionID)) { Utility.ShowCustomMessage(MessageTypes.Message, Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("SELECTPOSITION")); return; } DataGrid grid = sender as DataGrid; if (grid.SelectedItems.Count == 0) { return; } if (grid.SelectedItems.Count > 0) { Role = (T_SYS_ROLE)grid.SelectedItems[0];//获取当前选中的行数据并转换为对应的实体 ComboBox cbxSystemType = Utility.FindChildControl<ComboBox>(gridfirst, "cbxPosition"); SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST dict = cbxSystemType.SelectedItem as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST; if (dict != null) StrPositionID = dict.T_HR_POST.POSTID; //T_SYS_ROLE RoleT = new T_SYS_ROLE(); //RoleT = cb.Tag as T_SYS_ROLE; var q = from a in ViewRoleList where a == Role select a; if (!(q.Count() > 0)) { ViewRoleList.Add(Role); T_SYS_USERROLE role = new T_SYS_USERROLE(); role.USERROLEID = System.Guid.NewGuid().ToString(); role.CREATEDATE = System.DateTime.Now; role.OWNERCOMPANYID = StrCompanyID; role.POSTID = StrPositionID; role.EMPLOYEEPOSTID = StrPositionID; role.T_SYS_USER = tmpUser; role.T_SYS_ROLE = Role; role.CREATEUSER = Common.CurrentLoginUserInfo.SysUserID; ViewInfosList.Add(role); } } }