/// <summary> /// 绑定员工列表 /// </summary> private void BindEmployeeList() { int pageSize = 0, pageIndex = 0, pageCount = 0; string filter = string.Empty, strMsg = string.Empty; System.Collections.ObjectModel.ObservableCollection <string> paras = new System.Collections.ObjectModel.ObservableCollection <string>(); if (!string.IsNullOrEmpty(txtEmpName.Text.Trim())) { if (!string.IsNullOrEmpty(filter)) { filter += " and "; } filter += " @" + paras.Count().ToString() + ".Contains(EMPLOYEECNAME)"; paras.Add(txtEmpName.Text.Trim()); } string sType = "", sValue = ""; //2012-9-13 //不需要选择机构就可进行查询,于是注释 // GetOrgInfoByChecked(ref sType, ref sValue, ref strMsg); if (!string.IsNullOrWhiteSpace(strMsg)) { Utility.ShowCustomMessage(MessageTypes.Caution, Utility.GetResourceStr("CAUTION"), strMsg); return; } //不分页 pageIndex = 1; pageSize = 999999; PersonnelWS.PersonnelServiceClient clientPers = new PersonnelWS.PersonnelServiceClient(); Employeestate statetmp = cbxEmployeeState.SelectedItem as Employeestate; if (statetmp != null) { if (statetmp.Value == "1") { clientPers.GetLeaveEmployeeViewsPagingCompleted += new EventHandler <PersonnelWS.GetLeaveEmployeeViewsPagingCompletedEventArgs>(clientPers_GetLeaveEmployeeViewsPagingCompleted); clientPers.GetLeaveEmployeeViewsPagingAsync(pageIndex, pageSize, "EMPLOYEECNAME", filter, paras, pageCount, sType, sValue, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); } else { clientPers.GetEmployeeViewsPagingCompleted += new EventHandler <PersonnelWS.GetEmployeeViewsPagingCompletedEventArgs>(clientPers_GetEmployeeViewsPagingCompleted); clientPers.GetEmployeeViewsPagingAsync(pageIndex, pageSize, "EMPLOYEECNAME", filter, paras, pageCount, sType, sValue, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); } } else { clientPers.GetEmployeeViewsPagingCompleted += new EventHandler <PersonnelWS.GetEmployeeViewsPagingCompletedEventArgs>(clientPers_GetEmployeeViewsPagingCompleted); clientPers.GetEmployeeViewsPagingAsync(pageIndex, pageSize, "EMPLOYEECNAME", filter, paras, pageCount, sType, sValue, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); } }
void LoadData() { loadbar.Start(); int pageCount = 0; string filter = ""; System.Collections.ObjectModel.ObservableCollection <string> paras = new System.Collections.ObjectModel.ObservableCollection <string>(); TextBox txtEmpName = Utility.FindChildControl <TextBox>(expander, "txtEmpName"); TextBox txtEmpCode = Utility.FindChildControl <TextBox>(expander, "txtEmpCode"); ComboBox cbxstate = Utility.FindChildControl <ComboBox>(expander, "cbxEmployeeState"); if (txtEmpCode != null) { if (!string.IsNullOrEmpty(txtEmpCode.Text.Trim())) { //filter += "EMPLOYEECODE==@" + paras.Count().ToString(); filter += " @" + paras.Count().ToString() + ".Contains(EMPLOYEECODE)"; paras.Add(txtEmpCode.Text.Trim()); } } if (txtEmpName != null) { if (!string.IsNullOrEmpty(txtEmpName.Text.Trim())) { if (!string.IsNullOrEmpty(filter)) { filter += " and "; } filter += " @" + paras.Count().ToString() + ".Contains(EMPLOYEECNAME)"; paras.Add(txtEmpName.Text.Trim()); } } string sType = "", sValue = ""; //TreeViewItem selectedItem = treeOrganization.SelectedItem as TreeViewItem; sType = treeOrganization.sType; sValue = treeOrganization.sValue; //if (selectedItem != null) //{ // string IsTag = selectedItem.Tag.ToString(); // switch (IsTag) // { // case "Company": // OrganizationWS.T_HR_COMPANY company = selectedItem.DataContext as OrganizationWS.T_HR_COMPANY; // sType = "Company"; // sValue = company.COMPANYID; // break; // case "Department": // OrganizationWS.T_HR_DEPARTMENT department = selectedItem.DataContext as OrganizationWS.T_HR_DEPARTMENT; // sType = "Department"; // sValue = department.DEPARTMENTID; // break; // case "Post": // OrganizationWS.T_HR_POST post = selectedItem.DataContext as OrganizationWS.T_HR_POST; // sType = "Post"; // sValue = post.POSTID; // break; // } //} //client.GetEmployeePagingAsync(dataPager.PageIndex, dataPager.PageSize, "EMPLOYEECNAME", // filter, paras, pageCount, sType, sValue, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); IsNeedLoadData = true; Employeestate statetmp = cbxstate.SelectedItem as Employeestate; if (statetmp != null) { if (statetmp.Value == "1") { client.GetLeaveEmployeeViewsPagingAsync(dataPager.PageIndex, dataPager.PageSize, "EMPLOYEECNAME", filter, paras, pageCount, sType, sValue, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); } else { //client.GetEmployeeViewsPagingAsync(dataPager.PageIndex, dataPager.PageSize, "EMPLOYEECNAME", //filter, paras, pageCount, sType, sValue, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); client.GetEmployeeBasicInfoPagingViewAsync(dataPager.PageIndex, dataPager.PageSize, "EMPLOYEECNAME", filter, paras, pageCount, sType, sValue, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); } } else { //client.GetEmployeeViewsPagingAsync(dataPager.PageIndex, dataPager.PageSize, "EMPLOYEECNAME", //, paras, pageCount, sType, sValue, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); client.GetEmployeeBasicInfoPagingViewAsync(dataPager.PageIndex, dataPager.PageSize, "EMPLOYEECNAME", filter, paras, pageCount, sType, sValue, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); } }
/// <summary> /// 导出员工档案 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void btnOutExcel_Click(object sender, RoutedEventArgs e) { //Form.Personnel.OutExcelEmployeeForm form = new Form.Personnel.OutExcelEmployeeForm(); //form.Show<string>(DialogMode.Default, SMT.SAAS.Main.CurrentContext.Common.ParentLayoutRoot, "", (result) => { }); dialog.Filter = "MS Excel Files|*.xls"; dialog.FilterIndex = 1; result = dialog.ShowDialog(); string sType = "", sValue = ""; sType = treeOrganization.sType; sValue = treeOrganization.sValue; if (sType != "Company") { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), Utility.GetResourceStr("SELECTCOMPANY"), Utility.GetResourceStr("CONFIRM"), MessageIcon.Exclamation); return; } string filter = ""; System.Collections.ObjectModel.ObservableCollection <string> paras = new System.Collections.ObjectModel.ObservableCollection <string>(); TextBox txtEmpName = Utility.FindChildControl <TextBox>(expander, "txtEmpName"); TextBox txtEmpCode = Utility.FindChildControl <TextBox>(expander, "txtEmpCode"); ComboBox cbxstate = Utility.FindChildControl <ComboBox>(expander, "cbxEmployeeState"); if (txtEmpCode != null) { if (!string.IsNullOrEmpty(txtEmpCode.Text.Trim())) { //filter += "EMPLOYEECODE==@" + paras.Count().ToString(); filter += " @" + paras.Count().ToString() + ".Contains(EmployeeCode)"; paras.Add(txtEmpCode.Text.Trim()); } } if (txtEmpName != null) { if (!string.IsNullOrEmpty(txtEmpName.Text.Trim())) { if (!string.IsNullOrEmpty(filter)) { filter += " and "; } filter += " @" + paras.Count().ToString() + ".Contains(EmployeeName)"; paras.Add(txtEmpName.Text.Trim()); } } Employeestate statetmp = cbxstate.SelectedItem as Employeestate; if (statetmp.Value == "0") { if (!string.IsNullOrEmpty(filter)) { filter += " and "; } filter += " @EmployeeState!=\"2\" "; } else { if (!string.IsNullOrEmpty(filter)) { filter += " and "; } filter += " @EmployeeState==\"2\" "; } string companyID = sValue; client.ExportEmployeeAsync(companyID, filter, paras, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); }
private void LoadData() { loadbar.Start(); int pageCount = 0; string filter = ""; string strState = ""; if (Checkstate != Convert.ToInt32(CheckStates.All).ToString()) { strState = Checkstate; } System.Collections.ObjectModel.ObservableCollection <object> paras = new System.Collections.ObjectModel.ObservableCollection <object>(); //if (Checkstate != Convert.ToInt32(CheckStates.All).ToString()) //{ // filter += "CHECKSTATE==@" + paras.Count().ToString(); // paras.Add(Convert.ToInt32(Checkstate).ToString()); //} TextBox txtEmpName = Utility.FindChildControl <TextBox>(expander, "txtEmpName"); if (txtEmpName != null) { if (!string.IsNullOrEmpty(txtEmpName.Text)) { if (!string.IsNullOrEmpty(filter)) { filter += " and "; } //filter += "T_HR_EMPLOYEE.EMPLOYEENAME==@" + paras.Count().ToString(); filter += " @" + paras.Count().ToString() + ".Contains(T_HR_EMPLOYEE.EMPLOYEECNAME)"; paras.Add(txtEmpName.Text.Trim()); } } //if (Checkstate != Convert.ToInt32(CheckStates.All).ToString()) // { // if (!string.IsNullOrEmpty(filter)) // { // filter += " and "; // } // filter += "CHECKSTATE==@" + paras.Count().ToString(); // paras.Add(Checkstate); // } string employeeState = "0"; ComboBox cbxstate = Utility.FindChildControl <ComboBox>(expander, "cbxEmployeeState"); Employeestate statetmp = cbxstate.SelectedItem as Employeestate; if (statetmp != null) { employeeState = statetmp.Value; } DatePicker dpEndToDate = Utility.FindChildControl <DatePicker>(expander, "dpEndToDate"); DatePicker dpStartToDate = Utility.FindChildControl <DatePicker>(expander, "dpStartToDate"); if (!string.IsNullOrEmpty(dpEndToDate.Text) && string.IsNullOrEmpty(dpStartToDate.Text)) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), "请选择合同到期开始时间", Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); loadbar.Stop(); return; } if (string.IsNullOrEmpty(dpEndToDate.Text) && !string.IsNullOrEmpty(dpStartToDate.Text)) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), "请选择合同到期结束时间", Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); loadbar.Stop(); return; } if (!string.IsNullOrEmpty(dpEndToDate.Text) && !string.IsNullOrEmpty(dpStartToDate.Text)) { if (DateTime.Parse(dpStartToDate.Text) > DateTime.Parse(dpEndToDate.Text)) { ComfirmWindow.ConfirmationBoxs(Utility.GetResourceStr("CAUTION"), "合同到期开始时间不能大于结束时间", Utility.GetResourceStr("CONFIRM"), MessageIcon.Error); loadbar.Stop(); return; } } client.EmployeeContractViewPagingAsync(dataPager.PageIndex, dataPager.PageSize, "T_HR_EMPLOYEE.EMPLOYEECODE", filter, paras, pageCount, strState, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID, dpStartToDate.Text, dpEndToDate.Text, employeeState); //client.EmployeeContractPagingAsync(dataPager.PageIndex, dataPager.PageSize, "T_HR_EMPLOYEE.EMPLOYEECODE", filter, paras, // pageCount, strState, SMT.SAAS.Main.CurrentContext.Common.CurrentLoginUserInfo.EmployeeID); }