private void bomFindButton_Click(object sender, EventArgs e) { BomDataSet set = bomSet; bookmark.Get(); AppHelper.ResetGridDataSource(bomGrid); if (bomDateCheck.Checked == true) { set.From = bomFromDateEdit.Value.ToString(AppRes.csDateFormat); set.To = bomToDateEdit.Value.ToString(AppRes.csDateFormat); } else { set.From = ""; set.To = ""; } set.AreaNo = (EReportArea)bomAreaCombo.SelectedValue; set.FName = bomNameEdit.Text.Trim(); set.Select(); AppHelper.SetGridDataSource(bomGrid, set); bookmark.Goto(); bomGrid.Focus(); }
public void LoadBom(EReportArea area, string fName) { bomSet.AreaNo = area; bomSet.FName = Path.GetFileName(fName); bomSet.Select(); // if BOM already exist in DB? if (bomSet.Empty == false) { MessageBox.Show("Can't add BOM because that already exist in DB!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Error); bomFindButton.PerformClick(); return; } if (bomExcelSheet.LoadDocument(fName) == true) { bomRec.Clear(); bomRec.RegTime = DateTime.Now; bomRec.AreaNo = area; bomRec.FName = Path.GetFileName(fName); bomRec.FPath = Path.GetDirectoryName(fName); if (ExtractProduct(bomExcelSheet.Document.Worksheets[0]) == true) { try { InsertBom(); } finally { bomFindButton.PerformClick(); } } else { MessageBox.Show("Can't load BOM file because of its invalid format!", "SGS", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }