private void InitTreeView() { this.treeView_Data.Nodes.Clear(); TreeNode myTreeNode; TreeNode myTreeNode_KindofEmployer; myTreeNode = new TreeNode(); myTreeNode.Text = "报考单位"; myTreeNode.Tag = "报考单位"; Class_Data myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.KindofEmployer.ToString()]; foreach (DataRowView myDataRowView_KindofEmployer in myClass_Data.myDataView) { myTreeNode_KindofEmployer = new TreeNode(); myTreeNode_KindofEmployer.Text = myDataRowView_KindofEmployer["KindofEmployer"].ToString(); myTreeNode_KindofEmployer.Tag = myDataRowView_KindofEmployer["KindofEmployer"].ToString(); if (Class_CustomUser.GetSecurity(Class_zwjPublic.myClass_CustomUser.UserGUID, Class_CustomSecurity.GetSecurityGUID("焊工权限"), Enum_zwjKindofUpdate.Read)) { myTreeNode.Nodes.Add(myTreeNode_KindofEmployer); } else if (Class_CustomUser.GetSecurity(Class_zwjPublic.myClass_CustomUser.UserGUID, Class_CustomSecurity.GetSecurityGUID("报考权限"), Enum_zwjKindofUpdate.Read)) { Class_KindofEmployer myClass_KindofEmployer = new Class_KindofEmployer(myDataRowView_KindofEmployer["KindofEmployer"].ToString()); if (myClass_KindofEmployer.KindofEmployerManagerID.Equals(Class_zwjPublic.myClass_CustomUser.UserGUID)) { myTreeNode.Nodes.Add(myTreeNode_KindofEmployer); } } } this.treeView_Data.Nodes.Add(myTreeNode); this.label_Data.Text = string.Format("报考单位:({0})", myTreeNode.Nodes.Count); }
private void button_OnOK_Click(object sender, EventArgs e) { this.userControl_KindofEmployerBase1.FillClass(); String str_ErrMessage; str_ErrMessage = myClass_KindofEmployer.CheckField(); if (!string.IsNullOrEmpty(str_ErrMessage)) { this.DialogResult = DialogResult.None; this.label_ErrMessage.Text = str_ErrMessage; return; } if (this.bool_Add) { if (!Class_KindofEmployer.ExistAndCanDeleteAndDelete(this.myClass_KindofEmployer.KindofEmployer, Enum_zwjKindofUpdate.Exist)) { this.myClass_KindofEmployer.AddAndModify(Enum_zwjKindofUpdate.Add); } else { this.label_ErrMessage.Text = "该报考单位已添加!"; this.DialogResult = DialogResult.None; return; } } else { this.myClass_KindofEmployer.AddAndModify(Enum_zwjKindofUpdate.Modify); } this.DialogResult = DialogResult.OK; this.Close(); }
private void toolStripMenuItem_RowSynchronization_Click(object sender, EventArgs e) { Form_Welder_Synchronization myForm = new Form_Welder_Synchronization(); Class_KindofEmployer myClass_KindofEmployer = new Class_KindofEmployer(this.myEventArgs_KindofEmployer.str_KindofEmployer); myForm.myClass_KindofEmployer = myClass_KindofEmployer; myForm.ShowDialog(); if (myForm.bool_Updated) { this.RefreshData(false); } }
/// <summary> /// 初始化数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InitDataGridView(object sender, EventArgs_KindofEmployer e) { Class_DataControlBind.InitializeDataGridView(this.dataGridView_Exam, Enum_DataTable.IssueStudentQCRegistrationNo.ToString(), false); this.myEventArgs_KindofEmployer = e; Class_DataControlBind.InitializeDataGridView(this.dataGridView_Data, Enum_DataTable.KindofEmployerWelder.ToString(), false); Class_Data myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.KindofEmployerWelder.ToString()]; myClass_Data.SetFilter(string.Format("KindofEmployer='{0}'", this.myEventArgs_KindofEmployer.str_KindofEmployer)); if (this.myEventArgs_KindofEmployer.bool_JustFill) { if (this.myDataTable.Rows.Count == 0) { this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_KindofEmployer.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_KindofEmployer.bool_JustFill, this.myDataTable); } } else { this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_KindofEmployer.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; } 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.CurrentRow == null) { this.dataGridView_Exam.DataSource = null; this.label_Exam.Text = "考试记录:"; this.userControl_WelderPictureBase1.InitWelderPicture(null); } Class_KindofEmployer myClass_KindofEmployer = new Class_KindofEmployer(e.str_KindofEmployer); this.userControl_WelderPictureBase1.button_UploadPicture.Visible = myClass_KindofEmployer.CanUpLoadWelderPicture; this.userControl_WelderPictureBase1.button_DeletePicture.Visible = myClass_KindofEmployer.CanDeleteWelderPicture; this.userControl_WelderPictureBase1.bool_CanModifyWelderPicture = myClass_KindofEmployer.CanModifyWelderPicture; }
/// <summary> /// 更新数据到对象中 /// </summary> public void FillClass() { myClass_KindofEmployer.KindofEmployer = this.TextBox_KindofEmployer.Text; myClass_KindofEmployer.KindofEmployerLevel = (int)this.NumericUpDown_KindofEmployerLevel.Value; if (!string.IsNullOrEmpty(this.textBox_KindofEmployerManager.Text)) { this.myClass_KindofEmployer.KindofEmployerManagerID = new Guid((this.textBox_KindofEmployerManager.Text.Split(':'))[1]); } myClass_KindofEmployer.KindofEmployerEmployerHPID = this.ComboBox_Employer.SelectedValue.ToString(); if (this.CheckBox_Department.Checked && this.ComboBox_Department.SelectedValue != null) { myClass_KindofEmployer.KindofEmployerDepartmentHPID = this.ComboBox_Department.SelectedValue.ToString(); if (this.CheckBox_WorkPlace.Checked && this.ComboBox_WorkPlace.SelectedValue != null) { myClass_KindofEmployer.KindofEmployerWorkPlaceHPID = this.ComboBox_WorkPlace.SelectedValue.ToString(); } else { myClass_KindofEmployer.KindofEmployerWorkPlaceHPID = ""; } } else { myClass_KindofEmployer.KindofEmployerDepartmentHPID = ""; } if (this.CheckBox_LaborServiceTeam.Checked && this.ComboBox_LaborServiceTeam.SelectedValue != null) { myClass_KindofEmployer.KindofEmployerLaborServiceTeamHPID = this.ComboBox_LaborServiceTeam.SelectedValue.ToString(); } else { myClass_KindofEmployer.KindofEmployerLaborServiceTeamHPID = ""; } myClass_KindofEmployer.CanUpLoadWelderPicture = this.checkBox_CanUpLoadWelderPicture.Checked; myClass_KindofEmployer.CanModifyWelderPicture = this.checkBox_CanModifyWelderPicture.Checked; myClass_KindofEmployer.CanDeleteWelderPicture = this.checkBox_CanDeleteWelderPicture.Checked; myClass_KindofEmployer.KindofEmployerIndex = (int)this.numericUpDown_KindofEmployerIndex.Value; myClass_KindofEmployer.KindofEmployerRemark = this.TextBox_KindofEmployerRemark.Text; myClass_KindofEmployer.KindofEmployerTel = this.textBox_EmployerTel.Text; myClass_KindofEmployer.KindofEmployerFax = this.textBox_EmployerFax.Text; myClass_KindofEmployer.KindofEmployerMobile = this.textBox_EmployerMobile.Text; myClass_KindofEmployer.KindofEmployerEmail = this.textBox_EmployerEmail.Text; if (myClass_KindofEmployerDefault == null) { myClass_KindofEmployerDefault = new Class_KindofEmployer(); } }
private void Form_KindofEmployerUpdate_Load(object sender, EventArgs e) { if (!(this.bool_Add || Class_KindofEmployer.ExistAndCanDeleteAndDelete(myClass_KindofEmployer.KindofEmployer, Enum_zwjKindofUpdate.Exist))) { MessageBox.Show("不存在该项,可能已删除!"); this.DialogResult = DialogResult.Cancel; this.Close(); return; } this.label_ErrMessage.Text = ""; if (!Class_zwjPublic.myBackColor.IsEmpty) { this.BackColor = Class_zwjPublic.myBackColor; } this.userControl_KindofEmployerBase1.InitControl(this.myClass_KindofEmployer, this.bool_Add); }
private void Button_KindofEmployerModify_Click(object sender, EventArgs e) { string str_NewKindofEmployer = ""; Form_InputBox myForm = new Form_InputBox(); myForm.str_DefaultResponse = this.myClass_KindofEmployer.KindofEmployer; myForm.str_Prompt = "请输入报考单位名称:"; myForm.str_Title = "输入报考单位名称"; if (myForm.ShowDialog() == DialogResult.OK) { str_NewKindofEmployer = myForm.str_DefaultResponse; } else { return; } if (Class_KindofEmployer.ExistAndCanDeleteAndDelete(str_NewKindofEmployer, ZCCL.ClassBase.Enum_zwjKindofUpdate.Exist) == true) { MessageBox.Show("报考单位名称重复,操作失败!"); return; } this.myClass_KindofEmployer.KindofEmployerModify(str_NewKindofEmployer); this.userControl_KindofEmployerBase1.InitControl(this.myClass_KindofEmployer, false); }
public void InitControl(Class_KindofEmployerIssue myClass_KindofEmployerIssue, bool bool_Add) { Class_Data myClass_ShipandShipClassification = (Class_Data)Class_Public.myHashtable[Enum_DataTable.ShipandShipClassification.ToString()]; myDataView_ShipandShipClassification = new DataView(myClass_ShipandShipClassification.myDataTable); myDataView_ShipandShipClassification.Sort = myClass_ShipandShipClassification.myDataView.Sort; Class_DataControlBind.InitializeComboBox(this.comboBox_ShipboardNo, this.myDataView_ShipandShipClassification, "ShipboardNo", "ShipboardNo"); Class_Public.InitializeComboBox(this.comboBox_Employer, Enum_DataTable.Employer.ToString(), "EmployerHPID", "Employer"); Class_Public.InitializeComboBox(this.comboBox_ShipClassificationAb, Enum_DataTable.ShipClassification.ToString(), "ShipClassificationAb", "ShipClassificationAb"); Class_Public.InitializeComboBox(this.ComboBox_Assemblage, Enum_DataTable.Assemblage.ToString(), "Assemblage", "Assemblage"); Class_Public.InitializeComboBox(this.ComboBox_KindofExam, Enum_DataTable.KindofExam.ToString(), "KindofExam", "KindofExam"); Class_Public.InitializeComboBox(this.ComboBox_WeldingProcess, Enum_DataTable.WeldingProcess.ToString(), "WeldingProcessAb", "WeldingProcessAb"); this.myClass_KindofEmployerIssue = myClass_KindofEmployerIssue; this.textBox_KindofEmployer.Text = this.myClass_KindofEmployerIssue.KindofEmployer; Class_KindofEmployer myClass_KindofEmployer = new Class_KindofEmployer(this.myClass_KindofEmployerIssue.KindofEmployer); switch (myClass_KindofEmployer.KindofEmployerLevel) { case 0: break; case 1: case 2: case 3: case 4: this.comboBox_Employer.Enabled = false; break; } if (bool_Add) { if (!string.IsNullOrEmpty(myClass_KindofEmployer.KindofEmployerEmployerHPID)) { this.comboBox_Employer.SelectedValue = myClass_KindofEmployer.KindofEmployerEmployerHPID; } if (myClass_KindofEmployerIssueDefault != null) { this.InitControlWeldingParameter(myClass_KindofEmployerIssueDefault.myClass_WeldingParameter); this.ComboBox_WeldingProcess.SelectedValue = myClass_KindofEmployerIssueDefault.WeldingProcessAb; if (this.comboBox_Employer.Enabled) { this.comboBox_Employer.SelectedValue = myClass_KindofEmployerIssueDefault.EmployerHPID; } this.myClass_KindofEmployerIssue.EmployerHPID = myClass_KindofEmployerIssueDefault.EmployerHPID; this.comboBox_ShipClassificationAb.SelectedValue = myClass_KindofEmployerIssueDefault.ShipClassificationAb; this.comboBox_ShipboardNo.SelectedValue = myClass_KindofEmployerIssueDefault.ShipboardNo; } } else { this.textBox_KindofEmployerIssueID.Text = this.myClass_KindofEmployerIssue.KindofEmployerIssueID.ToString(); this.MaskedTextBox_IssueNo.Text = myClass_KindofEmployerIssue.IssueNo; this.textBox_WPSNo.Text = myClass_KindofEmployerIssue.IssueWPSNo; this.TextBox_IssueRemark.Text = myClass_KindofEmployerIssue.IssueRemark; this.DateTimePicker_SignUpDate.Value = myClass_KindofEmployerIssue.SignUpDate; this.textBox_KindofEmployer.Text = myClass_KindofEmployerIssue.KindofEmployer; this.comboBox_Employer.SelectedValue = myClass_KindofEmployerIssue.EmployerHPID; this.ComboBox_WeldingProcess.SelectedValue = myClass_KindofEmployerIssue.WeldingProcessAb; this.comboBox_ShipClassificationAb.SelectedValue = this.myClass_KindofEmployerIssue.ShipClassificationAb; this.comboBox_ShipboardNo.SelectedValue = this.myClass_KindofEmployerIssue.ShipboardNo; this.InitControlWeldingParameter(this.myClass_KindofEmployerIssue.myClass_WeldingParameter); } }
/// <summary> /// 初始化数据 /// </summary> /// <param name="myClass_KindofEmployerWelder"></param> /// <param name="bool_Add"></param> public void InitControl(Class_KindofEmployerWelder myClass_KindofEmployerWelder, bool bool_Add) { Class_Data myClass_Data; myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.Employer.ToString()]; this.myDataView_Employer = new DataView(myClass_Data.myDataTable); this.myDataView_Employer.Sort = myClass_Data.myDataView.Sort; myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.Department.ToString()]; this.myDataView_Department = new DataView(myClass_Data.myDataTable); this.myDataView_Department.Sort = myClass_Data.myDataView.Sort; myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.WorkPlace.ToString()]; this.myDataView_WorkPlace = new DataView(myClass_Data.myDataTable); this.myDataView_WorkPlace.Sort = myClass_Data.myDataView.Sort; myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.LaborServiceTeam.ToString()]; this.myDataView_LaborServiceTeam = new DataView(myClass_Data.myDataTable); this.myDataView_LaborServiceTeam.Sort = myClass_Data.myDataView.Sort; Class_DataControlBind.InitializeComboBox(this.ComboBox_LaborServiceTeam, this.myDataView_LaborServiceTeam, "LaborServiceTeamHPID", "LaborServiceTeam"); Class_DataControlBind.InitializeComboBox(this.ComboBox_WorkPlace, this.myDataView_WorkPlace, "WorkPlaceHPID", "WorkPlace"); Class_DataControlBind.InitializeComboBox(this.ComboBox_Department, this.myDataView_Department, "DepartmentHPID", "Department"); Class_DataControlBind.InitializeComboBox(this.ComboBox_Employer, this.myDataView_Employer, "EmployerHPID", "Employer"); Class_Public.InitializeComboBox(this.ComboBox_Schooling, Enum_DataTable.Schooling.ToString(), "Schooling", "Schooling"); this.myClass_KindofEmployerWelder = myClass_KindofEmployerWelder; this.textBox_KindofEmployer.Text = this.myClass_KindofEmployerWelder.KindofEmployer; Class_KindofEmployer myClass_KindofEmployer = new Class_KindofEmployer(this.myClass_KindofEmployerWelder.KindofEmployer); switch (myClass_KindofEmployer.KindofEmployerLevel) { case 0: break; case 1: this.ComboBox_Employer.Enabled = false; break; case 2: this.ComboBox_Employer.Enabled = false; this.ComboBox_Department.Enabled = false; this.CheckBox_Department.Enabled = false; break; case 3: this.ComboBox_Employer.Enabled = false; this.ComboBox_Department.Enabled = false; this.CheckBox_Department.Enabled = false; this.ComboBox_WorkPlace.Enabled = false; this.CheckBox_WorkPlace.Enabled = false; break; case 4: this.ComboBox_Employer.Enabled = false; this.ComboBox_LaborServiceTeam.Enabled = false; this.CheckBox_LaborServiceTeam.Enabled = false; break; } if (bool_Add) { if (!string.IsNullOrEmpty(myClass_KindofEmployer.KindofEmployerEmployerHPID)) { this.ComboBox_Employer.SelectedValue = myClass_KindofEmployer.KindofEmployerEmployerHPID; if (!string.IsNullOrEmpty(myClass_KindofEmployer.KindofEmployerDepartmentHPID)) { this.ComboBox_Department.SelectedValue = myClass_KindofEmployer.KindofEmployerDepartmentHPID; if (!string.IsNullOrEmpty(myClass_KindofEmployer.KindofEmployerWorkPlaceHPID)) { this.ComboBox_WorkPlace.SelectedValue = myClass_KindofEmployer.KindofEmployerWorkPlaceHPID; } } if (!string.IsNullOrEmpty(myClass_KindofEmployer.KindofEmployerLaborServiceTeamHPID)) { this.ComboBox_LaborServiceTeam.SelectedValue = myClass_KindofEmployer.KindofEmployerLaborServiceTeamHPID; } } if (myClass_KindofEmployerWelderDefault != null) { this.CheckBox_Sex.Checked = myClass_KindofEmployerWelderDefault.Sex == "男"; this.DateTimePicker_WeldingBeinning.Value = myClass_KindofEmployerWelderDefault.WeldingBeginning; this.ComboBox_Schooling.SelectedValue = myClass_KindofEmployerWelderDefault.Schooling; this.ComboBox_Employer.SelectedValue = myClass_KindofEmployerWelderDefault.myClass_BelongUnit.EmployerHPID; this.myDataView_Department.RowFilter = string.Format("EmployerHPID='{0}'", myClass_KindofEmployerWelderDefault.myClass_BelongUnit.EmployerHPID); this.myDataView_LaborServiceTeam.RowFilter = string.Format("EmployerHPID='{0}'", myClass_KindofEmployerWelderDefault.myClass_BelongUnit.EmployerHPID); if (string.IsNullOrEmpty(myClass_KindofEmployerWelderDefault.myClass_BelongUnit.DepartmentHPID)) { this.CheckBox_Department.Checked = false; } else { this.ComboBox_Department.SelectedValue = myClass_KindofEmployerWelderDefault.myClass_BelongUnit.DepartmentHPID; this.CheckBox_Department.Checked = true; this.myDataView_WorkPlace.RowFilter = string.Format("DepartmentHPID='{0}'", myClass_KindofEmployerWelderDefault.myClass_BelongUnit.DepartmentHPID); if (!string.IsNullOrEmpty(myClass_KindofEmployerWelderDefault.myClass_BelongUnit.WorkPlaceHPID)) { this.ComboBox_WorkPlace.SelectedValue = myClass_KindofEmployerWelderDefault.myClass_BelongUnit.WorkPlaceHPID; this.CheckBox_WorkPlace.Checked = true; } else { this.CheckBox_WorkPlace.Checked = false; } } if (string.IsNullOrEmpty(myClass_KindofEmployerWelderDefault.myClass_BelongUnit.LaborServiceTeamHPID)) { this.CheckBox_LaborServiceTeam.Checked = false; } else { this.ComboBox_LaborServiceTeam.SelectedValue = myClass_KindofEmployerWelderDefault.myClass_BelongUnit.LaborServiceTeamHPID; this.CheckBox_LaborServiceTeam.Checked = true; } } } else { this.textBox_KindofEmployerWelderID.Text = this.myClass_KindofEmployerWelder.KindofEmployerWelderID.ToString(); this.Button_IdentificationCardConvert.Enabled = false; this.MaskedTextBox_IdentificationCard.Text = myClass_KindofEmployerWelder.IdentificationCard; this.TextBox_WelderName.Text = myClass_KindofEmployerWelder.WelderName; this.textBox_WelderEnglishName.Text = myClass_KindofEmployerWelder.WelderEnglishName; this.CheckBox_Sex.Checked = myClass_KindofEmployerWelder.Sex == "男"; this.DateTimePicker_WeldingBeinning.Value = myClass_KindofEmployerWelder.WeldingBeginning; this.TextBox_WorkerID.Text = myClass_KindofEmployerWelder.myClass_BelongUnit.WorkerID; this.TextBox_WelderRemark.Text = myClass_KindofEmployerWelder.WelderRemark; this.ComboBox_Schooling.SelectedValue = myClass_KindofEmployerWelder.Schooling; this.ComboBox_Employer.SelectedValue = myClass_KindofEmployerWelder.myClass_BelongUnit.EmployerHPID; this.myDataView_Department.RowFilter = string.Format("EmployerHPID='{0}'", myClass_KindofEmployerWelder.myClass_BelongUnit.EmployerHPID); this.myDataView_LaborServiceTeam.RowFilter = string.Format("EmployerHPID='{0}'", myClass_KindofEmployerWelder.myClass_BelongUnit.EmployerHPID); if (string.IsNullOrEmpty(myClass_KindofEmployerWelder.myClass_BelongUnit.DepartmentHPID)) { this.CheckBox_Department.Checked = false; } else { this.ComboBox_Department.SelectedValue = myClass_KindofEmployerWelder.myClass_BelongUnit.DepartmentHPID; this.CheckBox_Department.Checked = true; this.myDataView_WorkPlace.RowFilter = string.Format("DepartmentHPID='{0}'", myClass_KindofEmployerWelder.myClass_BelongUnit.DepartmentHPID); if (!string.IsNullOrEmpty(myClass_KindofEmployerWelder.myClass_BelongUnit.WorkPlaceHPID)) { this.ComboBox_WorkPlace.SelectedValue = myClass_KindofEmployerWelder.myClass_BelongUnit.WorkPlaceHPID; this.CheckBox_WorkPlace.Checked = true; } else { this.CheckBox_WorkPlace.Checked = false; } } if (string.IsNullOrEmpty(myClass_KindofEmployerWelder.myClass_BelongUnit.LaborServiceTeamHPID)) { this.CheckBox_LaborServiceTeam.Checked = false; } else { this.ComboBox_LaborServiceTeam.SelectedValue = myClass_KindofEmployerWelder.myClass_BelongUnit.LaborServiceTeamHPID; this.CheckBox_LaborServiceTeam.Checked = true; } } }
/// <summary> /// 初始化数据 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void InitDataGridView(object sender, EventArgs_ShipClassification e) { this.myEventArgs_ShipClassification = e; string str_Filter; if (!string.IsNullOrEmpty(this.myEventArgs_ShipClassification.str_ShipClassificationAb)) { str_Filter = string.Format("ShipClassificationAb='{0}'", this.myEventArgs_ShipClassification.str_ShipClassificationAb); if (!string.IsNullOrEmpty(this.myEventArgs_ShipClassification.str_ShipboardNo)) { str_Filter += string.Format(" And ShipboardNo='{0}'", this.myEventArgs_ShipClassification.str_ShipboardNo); //if (this.myEventArgs_ShipClassification.bool_GXTheory) //{ // Class_DataControlBind.InitializeDataGridView(this.dataGridView_Data, Enum_DataTable.GXTheoryIssue.ToString()); // myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.GXTheoryIssue.ToString()]; //} } else if (!string.IsNullOrEmpty(this.myEventArgs_ShipClassification.str_Year)) { str_Filter += string.Format(" And (SignUpDate >= '{0}-1-1' and SignUpDate<='{0}-12-31 23:59:59.997')", this.myEventArgs_ShipClassification.str_Year); } } else { str_Filter = this.myEventArgs_ShipClassification.str_Filter; } Class_Data myClass_Data; if (this.myEventArgs_ShipClassification.bool_GXTheory) { Class_DataControlBind.InitializeDataGridView(this.dataGridView_Data, Enum_DataTable.GXTheoryIssue.ToString(), false); myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.GXTheoryIssue.ToString()]; } else { Class_DataControlBind.InitializeDataGridView(this.dataGridView_Data, Enum_DataTable.Issue.ToString(), false); myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.Issue.ToString()]; } if (Class_CustomUser.GetSecurity(Class_zwjPublic.myClass_CustomUser.UserGUID, Class_CustomSecurity.GetSecurityGUID("焊工权限"), Enum_zwjKindofUpdate.Read)) { } else if (Class_CustomUser.GetSecurity(Class_zwjPublic.myClass_CustomUser.UserGUID, Class_CustomSecurity.GetSecurityGUID("报考权限"), Enum_zwjKindofUpdate.Read)) { Class_Data myClass_Data_KindofEmployer = (Class_Data)Class_Public.myHashtable[Enum_DataTable.KindofEmployer.ToString()]; string str_Filter_KindofEmployer = "(1=0"; foreach (DataRowView myDataRowView_KindofEmployer in myClass_Data_KindofEmployer.myDataView) { Class_KindofEmployer myClass_KindofEmployer = new Class_KindofEmployer(myDataRowView_KindofEmployer["KindofEmployer"].ToString()); if (myClass_KindofEmployer.KindofEmployerManagerID.Equals(Class_zwjPublic.myClass_CustomUser.UserGUID)) { str_Filter_KindofEmployer += string.Format(" or KindofEmployer='{0}'", myClass_KindofEmployer.KindofEmployer); } } str_Filter_KindofEmployer += ")"; str_Filter = str_Filter_KindofEmployer + " and (" + str_Filter + ")"; } myClass_Data.SetFilter(str_Filter); if (this.myEventArgs_ShipClassification.bool_JustFill) { if (this.myDataTable.Rows.Count == 0) { this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_ShipClassification.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; if (this.dataGridView_Data.Rows.Count > 0) { this.dataGridView_Data.CurrentCell = this.dataGridView_Data.Rows[this.dataGridView_Data.Rows.Count - 1].Cells["IssueNo"]; } } else { myClass_Data.RefreshData(this.myEventArgs_ShipClassification.bool_JustFill, this.myDataTable); } } else { this.dataGridView_Data.DataSource = null; myClass_Data.RefreshData(this.myEventArgs_ShipClassification.bool_JustFill); this.myDataTable = myClass_Data.myDataTable.Copy(); this.myDataView = new DataView(this.myDataTable); this.dataGridView_Data.DataSource = this.myDataView; if (this.dataGridView_Data.Rows.Count > 0) { this.dataGridView_Data.CurrentCell = this.dataGridView_Data.Rows[this.dataGridView_Data.Rows.Count - 1].Cells["IssueNo"]; } } 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_Issue my_e = new EventArgs_Issue(null, this.myEventArgs_ShipClassification.bool_GXTheory); Publisher_Issue.OnEventName(my_e); } }
/// <summary> /// 初始化数据 /// </summary> /// <param name="myKindofEmployer"></param> /// <param name="bool_Add"></param> public void InitControl(Class_KindofEmployer myClass_KindofEmployer, bool bool_Add) { Class_Data myClass_Data; myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.Employer.ToString()]; this.myDataView_Employer = new DataView(myClass_Data.myDataTable); this.myDataView_Employer.Sort = myClass_Data.myDataView.Sort; myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.Department.ToString()]; this.myDataView_Department = new DataView(myClass_Data.myDataTable); this.myDataView_Department.Sort = myClass_Data.myDataView.Sort; myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.WorkPlace.ToString()]; this.myDataView_WorkPlace = new DataView(myClass_Data.myDataTable); this.myDataView_WorkPlace.Sort = myClass_Data.myDataView.Sort; myClass_Data = (Class_Data)Class_Public.myHashtable[Enum_DataTable.LaborServiceTeam.ToString()]; this.myDataView_LaborServiceTeam = new DataView(myClass_Data.myDataTable); this.myDataView_LaborServiceTeam.Sort = myClass_Data.myDataView.Sort; Class_DataControlBind.InitializeComboBox(this.ComboBox_LaborServiceTeam, this.myDataView_LaborServiceTeam, "LaborServiceTeamHPID", "LaborServiceTeam"); Class_DataControlBind.InitializeComboBox(this.ComboBox_WorkPlace, this.myDataView_WorkPlace, "WorkPlaceHPID", "WorkPlace"); Class_DataControlBind.InitializeComboBox(this.ComboBox_Department, this.myDataView_Department, "DepartmentHPID", "Department"); Class_DataControlBind.InitializeComboBox(this.ComboBox_Employer, this.myDataView_Employer, "EmployerHPID", "Employer"); this.myClass_KindofEmployer = myClass_KindofEmployer; if (bool_Add) { if (myClass_KindofEmployerDefault != null) { this.TextBox_KindofEmployer.Text = myClass_KindofEmployerDefault.KindofEmployer; } } else { this.TextBox_KindofEmployer.ReadOnly = true; this.TextBox_KindofEmployer.Text = myClass_KindofEmployer.KindofEmployer; Class_CustomUser myClass_CustomUser = new Class_CustomUser(); myClass_CustomUser.UserGUID = this.myClass_KindofEmployer.KindofEmployerManagerID; if (myClass_CustomUser.FillData()) { this.textBox_KindofEmployerManager.Text = string.Format("{0}:{1}", myClass_CustomUser.Name, myClass_CustomUser.UserGUID.ToString()); } if (myClass_KindofEmployer.KindofEmployerLevel >= this.NumericUpDown_KindofEmployerLevel.Minimum && myClass_KindofEmployer.KindofEmployerLevel <= this.NumericUpDown_KindofEmployerLevel.Maximum) { this.NumericUpDown_KindofEmployerLevel.Value = myClass_KindofEmployer.KindofEmployerLevel; } this.ComboBox_Employer.SelectedValue = myClass_KindofEmployer.KindofEmployerEmployerHPID; this.myDataView_Department.RowFilter = string.Format("EmployerHPID='{0}'", myClass_KindofEmployer.KindofEmployerEmployerHPID); this.myDataView_LaborServiceTeam.RowFilter = string.Format("EmployerHPID='{0}'", myClass_KindofEmployer.KindofEmployerEmployerHPID); if (string.IsNullOrEmpty(myClass_KindofEmployer.KindofEmployerDepartmentHPID)) { this.CheckBox_Department.Checked = false; this.CheckBox_WorkPlace.Checked = false; } else { this.ComboBox_Department.SelectedValue = myClass_KindofEmployer.KindofEmployerDepartmentHPID; this.CheckBox_Department.Checked = true; this.myDataView_WorkPlace.RowFilter = string.Format("DepartmentHPID='{0}'", myClass_KindofEmployer.KindofEmployerDepartmentHPID); if (!string.IsNullOrEmpty(myClass_KindofEmployer.KindofEmployerWorkPlaceHPID)) { this.ComboBox_WorkPlace.SelectedValue = myClass_KindofEmployer.KindofEmployerWorkPlaceHPID; this.CheckBox_WorkPlace.Checked = true; } else { this.CheckBox_WorkPlace.Checked = false; } } if (string.IsNullOrEmpty(myClass_KindofEmployer.KindofEmployerLaborServiceTeamHPID)) { this.CheckBox_LaborServiceTeam.Checked = false; } else { this.ComboBox_LaborServiceTeam.SelectedValue = myClass_KindofEmployer.KindofEmployerLaborServiceTeamHPID; this.CheckBox_LaborServiceTeam.Checked = true; } this.checkBox_CanUpLoadWelderPicture.Checked = myClass_KindofEmployer.CanUpLoadWelderPicture; this.checkBox_CanModifyWelderPicture.Checked = myClass_KindofEmployer.CanModifyWelderPicture; this.checkBox_CanDeleteWelderPicture.Checked = myClass_KindofEmployer.CanDeleteWelderPicture; this.numericUpDown_KindofEmployerIndex.Value = this.myClass_KindofEmployer.KindofEmployerIndex; this.TextBox_KindofEmployerRemark.Text = myClass_KindofEmployer.KindofEmployerRemark; this.textBox_EmployerTel.Text = myClass_KindofEmployer.KindofEmployerTel; this.textBox_EmployerFax.Text = myClass_KindofEmployer.KindofEmployerFax; this.textBox_EmployerMobile.Text = myClass_KindofEmployer.KindofEmployerMobile; this.textBox_EmployerEmail.Text = myClass_KindofEmployer.KindofEmployerEmail; } }
private void toolStripMenuItem_RowSynchronizationhdhr_Click(object sender, EventArgs e) { if (MessageBox.Show("确认同步用友数据吗?", "确认窗口", MessageBoxButtons.OKCancel) != DialogResult.OK) { return; } string str_SQL = "SELECT docname FROM [hdhr].[dbo].[v_defdoc_xueli]"; SqlDataAdapter myAdapter = new SqlDataAdapter(str_SQL, Properties.Settings.Default.zwjConnhdhr); DataTable myDataTable_xueli = new DataTable(); myAdapter.Fill(myDataTable_xueli); Class_Schooling myClass_Schooling = new Class_Schooling(); foreach (DataRow myDataRow in myDataTable_xueli.Rows) { if (!Class_Schooling.ExistAndCanDeleteAndDelete(myDataRow["docname"].ToString(), Enum_zwjKindofUpdate.Exist)) { myClass_Schooling.Schooling = myDataRow["docname"].ToString(); myClass_Schooling.AddAndModify(Enum_zwjKindofUpdate.Add); } } str_SQL = "SELECT [ryid],[ryxm],[ryxb],[xlmc],[rygh],[jcrq],[gsmc],[bmmc],[kscj],[lwgs] FROM [hdhr].[dbo].[v_psninfo_to_hangong]"; Class_KindofEmployer myClass_KindofEmployer = new Class_KindofEmployer(this.myEventArgs_KindofEmployer.str_KindofEmployer); Class_Employer myClass_Employer = new Class_Employer(myClass_KindofEmployer.KindofEmployerEmployerHPID); Class_Department myClass_Department = new Class_Department(myClass_KindofEmployer.KindofEmployerDepartmentHPID); Class_WorkPlace myClass_WorkPlace = new Class_WorkPlace(myClass_KindofEmployer.KindofEmployerWorkPlaceHPID); switch (myClass_KindofEmployer.KindofEmployerLevel) { case 1: str_SQL += string.Format(" where gsmc='{0}'", myClass_Employer.Employer); break; case 2: str_SQL += string.Format(" where gsmc='{0}' and bmmc='{1}'", myClass_Employer.Employer, myClass_Department.Department); break; case 3: str_SQL += string.Format(" where gsmc='{0}' and bmmc='{1}' and kscj='{2}'", myClass_Employer.Employer, myClass_Department.Department, myClass_WorkPlace.WorkPlace); break; default: return; } myAdapter = new SqlDataAdapter(str_SQL, Properties.Settings.Default.zwjConnhdhr); DataTable myDataTable_hdhrhangong = new DataTable(); myAdapter.Fill(myDataTable_hdhrhangong); Class_KindofEmployerWelder myClass_KindofEmployerWelder = new Class_KindofEmployerWelder(); myClass_KindofEmployerWelder.KindofEmployer = myClass_KindofEmployer.KindofEmployer; string str_Err; int i_success = 0; int i_success_add = 0; int i_success_modify = 0; int i_success_delete = 0; int i_fail = 0; StringBuilder myStringBuilder_err = new StringBuilder(); foreach (DataRow myDataRow in this.myDataTable.Rows) { if (myDataTable_hdhrhangong.Select(string.Format("ryid='{0}'", myDataRow["IdentificationCard"])).GetLength(0) == 0) { Class_KindofEmployerWelder.ExistAndCanDeleteAndDelete((int)myDataRow["KindofEmployerWelderID"], Enum_zwjKindofUpdate.Delete); i_success_delete++; } } foreach (DataRow myDataRow in myDataTable_hdhrhangong.Rows) { myClass_KindofEmployerWelder.IdentificationCard = myDataRow["ryid"].ToString(); myClass_KindofEmployerWelder.WelderName = myDataRow["ryxm"].ToString(); myClass_KindofEmployerWelder.Sex = myDataRow["ryxb"].ToString(); myClass_KindofEmployerWelder.Schooling = myDataRow["xlmc"].ToString(); if (!DateTime.TryParse(myDataRow["jcrq"].ToString(), out myClass_KindofEmployerWelder.WeldingBeginning)) { myClass_KindofEmployerWelder.WeldingBeginning = DateTime.Now; } myClass_KindofEmployerWelder.myClass_BelongUnit.WorkerID = myDataRow["rygh"].ToString(); myClass_KindofEmployerWelder.myClass_BelongUnit.EmployerHPID = Class_Employer.GetEmployerHPID(myDataRow["gsmc"].ToString()); if (string.IsNullOrEmpty(myClass_KindofEmployerWelder.myClass_BelongUnit.EmployerHPID)) { i_fail++; myStringBuilder_err.Append(string.Format("\n身份证号码:{0}, 错误信息:公司名称不符", myClass_KindofEmployerWelder.IdentificationCard)); continue; } else { myClass_KindofEmployerWelder.myClass_BelongUnit.DepartmentHPID = Class_Department.GetDepartmentHPID(myClass_KindofEmployerWelder.myClass_BelongUnit.EmployerHPID, myDataRow["bmmc"].ToString()); if (string.IsNullOrEmpty(myClass_KindofEmployerWelder.myClass_BelongUnit.DepartmentHPID)) { myClass_KindofEmployerWelder.myClass_BelongUnit.WorkPlaceHPID = null; } else { myClass_KindofEmployerWelder.myClass_BelongUnit.WorkPlaceHPID = Class_WorkPlace.GetWorkPlaceHPID(myClass_KindofEmployerWelder.myClass_BelongUnit.DepartmentHPID, myDataRow["kscj"].ToString()); } myClass_KindofEmployerWelder.myClass_BelongUnit.LaborServiceTeamHPID = Class_LaborServiceTeam.GetLaborServiceTeamHPID(myClass_KindofEmployerWelder.myClass_BelongUnit.EmployerHPID, myDataRow["lwgs"].ToString()); } str_Err = myClass_KindofEmployerWelder.CheckField(); if (string.IsNullOrEmpty(str_Err)) { if (Class_KindofEmployerWelder.ExistSecond(myClass_KindofEmployerWelder.KindofEmployer, myClass_KindofEmployerWelder.IdentificationCard, 0, Enum_zwjKindofUpdate.Add)) { myClass_KindofEmployerWelder.KindofEmployerWelderID = Class_KindofEmployerWelder.GetKindofEmployerWelderID(myClass_KindofEmployerWelder.KindofEmployer, myClass_KindofEmployerWelder.IdentificationCard); myClass_KindofEmployerWelder.AddAndModify(Enum_zwjKindofUpdate.Modify); i_success_modify++; i_success++; } else { myClass_KindofEmployerWelder.AddAndModify(Enum_zwjKindofUpdate.Add); i_success_add++; i_success++; if (!Class_Welder.ExistAndCanDeleteAndDelete(myClass_KindofEmployerWelder.IdentificationCard, Enum_zwjKindofUpdate.Exist)) { Class_Welder myClass_Welder = new Class_Welder(); myClass_Welder.IdentificationCard = myClass_KindofEmployerWelder.IdentificationCard; myClass_Welder.Schooling = myClass_KindofEmployerWelder.Schooling; myClass_Welder.Sex = myClass_KindofEmployerWelder.Sex; myClass_Welder.WelderName = myClass_KindofEmployerWelder.WelderName; myClass_Welder.WeldingBeginning = myClass_KindofEmployerWelder.WeldingBeginning; myClass_Welder.myClass_BelongUnit = myClass_KindofEmployerWelder.myClass_BelongUnit; myClass_Welder.AddAndModify(Enum_zwjKindofUpdate.Add); } } } else { i_fail++; myStringBuilder_err.Append(string.Format("\n身份证号码:{0}, 错误信息:{1}", myClass_KindofEmployerWelder.IdentificationCard, str_Err)); } } this.RefreshData(false); MessageBox.Show(string.Format("操作完成,其中同步成功{0}条,添加{1}条,删除{2}条,失败{3}条,失败原因如下:\n{4}", i_success, i_success_add, i_success_delete, i_fail, myStringBuilder_err.ToString())); }
private void toolStripMenuItem_RowWelderFluxion_Click(object sender, EventArgs e) { ZCCL.Tools.Form_DataView myForm = new ZCCL.Tools.Form_DataView(); myForm.InitDataGridView("流失焊工考试记录", new DataView(Class_KindofEmployer.GetDataTable_WelderFluxion(this.myEventArgs_KindofEmployer.str_KindofEmployer)), Enum_DataTable.WelderIssueStudentQCRegistrationNo.ToString()); myForm.ShowDialog(); }