private void btnAdd_Click(object sender, EventArgs e) { try { DataRow newrow = dsStat.Tables[0].NewRow(); newrow["CreateTime"] = DateTime.Now; newrow["ProductionDate"] = DateTime.Now.ToString("yyyy-MM-dd"); newrow["Operator"] = Adapter.Session.User; newrow["Flow_CFCO"] = "0"; newrow["Flow_BOFCO"] = "0"; newrow["Flow_BOFCO_CallBack"] = "0"; newrow["Flow_N2"] = "0"; newrow["Flow_N2_SpecialSteel"] = "0"; newrow["Flow_O2"] = "0"; newrow["CFCO_D"] = "0"; newrow["BOFCO_D"] = "0"; newrow["BOFCO_CallBack_D"] = "0"; newrow["N2_D"] = "0"; newrow["N2_SpecialSteel_D"] = "0"; newrow["O2_D"] = "0"; newrow["CFCO_D_Avg"] = "0"; newrow["BOFCO_D_Avg"] = "0"; newrow["BOFCO_CallBack_D_Avg"] = "0"; newrow["N2_D_Avg"] = "0"; newrow["N2_SpecialSteel_D_Avg"] = "0"; newrow["O2_D_Avg"] = "0"; newrow["CFCO_M"] = "0"; newrow["BOFCO_M"] = "0"; newrow["BOFCO_CallBack_M"] = "0"; newrow["N2_M"] = "0"; newrow["N2_SpecialSteel_M"] = "0"; newrow["O2_M"] = "0"; newrow["CFCO_M_Avg"] = "0"; newrow["BOFCO_M_Avg"] = "0"; newrow["BOFCO_CallBack_M_Avg"] = "0"; newrow["N2_M_Avg"] = "0"; newrow["N2_SpecialSteel_M_Avg"] = "0"; newrow["O2_M_Avg"] = "0"; newrow["Production_D"] = "0"; newrow["Production_M"] = "0"; newrow["Production_Special_D"] = "0"; newrow["Production_Special_M"] = "0"; dsStat.Tables[0].Rows.Add(newrow); bsStat.MoveFirst(); while (((System.Data.DataRowView)(bsStat.Current)).Row != newrow && bsStat.Position != dsStat.Tables[0].Rows.Count - 1) { bsStat.MoveNext(); } EnergyStatShowFrm Frm = new EnergyStatShowFrm(); Frm.ShowDialogEx(Adapter.Session, strSort, bsStat.Position, true, ref dsStat); GC.Collect(); } catch { } }
private void dvEnergyData_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { if (e.RowIndex >= 0 && dsStat.Tables[0].Rows.Count > 0) { bool bPreDtEnabled = false; if (dvStat.CurrentRow.Cells["GUID"].Value.ToString() == "") { bPreDtEnabled = true; } EnergyStatShowFrm Frm = new EnergyStatShowFrm(); Frm.ShowDialogEx(Adapter.Session, strSort, bsStat.Position, bPreDtEnabled, ref dsStat); GC.Collect(); } }