private void treeView_Data_AfterSelect(object sender, TreeViewEventArgs e) { EventArgs_Unit myEventArgs_Unit = new EventArgs_Unit(); switch (this.treeView_Data.SelectedNode.Level) { case 0: break; case 1: myEventArgs_Unit.EmployerGroup = this.treeView_Data.SelectedNode.Name.ToString(); break; case 2: myEventArgs_Unit.EmployerHPID = this.treeView_Data.SelectedNode.Name.ToString(); break; case 3: myEventArgs_Unit.DepartmentHPID = this.treeView_Data.SelectedNode.Name.ToString(); break; case 4: myEventArgs_Unit.WorkPlaceHPID = this.treeView_Data.SelectedNode.Name.ToString(); break; } Publisher_Unit.OnEventName(myEventArgs_Unit); }
private void InitstatusStrip(object sender, EventArgs_Unit e) { Class_WorkPlace myClass_WorkPlace = new Class_WorkPlace(); Class_Department myClass_Department = new Class_Department(); Class_Employer myClass_Employer = new Class_Employer(); if (string.IsNullOrEmpty(e.WorkPlaceHPID)) { if (string.IsNullOrEmpty(e.DepartmentHPID)) { if (string.IsNullOrEmpty(e.EmployerHPID)) { if (string.IsNullOrEmpty(e.EmployerGroup)) { myClass_Employer.EmployerGroup = "全部"; } else { } } else { myClass_Employer.EmployerHPID = e.EmployerHPID; myClass_Employer.FillData(); e.EmployerGroup = myClass_Employer.EmployerGroup; } } else { myClass_Department.DepartmentHPID = e.DepartmentHPID; myClass_Department.FillData(); myClass_Employer.EmployerHPID = myClass_Department.EmployerHPID; myClass_Employer.FillData(); e.EmployerGroup = myClass_Employer.EmployerGroup; } } else { myClass_WorkPlace.WorkPlaceHPID = e.WorkPlaceHPID; myClass_WorkPlace.FillData(); myClass_Department.DepartmentHPID = myClass_WorkPlace.DepartmentHPID; myClass_Department.FillData(); myClass_Employer.EmployerHPID = myClass_Department.EmployerHPID; myClass_Employer.FillData(); e.EmployerGroup = myClass_Employer.EmployerGroup; } this.toolStripStatusLabel_EmployerGroup.Text = string.Format("公司组:{0}", e.EmployerGroup); this.toolStripStatusLabel_Employer.Text = string.Format("公司:{0}", myClass_Employer.Employer); this.toolStripStatusLabel_Department.Text = string.Format("部门:{0}", myClass_Department.Department); this.toolStripStatusLabel_WorkPlace.Text = string.Format("作业区:{0}", myClass_WorkPlace.WorkPlace); }
/// <summary> /// 初始化数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InitDataGridView(object sender, EventArgs_Unit e) { this.str_Filter = null; this.myEventArgs_Unit = e; Class_DataControlBind.InitializeDataGridView(this.dataGridView_Data, Enum_DataTable.WelderBelong.ToString(), false); Class_Data myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.WelderBelong.ToString()]; if (string.IsNullOrEmpty(this.myEventArgs_Unit.WorkPlaceHPID)) { if (string.IsNullOrEmpty(this.myEventArgs_Unit.DepartmentHPID)) { if (string.IsNullOrEmpty(this.myEventArgs_Unit.EmployerHPID)) { if (string.IsNullOrEmpty(this.myEventArgs_Unit.EmployerGroup)) { str_Filter = string.Format("1=1"); } else { str_Filter = string.Format("WelderBelongEmployerGroup='{0}'", this.myEventArgs_Unit.EmployerGroup); } } else { str_Filter = string.Format("WelderBelongEmployerHPID='{0}'", this.myEventArgs_Unit.EmployerHPID); } } else { str_Filter = string.Format("WelderBelongDepartmentHPID='{0}'", this.myEventArgs_Unit.DepartmentHPID); } } else { str_Filter = string.Format("WelderBelongWorkPlaceHPID='{0}'", this.myEventArgs_Unit.WorkPlaceHPID); } if (bool_Refresh) { myClass_Data.SetFilter(str_Filter); if (this.myEventArgs_Unit.bool_JustFill) { if (this.myDataTable.Rows.Count == 0) { this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_Unit.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; } else { myClass_Data.RefreshData(this.myEventArgs_Unit.bool_JustFill, this.myDataTable); } } else { this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_Unit.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; } } else { if (this.myDataTable == null) { myClass_Data.SetFilter("1=1"); this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_Unit.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; } else { } ((DataView)this.dataGridView_Data.DataSource).RowFilter = str_Filter; } if (string.IsNullOrEmpty(((DataView)this.dataGridView_Data.DataSource).Sort)) { ((DataView)this.dataGridView_Data.DataSource).Sort = myClass_Data.myDataView.Sort; } this.label_Data.Text = string.Format("焊工信息,({0}):", this.dataGridView_Data.RowCount); if (this.dataGridView_Data.RowCount == 0) { EventArgs_WelderBelong my_e = new EventArgs_WelderBelong(""); Publisher_WelderBelong.OnEventName(my_e); } }
/// <summary> /// 初始化数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InitDataGridView(object sender, EventArgs_Unit e) { if (e == null) { return; } this.myEventArgs_Unit = e; Class_DataControlBind.InitializeDataGridView(this.dataGridView_Data, Enum_DataTable.WelderBelongExam.ToString(), false); Class_Data myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.WelderBelongQC.ToString()]; string str_Filter; string str_FilterShipClassification; if (string.IsNullOrEmpty(this.myEventArgs_Unit.WorkPlaceHPID)) { if (string.IsNullOrEmpty(this.myEventArgs_Unit.DepartmentHPID)) { if (string.IsNullOrEmpty(this.myEventArgs_Unit.EmployerHPID)) { if (string.IsNullOrEmpty(this.myEventArgs_Unit.EmployerGroup)) { str_Filter = string.Format("1=1"); } else { str_Filter = string.Format("WelderBelongEmployerGroup='{0}'", this.myEventArgs_Unit.EmployerGroup); } } else { str_Filter = string.Format("WelderBelongEmployerHPID='{0}'", this.myEventArgs_Unit.EmployerHPID); } } else { str_Filter = string.Format("WelderBelongDepartmentHPID='{0}'", this.myEventArgs_Unit.DepartmentHPID); } } else { str_Filter = string.Format("WelderBelongWorkPlaceHPID='{0}'", this.myEventArgs_Unit.WorkPlaceHPID); } //str_Filter += string .Format (" And isQCValid =1");//已在数据库视图中设置 if (string.IsNullOrEmpty(this.str_ShipClassificationAb)) { str_FilterShipClassification = "1=1"; } else { str_FilterShipClassification = string.Format("ShipClassificationAb = '{0}'", this.str_ShipClassificationAb); if (string.IsNullOrEmpty(this.str_ShipboardNo)) { } else { str_FilterShipClassification += string.Format(" And ShipboardNo = '{0}'", this.str_ShipboardNo); } } DateTime myDataTime_Begin; switch (this.str_KindofQC) { case "全部证书": str_FilterShipClassification += string.Format(" And isQCValid=1 And ValidUntil>=#{0}#", DateTime.Now); break; case "签证证书": string str_FilterSupervision; str_FilterSupervision = string.Format("(IssuedOnMonth - SupervisionCycle*48 - {0})%6=0 and (IssuedOnMonth - {0}>0) And (not (ProlongQCContinuous=0 and PeriodofProlongation>0 and ValidUntil<#{1}#))", Class_ExamField.SupervisionOffset, DateTime.Today.AddMonths(3)); str_FilterShipClassification += string.Format(" And isQCValid=1 And ValidUntil>=#{0}# And ({1})", DateTime.Now.Date.AddDays(0 - DateTime.Now.Day).AddMonths(0 - Class_ExamField.SupervisionOffset), str_FilterSupervision); break; case "延期证书": myDataTime_Begin = DateTime.Now.Date.AddDays(1 - DateTime.Now.Day).AddMonths(0 - Class_ExamField.SupervisionOffset); str_FilterShipClassification += string.Format(" And isQCValid=1 And (ProlongQCContinuous=1 or (ProlongQCContinuous=0 and PeriodofProlongation=0)) And ValidUntil>=#{0}# And ValidUntil<#{1}#", myDataTime_Begin.AddDays(-1), myDataTime_Begin.AddMonths(1).AddDays(-1)); break; case "复训证书": myDataTime_Begin = DateTime.Now.Date.AddDays(1 - DateTime.Now.Day).AddMonths(0 - Class_ExamField.QCRegain); str_FilterShipClassification += string.Format(" And isQCValid=1 And ProlongQCContinuous=0 and PeriodofProlongation>0 And ValidUntil>=#{0}# And ValidUntil<#{1}#", myDataTime_Begin, myDataTime_Begin.AddMonths(1)); break; case "失效证书": str_FilterShipClassification += string.Format(" And ((ValidUntil>=#{0}# And ValidUntil<#{1}#) Or (isQCValid = 0 and ValidUntil>#{1}#))", DateTime.Now.AddMonths(-12), DateTime.Now); break; } str_Filter = string.Format("({0}) And ({1})", str_Filter, str_FilterShipClassification); if (bool_Refresh) { myClass_Data.SetFilter(str_Filter); if (this.myEventArgs_Unit.bool_JustFill) { if (this.myDataTable.Rows.Count == 0) { this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_Unit.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; } else { myClass_Data.RefreshData(this.myEventArgs_Unit.bool_JustFill, this.myDataTable); } } else { this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_Unit.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; } } else { if (this.myDataTable == null) { myClass_Data.SetFilter("1=1"); this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_Unit.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; } ((DataView)this.dataGridView_Data.DataSource).RowFilter = str_Filter; } if (string.IsNullOrEmpty(((DataView)this.dataGridView_Data.DataSource).Sort)) { ((DataView)this.dataGridView_Data.DataSource).Sort = myClass_Data.myDataView.Sort; } this.label_Data.Text = string.Format("焊工证书,({0}):", this.dataGridView_Data.RowCount); this.toolStripStatusLabel_ShipClassificationAb.Text = string.Format("船级社:{0}", this.str_ShipClassificationAb); this.toolStripStatusLabel_ShipboardNo.Text = string.Format("船舶系列:{0}", this.str_ShipboardNo); this.toolStripStatusLabel_KindofQC.Text = this.str_KindofQC; }