using LYFZ.ComponentLibrary; using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace LYFZ.Software.MainBusiness.StatisticalInquiry { public partial class FrmStatisticalInquiryEmployees : LYFZ.Software.UI.StatisticalInquiry.FrmStatisticalInquiryEmployees { private DataTable tbl_View = new DataTable(); public FrmStatisticalInquiryEmployees() { this.Shown += FrmStatisticalInquiryEmployees_Shown; this.txtTsorder_OpenSingle.ComboBoxTree_NodeMouseClick += txtTsorder_OpenSingle_ComboBoxTree_NodeMouseClick; this.btnClose.Click += btnClose_Click; } /// /// 窗体加载事件 /// /// /// void FrmStatisticalInquiryEmployees_Shown(object sender, EventArgs e) { LYFZ.Software.MainBusiness.DoorCityProcess.PublicCodeClasses.BindComboBoxTreeView_DepartmentAndEmployee(this.txtTsorder_OpenSingle, IsFirstNodeNull: true); if (!LYFZ.BLL.BLL_ErpUser.GetRights(LYFZ.BLL.BLL_ErpUser.CurrentUserRights.SatisticalInquiryEmployeesCompetence, CustomAttributes.OperatingAuthority.ViewAll)) { this.txtTsorder_OpenSingle.Enabled = false; } if (LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Account != LYFZ.AuthorizeUserName.AdministratorsName) { this.txtTsorder_OpenSingle.Tag = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_EmployeeID; this.txtTsorder_OpenSingle.Text = LYFZ.Software.MainBusiness.CommonLogical.SuccessfulLogin.LoginUserModel.User_Name; } this.PublicFunctionRows(); } /// /// 选择人员 /// /// /// void txtTsorder_OpenSingle_ComboBoxTree_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) { this.PublicFunctionRows(); } /// /// 关闭 /// /// /// void btnClose_Click(object sender, EventArgs e) { this.Close(); } /// /// 创建行 /// void PublicFunctionRows() { string StrWhere = " Where 1 = 1"; if (txtTsorder_OpenSingle.Text.ToString().Trim().Length > 0) { StrWhere += " And User_EmployeeID = '" + txtTsorder_OpenSingle.Tag.ToString() + "'"; } else { StrWhere += " And User_Account != 'admin'"; } DataTable newTable = new DataTable(); LYFZ.ComponentLibrary.FrmLoadHandling.LoadDoWorkMethod(delegate(object obj, BackgroundWorker backgroundWorker) { newTable = LYFZ.BLL.BLL_ErpOrderView.GetData_StatisticsQueryUserInfo(StrWhere, ""); }); #region this.dgvData.DataColumns("ID,部门,工号,姓名,性别,电话,身份证号,地址,籍贯地址,婚否,在职,生日,备注", strHideField: "ID"); this.dgvData.Columns["身份证号"].Width = 140; this.dgvData.Columns["生日"].Width = 110; this.dgvData.Columns["地址"].Width = 250; this.dgvData.FillLastColumn(); for (int t = 0; t < newTable.Rows.Count; t++) { DataGridViewRow dgvr = new DataGridViewRow(); DataGridViewCell cell = null; cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["ID"].ToString().Trim(); ; dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["部门"].ToString().Trim(); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["工号"].ToString().Trim(); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["姓名"].ToString().Trim(); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["性别"].ToString().Trim(); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["电话"].ToString().Trim(); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["身份证号"].ToString().Trim(); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["地址"].ToString().Trim(); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["籍贯地址"].ToString().Trim(); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = Convert.ToBoolean(newTable.Rows[t]["婚否"]) ? "已婚" : "未婚"; dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["在职"].ToString().Trim(); dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); string StrValue = LYFZ.BLL.OtherCommonModel.DateTimeToString(newTable.Rows[t]["生日"], LYFZ.DateTimeType.StrMMdd); if (Convert.ToBoolean(newTable.Rows[t]["User_BirthdayLunar"])) { StrValue += "_农历"; } cell.Value = StrValue; dgvr.Cells.Add(cell); cell = new DataGridViewTextBoxCell(); cell.Value = newTable.Rows[t]["备注"].ToString().Trim(); dgvr.Cells.Add(cell); this.dgvData.Rows.Add(dgvr); } dgvData.ClearSelection(); #endregion } } }