void personclient_GetAllPostByEmployeeIDCompleted(object sender, GetAllPostByEmployeeIDCompletedEventArgs e) { if (e.Result != null) { List <SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST> dicts = e.Result.ToList(); var qUsingDicts = from d in dicts where d.CHECKSTATE == "2" && d.EDITSTATE == "1" select d; List <SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST> UsingDicts; if (qUsingDicts != null) { UsingDicts = qUsingDicts.ToList(); } else { UsingDicts = null; } List <SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST> newUsingDicts = new List <Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST>(); try { //重新岗位名称 foreach (var ent in UsingDicts) { try { if (!string.IsNullOrEmpty(ent.T_HR_POST.T_HR_DEPARTMENT.T_HR_COMPANY.BRIEFNAME)) { ent.T_HR_POST.T_HR_POSTDICTIONARY.POSTNAME = ent.T_HR_POST.T_HR_DEPARTMENT.T_HR_COMPANY.BRIEFNAME + "-" + ent.T_HR_POST.T_HR_POSTDICTIONARY.POSTNAME; } else { ent.T_HR_POST.T_HR_POSTDICTIONARY.POSTNAME = ent.T_HR_POST.T_HR_DEPARTMENT.T_HR_COMPANY.CNAME + "-" + ent.T_HR_POST.T_HR_POSTDICTIONARY.POSTNAME; } newUsingDicts.Add(ent); } catch (Exception e1) { newUsingDicts.Add(ent); } } } catch (Exception ex) { } ComboBox cbxSystemType = Utility.FindChildControl <ComboBox>(gridfirst, "cbxPosition"); cbxSystemType.ItemsSource = UsingDicts; cbxSystemType.DisplayMemberPath = "T_HR_POST.T_HR_POSTDICTIONARY.POSTNAME"; if (dicts.Count > 0) { cbxPosition.SelectedIndex = 0; SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST dict = cbxSystemType.SelectedItem as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST; StrPositionID = dict == null ? "" : dict.T_HR_POST.POSTID.ToString(); orgclient.GetCompanyByIdAsync(tmpUser.OWNERCOMPANYID); //orgclient.GetDepartmentByIdAsync(tmpUser.OWNERDEPARTMENTID); } } //LoadData(); }
void personclient_GetAllPostByEmployeeIDCompleted(object sender, GetAllPostByEmployeeIDCompletedEventArgs e) { if (e.Result != null) { List <SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST> dicts = e.Result.ToList(); var qUsingDicts = from d in dicts where d.CHECKSTATE == "2" && d.EDITSTATE == "1" select d; List <SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST> UsingDicts; if (qUsingDicts != null) { UsingDicts = qUsingDicts.ToList(); } else { UsingDicts = null; } //dicts[0].T_HR_EMPLOYEE.t ComboBox cbxSystemType = Utility.FindChildControl <ComboBox>(gridfirst, "cbxPosition"); cbxSystemType.ItemsSource = UsingDicts; cbxSystemType.DisplayMemberPath = "T_HR_POST.T_HR_POSTDICTIONARY.POSTNAME"; if (dicts.Count > 0) { cbxPosition.SelectedIndex = 0; SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST dict = cbxSystemType.SelectedItem as SMT.Saas.Tools.PersonnelWS.T_HR_EMPLOYEEPOST; StrPositionID = dict == null ? "" : dict.T_HR_POST.POSTID.ToString(); orgclient.GetCompanyByIdAsync(tmpUser.OWNERCOMPANYID); //orgclient.GetDepartmentByIdAsync(tmpUser.OWNERDEPARTMENTID); } } //LoadData(); }
private void cbxPosition_SelectionChanged(object sender, SelectionChangedEventArgs e) { 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; StrPositionID = dict == null ? "" : dict.T_HR_POST.POSTID.ToString(); }
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);//添加角色用户 } } } }
void ckh_Click(object sender, RoutedEventArgs e) { CheckBox chk = sender as CheckBox; var ent = dgEmployeeList.SelectedItem as PersonnelWS.V_EMPLOYEEVIEW; var tmps = from n in SelectedEmployees where n.EMPLOYEEID == ent.EMPLOYEEID select n; //这里判断了,但是可能会导致存入不了相同EMPLOYEEID的数据,例如一个员工有两个岗位, //那么后面就会只有一条数据,所以注释掉 //bool bIsNotExists = false; //if (tmps != null) //{ // if (tmps.Count() > 0) // { // bIsNotExists = true; // } //} //PersonnelWS.T_HR_EMPLOYEE temp = new PersonnelWS.T_HR_EMPLOYEE(); //temp.EMPLOYEEID = ent.EMPLOYEEID; //temp.EMPLOYEECNAME = ent.EMPLOYEECNAME; //temp.EMPLOYEECODE = ent.EMPLOYEECODE; //temp.SEX = ent.SEX; //temp.IDNUMBER = ent.IDNUMBER; //temp.OWNERCOMPANYID = ent.OWNERCOMPANYID; //temp.OWNERDEPARTMENTID = ent.OWNERDEPARTMENTID; //temp.OWNERPOSTID = ent.OWNERPOSTID; /// <summary> /// Modify Desc:在信息的处理中,在初始值中不能加入列表选择信息,所以在checkbox选择中 /// 进行数据加入和移除,然后传入到初始值中进行初始化,而且也要注意不同表单 /// 要传入的值可能不一样,这是目前发现用到的信息,以后有需要可继续加入 /// Modify Date:2012-8-8 //信息存入视图 PersonnelWS.V_EMPLOYEEVIEW temp = new PersonnelWS.V_EMPLOYEEVIEW(); temp.EMPLOYEEID = ent.EMPLOYEEID; temp.EMPLOYEECNAME = ent.EMPLOYEECNAME; temp.EMPLOYEECODE = ent.EMPLOYEECODE; temp.SEX = ent.SEX; temp.IDNUMBER = ent.IDNUMBER; temp.OWNERCOMPANYID = ent.OWNERCOMPANYID; temp.OWNERDEPARTMENTID = ent.OWNERDEPARTMENTID; temp.OWNERPOSTID = ent.OWNERPOSTID; temp.ISAGENCY = ent.ISAGENCY; temp.POSTLEVEL = ent.POSTLEVEL; temp.EMPLOYEEPOSTID = ent.EMPLOYEEPOSTID; temp.COMPANYNAME = ent.COMPANYNAME; temp.DEPARTMENTNAME = ent.DEPARTMENTNAME; temp.POSTNAME = ent.POSTNAME; temp.MOBILE = ent.MOBILE; temp.OFFICEPHONE = ent.OFFICEPHONE; //存入数据到V_EMPLOYEEVIEW视图和部门,岗位表 PersonnelWS.V_EMPLOYEEVIEW vTemp = new PersonnelWS.V_EMPLOYEEVIEW(); vTemp.EMPLOYEEID = ent.EMPLOYEEID; vTemp.EMPLOYEECNAME = ent.EMPLOYEECNAME; vTemp.EMPLOYEECODE = ent.EMPLOYEECODE; vTemp.SEX = ent.SEX; vTemp.IDNUMBER = ent.IDNUMBER; vTemp.OWNERCOMPANYID = ent.OWNERCOMPANYID; vTemp.OWNERDEPARTMENTID = ent.OWNERDEPARTMENTID; vTemp.OWNERPOSTID = ent.OWNERPOSTID; vTemp.DEPARTMENTNAME = ent.DEPARTMENTNAME; vTemp.POSTNAME = ent.POSTNAME; vTemp.POSTLEVEL = ent.POSTLEVEL; vTemp.ISAGENCY = ent.ISAGENCY; vTemp.EMPLOYEEPOSTID = ent.EMPLOYEEPOSTID; vTemp.MOBILE = ent.MOBILE; vTemp.OFFICEPHONE = ent.OFFICEPHONE; //信息存入PersonnelWS.T_HR_POSTDICTIONARY里 PersonnelWS.T_HR_POSTDICTIONARY postDicTemp = new PersonnelWS.T_HR_POSTDICTIONARY(); postDicTemp.POSTNAME = ent.POSTNAME; postDicTemp.POSTLEVEL = ent.POSTLEVEL; //信息存入PersonnelWS.T_HR_DEPARTMENTDICTIONARY里 PersonnelWS.T_HR_DEPARTMENTDICTIONARY departmentTemp = new PersonnelWS.T_HR_DEPARTMENTDICTIONARY(); departmentTemp.DEPARTMENTNAME = ent.DEPARTMENTNAME; //把信息存入PersonnelWS.T_HR_POST,然后再把PersonnelWS.T_HR_POST数据存入PersonnelWS.T_HR_EMPLOYEEPOST //最后把数据存入PersonnelWS.T_HR_EMPLOYEEPOST //注意他们之间数据类型转换 PersonnelWS.T_HR_POST tempPerWSPost = new PersonnelWS.T_HR_POST(); tempPerWSPost.POSTLEVEL = ent.POSTLEVEL; tempPerWSPost.POSTID = ent.OWNERPOSTID; PersonnelWS.T_HR_EMPLOYEE tempEmployee = new PersonnelWS.T_HR_EMPLOYEE(); tempEmployee.EMPLOYEECNAME = ent.EMPLOYEECNAME; tempEmployee.EMPLOYEEID = ent.EMPLOYEEID; tempEmployee.EMPLOYEEENAME = ent.EMPLOYEEENAME; tempEmployee.EMPLOYEECODE = ent.EMPLOYEECODE; //把PersonnelWS.T_HR_EMPLOYEEPOST信息存入,有些表单可能会用到 PersonnelWS.T_HR_EMPLOYEEPOST tempPerWSEmployeePost = new PersonnelWS.T_HR_EMPLOYEEPOST(); tempPerWSEmployeePost.EMPLOYEEPOSTID = ent.EMPLOYEEPOSTID; tempPerWSEmployeePost.ISAGENCY = ent.ISAGENCY; tempPerWSEmployeePost.POSTLEVEL = ent.POSTLEVEL; tempPerWSEmployeePost.T_HR_POST = tempPerWSPost; tempPerWSEmployeePost.T_HR_EMPLOYEE = tempEmployee; try { if (chk.IsChecked.Value) { //if (!bIsNotExists) //{ //单多选进行判断,这段代码目前是为了解决员工考勤方案分配时, //同一员工的考勤分配,一个人有两个岗位情况,那么只算一个考勤分配 //到底分配什么考勤方案,那就看情况,目前还不懂考勤分配 if (this.MultiSelected == true) { if (SelectedEmployees.Count() == 0) { SelectedDepartment.Add(departmentTemp); SelectedPost.Add(postDicTemp); SelectedEmployees.Add(temp); SelectedPersonnelEmloyeePostNew.Add(tempPerWSEmployeePost); } else { for (int i = 0; i < SelectedEmployees.Count(); i++) { //岗位一样则只算一个,这个地方想了好久的逻辑 if (SelectedEmployees[i].EMPLOYEEID == temp.EMPLOYEEID && SelectedEmployees[i].EMPLOYEECNAME==temp.EMPLOYEECNAME) { break; } if (i == SelectedEmployees.Count() - 1) { //加入字典信息这两个没有用到,写着为了测试盒调试使用,以后可能有用 SelectedDepartment.Add(departmentTemp); SelectedPost.Add(postDicTemp); SelectedEmployees.Add(temp); SelectedPersonnelEmloyeePostNew.Add(tempPerWSEmployeePost); } } } } if (this.MultiSelected == false) { SelectedDepartment.Add(departmentTemp); SelectedPost.Add(postDicTemp); SelectedEmployees.Add(temp); SelectedPersonnelEmloyeePostNew.Add(tempPerWSEmployeePost); } //} } else { //这里显然是个悲剧,原始的移除根本不起作用,所以在这加个判断, //如果信息一致就移除相应序号的信息,考虑到一个人可能有几个岗位 //所以这里不仅要判断员工ID还要判断部门ID和岗位ID,我就不信这人 //在一个部门里面还有两个岗位,如果有那他可能就是程序员兼客服兼测试…… //那就没办法了 for (int i = 0; i < SelectedEmployees.Count(); i++) { if ((SelectedEmployees[i].EMPLOYEEID == temp.EMPLOYEEID) && (SelectedEmployees[i].OWNERDEPARTMENTID == temp.OWNERDEPARTMENTID) && (SelectedEmployees[i].OWNERPOSTID == temp.OWNERPOSTID)) { SelectedDepartment.Remove(departmentTemp); SelectedPost.Remove(postDicTemp); SelectedEmployees.RemoveAt(i); SelectedPersonnelEmloyeePostNew.RemoveAt(i); } } } } catch (Exception ex) { Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("CAUTION"), "数据存入缓存错误,可关掉重新选择"); } //if (chk.IsChecked.Value) //{ // if (!bIsNotExists) // { // SelectedEmployees.Add(temp); // } //} //else //{ // if (bIsNotExists) // { // SelectedEmployees.Remove(temp); // } //} }
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); } } }
void ckh_Click(object sender, RoutedEventArgs e) { CheckBox chk = sender as CheckBox; var ent = dgEmployeeList.SelectedItem as PersonnelWS.V_EMPLOYEEVIEW; var tmps = from n in SelectedEmployees where n.EMPLOYEEID == ent.EMPLOYEEID select n; //这里判断了,但是可能会导致存入不了相同EMPLOYEEID的数据,例如一个员工有两个岗位, //那么后面就会只有一条数据,所以注释掉 //bool bIsNotExists = false; //if (tmps != null) //{ // if (tmps.Count() > 0) // { // bIsNotExists = true; // } //} //PersonnelWS.T_HR_EMPLOYEE temp = new PersonnelWS.T_HR_EMPLOYEE(); //temp.EMPLOYEEID = ent.EMPLOYEEID; //temp.EMPLOYEECNAME = ent.EMPLOYEECNAME; //temp.EMPLOYEECODE = ent.EMPLOYEECODE; //temp.SEX = ent.SEX; //temp.IDNUMBER = ent.IDNUMBER; //temp.OWNERCOMPANYID = ent.OWNERCOMPANYID; //temp.OWNERDEPARTMENTID = ent.OWNERDEPARTMENTID; //temp.OWNERPOSTID = ent.OWNERPOSTID; /// <summary> /// Modify Desc:在信息的处理中,在初始值中不能加入列表选择信息,所以在checkbox选择中 /// 进行数据加入和移除,然后传入到初始值中进行初始化,而且也要注意不同表单 /// 要传入的值可能不一样,这是目前发现用到的信息,以后有需要可继续加入 /// Modify Date:2012-8-8 //信息存入视图 PersonnelWS.V_EMPLOYEEVIEW temp = new PersonnelWS.V_EMPLOYEEVIEW(); temp.EMPLOYEEID = ent.EMPLOYEEID; temp.EMPLOYEECNAME = ent.EMPLOYEECNAME; temp.EMPLOYEECODE = ent.EMPLOYEECODE; temp.SEX = ent.SEX; temp.IDNUMBER = ent.IDNUMBER; temp.OWNERCOMPANYID = ent.OWNERCOMPANYID; temp.OWNERDEPARTMENTID = ent.OWNERDEPARTMENTID; temp.OWNERPOSTID = ent.OWNERPOSTID; temp.ISAGENCY = ent.ISAGENCY; temp.POSTLEVEL = ent.POSTLEVEL; temp.EMPLOYEEPOSTID = ent.EMPLOYEEPOSTID; temp.COMPANYNAME = ent.COMPANYNAME; temp.DEPARTMENTNAME = ent.DEPARTMENTNAME; temp.POSTNAME = ent.POSTNAME; temp.MOBILE = ent.MOBILE; temp.OFFICEPHONE = ent.OFFICEPHONE; //存入数据到V_EMPLOYEEVIEW视图和部门,岗位表 PersonnelWS.V_EMPLOYEEVIEW vTemp = new PersonnelWS.V_EMPLOYEEVIEW(); vTemp.EMPLOYEEID = ent.EMPLOYEEID; vTemp.EMPLOYEECNAME = ent.EMPLOYEECNAME; vTemp.EMPLOYEECODE = ent.EMPLOYEECODE; vTemp.SEX = ent.SEX; vTemp.IDNUMBER = ent.IDNUMBER; vTemp.OWNERCOMPANYID = ent.OWNERCOMPANYID; vTemp.OWNERDEPARTMENTID = ent.OWNERDEPARTMENTID; vTemp.OWNERPOSTID = ent.OWNERPOSTID; vTemp.DEPARTMENTNAME = ent.DEPARTMENTNAME; vTemp.POSTNAME = ent.POSTNAME; vTemp.POSTLEVEL = ent.POSTLEVEL; vTemp.ISAGENCY = ent.ISAGENCY; vTemp.EMPLOYEEPOSTID = ent.EMPLOYEEPOSTID; vTemp.MOBILE = ent.MOBILE; vTemp.OFFICEPHONE = ent.OFFICEPHONE; //信息存入PersonnelWS.T_HR_POSTDICTIONARY里 PersonnelWS.T_HR_POSTDICTIONARY postDicTemp = new PersonnelWS.T_HR_POSTDICTIONARY(); postDicTemp.POSTNAME = ent.POSTNAME; postDicTemp.POSTLEVEL = ent.POSTLEVEL; //信息存入PersonnelWS.T_HR_DEPARTMENTDICTIONARY里 PersonnelWS.T_HR_DEPARTMENTDICTIONARY departmentTemp = new PersonnelWS.T_HR_DEPARTMENTDICTIONARY(); departmentTemp.DEPARTMENTNAME = ent.DEPARTMENTNAME; //把信息存入PersonnelWS.T_HR_POST,然后再把PersonnelWS.T_HR_POST数据存入PersonnelWS.T_HR_EMPLOYEEPOST //最后把数据存入PersonnelWS.T_HR_EMPLOYEEPOST //注意他们之间数据类型转换 PersonnelWS.T_HR_POST tempPerWSPost = new PersonnelWS.T_HR_POST(); tempPerWSPost.POSTLEVEL = ent.POSTLEVEL; tempPerWSPost.POSTID = ent.OWNERPOSTID; PersonnelWS.T_HR_EMPLOYEE tempEmployee = new PersonnelWS.T_HR_EMPLOYEE(); tempEmployee.EMPLOYEECNAME = ent.EMPLOYEECNAME; tempEmployee.EMPLOYEEID = ent.EMPLOYEEID; tempEmployee.EMPLOYEEENAME = ent.EMPLOYEEENAME; tempEmployee.EMPLOYEECODE = ent.EMPLOYEECODE; //把PersonnelWS.T_HR_EMPLOYEEPOST信息存入,有些表单可能会用到 PersonnelWS.T_HR_EMPLOYEEPOST tempPerWSEmployeePost = new PersonnelWS.T_HR_EMPLOYEEPOST(); tempPerWSEmployeePost.EMPLOYEEPOSTID = ent.EMPLOYEEPOSTID; tempPerWSEmployeePost.ISAGENCY = ent.ISAGENCY; tempPerWSEmployeePost.POSTLEVEL = ent.POSTLEVEL; tempPerWSEmployeePost.T_HR_POST = tempPerWSPost; tempPerWSEmployeePost.T_HR_EMPLOYEE = tempEmployee; try { if (chk.IsChecked.Value) { //if (!bIsNotExists) //{ //单多选进行判断,这段代码目前是为了解决员工考勤方案分配时, //同一员工的考勤分配,一个人有两个岗位情况,那么只算一个考勤分配 //到底分配什么考勤方案,那就看情况,目前还不懂考勤分配 if (this.MultiSelected == true) { if (SelectedEmployees.Count() == 0) { SelectedDepartment.Add(departmentTemp); SelectedPost.Add(postDicTemp); SelectedEmployees.Add(temp); SelectedPersonnelEmloyeePostNew.Add(tempPerWSEmployeePost); } else { for (int i = 0; i < SelectedEmployees.Count(); i++) { //岗位一样则只算一个,这个地方想了好久的逻辑 if (SelectedEmployees[i].EMPLOYEEID == temp.EMPLOYEEID && SelectedEmployees[i].EMPLOYEECNAME == temp.EMPLOYEECNAME) { break; } if (i == SelectedEmployees.Count() - 1) { //加入字典信息这两个没有用到,写着为了测试盒调试使用,以后可能有用 SelectedDepartment.Add(departmentTemp); SelectedPost.Add(postDicTemp); SelectedEmployees.Add(temp); SelectedPersonnelEmloyeePostNew.Add(tempPerWSEmployeePost); } } } } if (this.MultiSelected == false) { SelectedDepartment.Add(departmentTemp); SelectedPost.Add(postDicTemp); SelectedEmployees.Add(temp); SelectedPersonnelEmloyeePostNew.Add(tempPerWSEmployeePost); } //} } else { //这里显然是个悲剧,原始的移除根本不起作用,所以在这加个判断, //如果信息一致就移除相应序号的信息,考虑到一个人可能有几个岗位 //所以这里不仅要判断员工ID还要判断部门ID和岗位ID,我就不信这人 //在一个部门里面还有两个岗位,如果有那他可能就是程序员兼客服兼测试…… //那就没办法了 for (int i = 0; i < SelectedEmployees.Count(); i++) { if ((SelectedEmployees[i].EMPLOYEEID == temp.EMPLOYEEID) && (SelectedEmployees[i].OWNERDEPARTMENTID == temp.OWNERDEPARTMENTID) && (SelectedEmployees[i].OWNERPOSTID == temp.OWNERPOSTID)) { SelectedDepartment.Remove(departmentTemp); SelectedPost.Remove(postDicTemp); SelectedEmployees.RemoveAt(i); SelectedPersonnelEmloyeePostNew.RemoveAt(i); } } } } catch (Exception ex) { Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("CAUTION"), "数据存入缓存错误,可关掉重新选择"); } //if (chk.IsChecked.Value) //{ // if (!bIsNotExists) // { // SelectedEmployees.Add(temp); // } //} //else //{ // if (bIsNotExists) // { // SelectedEmployees.Remove(temp); // } //} }