private void UC_Home_Load(object sender, EventArgs e) { try { DGVFrontGear.ColumnInitial(typeof(TB_GearFront)); DGVFrontCase.ColumnInitial(typeof(TB_FrontCase)); Task.Run(() => ShowData(201910209)); } catch (Exception ex) { StackTrace trace = new StackTrace(ex, true); StackFrame stackFrame = trace.GetFrame(trace.FrameCount - 1); int lineNumber = stackFrame.GetFileLineNumber(); I_Home.ErrorLog(($" ({lineNumber}) : {ex.ToString()}")); } }
public UC_Record(IinterRef I_Home) { InitializeComponent(); this.I_Home = I_Home; foreach (Button btn in splitContainer2.Panel1.Controls.OfType <Button>()) { //Array.Resize(ref btnMenus, i + 1); //btnMenus[i] = btn; btnMenus.Add(btn.Text, btn); btnMenus[btn.Text].Click += btn_HeaderMuClick; } foreach (DataGridView dgv in splitContainer2.Panel2.Controls.OfType <DataGridView>()) { dgv.DoubleBuffered(); dgv.Dock = DockStyle.Fill; } DGVMenus.Add(WorkStep.FrontGear, DGVFrontGear); DGVMenus.Add(WorkStep.FrontCase, DGVFrontCase); DGVFrontGear.BringToFront(); lblHdName.Text = btnFrontgear.Tag.ToString(); }
internal async Task ShowData(int iworkdate) { try { using (GEN2_MEASUREDBEntities db = new GEN2_MEASUREDBEntities()) { lstGearfrt = await db.TB_GearFront.SqlQuery($"Select * from TB_GearFront ").ToListAsync(); lstFrtCase = await db.TB_FrontCase.SqlQuery($"Select * from TB_FrontCase ").ToListAsync(); for (int i = 0; i < lstGearfrt.Count; i++) { List <string> addrow = new List <string>(); addrow.Add(lstGearfrt[i].Insert_Time.ToString()); addrow.Add(lstGearfrt[i].Work_Date.ToString()); addrow.Add(lstGearfrt[i].Work_No.ToString()); addrow.Add(lstGearfrt[i].GearNo_Front.ToString()); addrow.Add(lstGearfrt[i].GearNo_4WD.ToString()); addrow.Add(lstGearfrt[i].Part_Name.ToString()); addrow.Add(lstGearfrt[i].FGear_G4_Min.ToString()); addrow.Add(lstGearfrt[i].FGear_G4_Val.ToString()); addrow.Add(lstGearfrt[i].FGear_G4_Max.ToString()); addrow.Add(lstGearfrt[i].FGear_G2_Min.ToString()); addrow.Add(lstGearfrt[i].FGear_G2_Val.ToString()); addrow.Add(lstGearfrt[i].FGear_G2_Max.ToString()); BeginInvoke((Action)(() => { DGVFrontGear.AddGridrow(addrow.ToArray()); })); } for (int i = 0; i < lstFrtCase.Count; i++) { List <string> addrow = new List <string>(); addrow.Add(lstFrtCase[i].Insert_Time.ToString()); addrow.Add(lstFrtCase[i].Work_Date.ToString()); addrow.Add(lstFrtCase[i].Work_No.ToString()); addrow.Add(lstFrtCase[i].FrontCase_Bar.ToString()); addrow.Add(lstFrtCase[i].Part_Name.ToString()); addrow.Add(lstFrtCase[i].FCase_4WD_Min.ToString()); addrow.Add(lstFrtCase[i].FCase_4WD_Val.ToString()); addrow.Add(lstFrtCase[i].FCase_4WD_Max.ToString()); addrow.Add(lstFrtCase[i].FCase_G4_Min.ToString()); addrow.Add(lstFrtCase[i].FCase_G4_Val.ToString()); addrow.Add(lstFrtCase[i].FCase_G4_Max.ToString()); BeginInvoke((Action)(() => { DGVFrontCase.AddGridrow(addrow.ToArray()); })); } } } catch (Exception ex) { StackTrace trace = new StackTrace(ex, true); StackFrame stackFrame = trace.GetFrame(trace.FrameCount - 1); int lineNumber = stackFrame.GetFileLineNumber(); I_Home.ErrorLog(($" ({lineNumber}) : {ex.ToString()}")); } }