Example #1
0
        /// <summary>
        /// 导出员工薪资档案变更新记录
        /// </summary>
        /// <param name="sender">sender</param>
        /// <param name="e">e</param>
        void btnExportArchive_Click(object sender, RoutedEventArgs e)
        {
            dialog.DefaultExt  = ".xls";
            dialog.Filter      = "MS Excel Files|*.xls";
            dialog.FilterIndex = 1;
            result             = dialog.ShowDialog();
            if (result.Value == true)
            {
                string strEmployeeName = string.Empty, strSortKey = string.Empty, strOwnerID = string.Empty, strCheckState = string.Empty;
                //当前登录人ID
                strOwnerID = Common.CurrentLoginUserInfo.EmployeeID;
                //排序字段
                strSortKey = "EMPLOYEENAME,OTHERSUBJOIN,OTHERADDDEDUCT";
                loadbar.Start();
                string filter = string.Empty;
                int    sType  = 0;
                string sValue = string.Empty;

                System.Collections.ObjectModel.ObservableCollection <string> paras = new System.Collections.ObjectModel.ObservableCollection <string>();
                string selectedType = treeOrganization.sType;
                if (!string.IsNullOrEmpty(selectedType))
                {
                    switch (selectedType)
                    {
                    case "Company":
                        sType = 0;
                        break;

                    case "Department":
                        sType = 1;
                        break;

                    case "Post":
                        sType = 2;
                        break;
                    }
                    sValue = treeOrganization.sValue;
                }
                else
                {
                    loadbar.Stop();
                    return;
                }
                TextBox txtName = Utility.FindChildControl <TextBox>(expander, "txtName");
                if (txtName != null && !string.IsNullOrWhiteSpace(txtName.Text))
                {
                    filter += " @" + paras.Count().ToString() + ".Contains(EMPLOYEENAME)";
                    paras.Add(txtName.Text);
                }
                ComboBox cmbUsable = Utility.FindChildControl <ComboBox>(expander, "cmbUsable");
                //查询码0:有效 1:历史
                int    queryCode = 0;
                string companyID = null;
                if (cmbUsable != null && (string)cmbUsable.SelectionBoxItem == "有效")
                {
                    queryCode = 0;
                    if (treeOrganization != null)
                    {
                        companyID = treeOrganization.sValue;
                    }
                }
                else
                {
                    queryCode = 1;
                    companyID = null;
                }
                client.ExportSalaryArchiveAsync(strSortKey, filter, paras, userID, Checkstate, sType, sValue, queryCode, companyID);
            }
        }