/// <summary> /// 刷新控件 /// </summary> void RefreshControl() { ClearControl(); if (dataGridView1.CurrentRow != null) { Provider providerInfo = m_providerServer.GetProviderInfo(dataGridView1.CurrentRow.Cells[0].Value.ToString()); if (!GlobalObject.GeneralFunction.IsNullOrEmpty(providerInfo.AscendYearMonth)) { cmbMonth.Text = providerInfo.AscendYearMonth.Substring(4, 2); cmbYear.Text = providerInfo.AscendYearMonth.Substring(0, 4); } else { cmbMonth.SelectedIndex = -1; cmbYear.SelectedIndex = -1; } txtCode.Text = dataGridView1.CurrentRow.Cells[0].Value.ToString(); txtName.Text = dataGridView1.CurrentRow.Cells[1].Value.ToString(); cmbClearingForm.Text = dataGridView1.CurrentRow.Cells["挂账方式"].Value == null ? "" : dataGridView1.CurrentRow.Cells["挂账方式"].Value.ToString(); if (dataGridView1.CurrentRow.Cells[2].Value != null) { txtShotName.Text = dataGridView1.CurrentRow.Cells[2].Value.ToString(); } checkBox1.Checked = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["是否在用"].Value); checkBox2.Checked = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["零星采购供应商"].Value); checkBox3.Checked = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["内部供应商"].Value); dataGridView2.DataSource = m_providerServer.GetProviderPrincipal( dataGridView1.CurrentRow.Cells["供应商编码"].Value.ToString()); if (dataGridView2.Rows.Count > 0) { dataGridView2.Rows[0].Selected = true; txtPersonnel.Text = dataGridView2.CurrentRow.Cells["责任人"].Value.ToString(); txtPersonnel.Tag = dataGridView2.CurrentRow.Cells["责任人工号"].Value.ToString(); chbIsMainDuty.Checked = Convert.ToBoolean(dataGridView2.CurrentRow.Cells["主要责任人"].Value); } } else if (dataGridView1.Rows.Count > 0) { Provider providerInfo = m_providerServer.GetProviderInfo(dataGridView1.Rows[0].Cells[0].Value.ToString()); if (!GlobalObject.GeneralFunction.IsNullOrEmpty(providerInfo.AscendYearMonth)) { cmbMonth.Text = providerInfo.AscendYearMonth.Substring(4, 2); cmbYear.Text = providerInfo.AscendYearMonth.Substring(0, 4); } else { cmbMonth.SelectedIndex = -1; cmbYear.SelectedIndex = -1; } txtCode.Text = dataGridView1.Rows[0].Cells[0].Value.ToString(); txtName.Text = dataGridView1.Rows[0].Cells[1].Value.ToString(); cmbClearingForm.Text = dataGridView1.CurrentRow.Cells["挂账方式"].Value == null ? "" : dataGridView1.CurrentRow.Cells["挂账方式"].Value.ToString(); if (dataGridView1.CurrentRow.Cells[2].Value != null) { txtShotName.Text = dataGridView1.Rows[0].Cells[2].Value.ToString(); } checkBox1.Checked = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["是否在用"].Value); checkBox2.Checked = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["零星采购供应商"].Value); checkBox3.Checked = Convert.ToBoolean(dataGridView1.CurrentRow.Cells["内部供应商"].Value); dataGridView2.DataSource = m_providerServer.GetProviderPrincipal( dataGridView1.CurrentRow.Cells["供应商编码"].Value.ToString()); if (dataGridView2.Rows.Count > 0) { dataGridView2.Rows[0].Selected = true; txtPersonnel.Text = dataGridView2.CurrentRow.Cells["责任人"].Value.ToString(); txtPersonnel.Tag = dataGridView2.CurrentRow.Cells["责任人工号"].Value.ToString(); chbIsMainDuty.Checked = Convert.ToBoolean(dataGridView2.CurrentRow.Cells["主要责任人"].Value); } } }