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 FrmResponsibleStatistics : Software.UI.StatisticalInquiry.FrmResponsibleStatistics { LYFZ.BLL.BLL_ErpOrderDigital digitalBll = new BLL.BLL_ErpOrderDigital(); public FrmResponsibleStatistics() { btnQuery.Click += btnQuery_Click; btnClose.Click += btnClose_Click; dgvStatistics.CellDoubleClick += dgvStatistics_CellContentDoubleClick; this.Load += FrmResponsibleStatistics_Load; } void dgvStatistics_CellContentDoubleClick(object sender, DataGridViewCellEventArgs e) { FrmResponsiblePersonDetails detail = new FrmResponsiblePersonDetails(); detail.employeeId = dgvStatistics.Rows[e.RowIndex].Tag.ToString(); detail.startTime = dtpStart.DateValue; detail.endTime = dtpEnd.DateValue; string headerText = dgvStatistics.Columns[e.ColumnIndex].HeaderText; switch(headerText) { case "摄影师": detail.cbxPhotograph.Checked=true; break; case "摄影师助理": detail.cbxPhotographAssist.Checked=true; break; case "化妆师": detail.cbxMakeup.Checked=true; break; case "化妆师助理": detail.cbxMakeupAssist.Checked=true; break; case "引导师": detail.cbxBoot.Checked=true; break; case "引导师助理": detail.cbxBootAssist.Checked=true; break; default: detail.cbxPhotograph.Checked=true; detail.cbxPhotographAssist.Checked=true; detail.cbxMakeup.Checked=true; detail.cbxMakeupAssist.Checked=true; detail.cbxBoot.Checked=true; detail.cbxBootAssist.Checked=true; break; } detail.ShowDialog(); } void FrmResponsibleStatistics_Load(object sender, EventArgs e) { dtpStart.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, 1); dtpEnd.Value = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day); GetUserDigitalOrderStatistics(); } void btnClose_Click(object sender, EventArgs e) { this.Close(); } void btnQuery_Click(object sender, EventArgs e) { GetUserDigitalOrderStatistics(); } void GetUserDigitalOrderStatistics() { dgvStatistics.Rows.Clear(); Dictionary> dt = digitalBll.GetUserDigitalOrderStatistics(dtpStart.Value.ToString("yyyy-MM-dd"), dtpEnd.Value.ToString("yyyy-MM-dd")); foreach(string userName in dt.Keys) { int indx = dgvStatistics.Rows.Add(); this.dgvStatistics.Rows[indx].Cells["责任人"].Value = userName; Dictionary columKeys = dt[userName]; foreach(string columKey in columKeys.Keys) { if (columKey!=("用户编号")) { this.dgvStatistics.Rows[indx].Cells[columKey].Value = columKeys[columKey]; } } this.dgvStatistics.Rows[indx].Tag = columKeys["用户编号"].ToString(); } } } }