private void FrmDeptCode_Load(object sender, EventArgs e) { OnLoadSystemCommonData onLoad = new OnLoadSystemCommonData(); onLoad.GetTADeptCode(); onLoad.GetTADeptCodeDetail(); dgvDeptCode.DataSource = CommonData.TaDeptCodeList; dgvDeptCode.Columns[0].Visible = false; dgvDeptCode.Columns[1].HeaderCell.Value = "Code"; dgvDeptCode.Columns[2].HeaderCell.Value = "Dept Name"; dgvDeptCode.Columns[3].HeaderCell.Value = "Other Name"; if (CommonData.TaDeptCodeDetailList != null && dgvDeptCode.CurrentRow != null) { if (dgvDeptCode.CurrentRow.Index > 0) { txtDeptCode.Text = dgvDeptCode.CurrentRow.Cells[1].Value.ToString(); txtDeptName.Text = dgvDeptCode.CurrentRow.Cells[2].Value.ToString(); txtOtherName.Text = dgvDeptCode.CurrentRow.Cells[3].Value.ToString(); var deptCode = CommonData.TaDeptCodeDetailList.FirstOrDefault( s => s.DeptCodeSysKey.Equals(dgvDeptCode.CurrentRow.Cells[0].Value.ToString())); if (deptCode != null) { cmbBoxPrinterName1.Items.Clear(); GetPrinter1(); cmbBoxNumberOfCopy1.Items.Clear(); cmbBoxNumberOfCopy1.Items.Add("1"); cmbBoxNumberOfCopy1.Items.Add("2"); cmbBoxNumberOfCopy1.SelectedIndex = cmbBoxNumberOfCopy1.Items.IndexOf(deptCode.NumCopy1.Equals("1") ? "1" : "2"); chkPrtDishSeper1.Checked = deptCode.PrtDishSeper1.Equals("Y"); cmbBoxPrinterName2.Items.Clear(); GetPrinter2(); cmbBoxNumberOfCopy2.Items.Clear(); cmbBoxNumberOfCopy2.Items.Add("1"); cmbBoxNumberOfCopy2.Items.Add("2"); cmbBoxNumberOfCopy2.SelectedIndex = cmbBoxNumberOfCopy2.Items.IndexOf(deptCode.NumCopy2.Equals("1") ? "1" : "2"); chkPrtDishSeper2.Checked = deptCode.PrtDishSeper2.Equals("Y"); } } } else { cmbBoxPrinterName1.Items.Clear(); GetPrinter1(); cmbBoxNumberOfCopy1.Items.Clear(); cmbBoxNumberOfCopy1.Items.Add("1"); cmbBoxNumberOfCopy1.Items.Add("2"); cmbBoxPrinterName2.Items.Clear(); GetPrinter2(); cmbBoxNumberOfCopy2.Items.Clear(); cmbBoxNumberOfCopy2.Items.Add("1"); cmbBoxNumberOfCopy2.Items.Add("2"); } }
private void FrmTAMenuCategory_Load(object sender, EventArgs e) { OnLoadSystemCommonData onLoad = new OnLoadSystemCommonData(); onLoad.GetTAMenuCategory(); onLoad.GetTADeptCode(); #region btnMenuSet赋值 Button[] btnMenuSet = new Button[4]; btnMenuSet[0] = btnMenuSet1; btnMenuSet[1] = btnMenuSet2; btnMenuSet[2] = btnMenuSet3; btnMenuSet[3] = btnMenuSet4; btnMenuSet1.Click += BtnMenuSet_Click; btnMenuSet2.Click += BtnMenuSet_Click; btnMenuSet3.Click += BtnMenuSet_Click; btnMenuSet4.Click += BtnMenuSet_Click; new OnLoadSystemCommonData().GetTAMenuSet(); int i = 0; foreach (var taMenuSet in CommonData.TaMenuSetList) { if (i >= 4) { break; } btnMenuSet[i].Text = taMenuSet.EnglishName; MenuSetKey[i] = taMenuSet.SystemKey.ToString(); if (i == 0) { strMenuSetKey = MenuSetKey[i]; } i++; } #endregion btnMenuSet1.BackColor = Color.CornflowerBlue; btnMenuSet1.Select(); btnMenuSet2.BackColor = Color.Gray; btnMenuSet3.BackColor = Color.Gray; btnMenuSet4.BackColor = Color.Gray; //dgvCategory.DataSource = CommonData.TaMenuCategoryList.Where(s => s.MenuSetID.Equals(strMenuSetKey)); dgvCategory.DataSource = CommonData.TaMenuCategoryList.Where(s => s.MenuSetID.Equals(strMenuSetKey)).ToList(); dgvCategory.Columns[0].Visible = false; dgvCategory.Columns[4].Visible = false; dgvCategory.Columns[5].Visible = false; dgvCategory.Columns[6].Visible = false; dgvCategory.Columns[7].Visible = false; dgvCategory.Columns[8].Visible = false; dgvCategory.Columns[9].Visible = false; dgvCategory.Columns[1].HeaderText = @"Category Name"; dgvCategory.Columns[2].HeaderText = @"Category 2nd Name"; dgvCategory.Columns[3].HeaderText = @"Position"; //if (string.IsNullOrEmpty(strMenuSetKey)) return; BindCmbData(); txtDishCode.Enabled = false; //comboBox1.SelectedValue; }