private void button1_Click(object sender, EventArgs e) { bool result; result = SaveExp_BUL.DeleteSave(dtgv_SaveExp.SelectedRows[0].Cells["ID"].Value.ToString()); if (result) { lstSave = SaveExp_BUL.LoadSave(); dtgv_SaveExp.DataSource = typeof(List <SaveExp>); dtgv_SaveExp.DataSource = lstSave; dtgv_SaveExp.DataSource = lstSave; dtgv_SaveExp.Columns[0].HeaderText = "ID"; dtgv_SaveExp.Columns[1].HeaderText = "Date"; dtgv_SaveExp.Columns[2].HeaderText = "Y"; dtgv_SaveExp.Columns[3].HeaderText = "Velocity"; dtgv_SaveExp.Columns[4].HeaderText = "Time"; dtgv_SaveExp.Columns[5].HeaderText = "Accerlation"; dtgv_SaveExp.Columns[6].HeaderText = "Radius"; dtgv_SaveExp.Columns[7].HeaderText = "Object Density"; dtgv_SaveExp.Columns[8].HeaderText = "Liquid Density"; dtgv_SaveExp.Columns[9].HeaderText = "X"; MessageBox.Show("Delete success!", "Notice"); } else { MessageBox.Show("Fail", "Notice"); } }
private void btn_Save_Click(object sender, EventArgs e) { try { idSave = int.Parse(SaveExp_DAL.quantityElement().Substring(3)) + 1; SaveExp newSaveEx = new SaveExp(); newSaveEx.ID = IDS + idSave.ToString(); newSaveEx.Ngay = DateTime.Now.ToString(); newSaveEx.Y = pbx_Object.Location.Y; newSaveEx.X = pbx_Object.Location.X; newSaveEx.Vt = float.Parse(khoicau.vt + ""); newSaveEx.ThoiGian = float.Parse(khoicau.time + ""); newSaveEx.A = float.Parse(khoicau.a + ""); newSaveEx.BanKinh = float.Parse(khoicau.R + ""); newSaveEx.KhoiLuongRiengVat = float.Parse(khoiluongriengvat + ""); newSaveEx.KhoiLuongRiengChat = float.Parse(khoiluongriengchatlong + ""); bool result = SaveExp_BUL.InsertSave(newSaveEx); if (result) { MessageBox.Show("Save success!", "Notice"); } else { MessageBox.Show("Fail", "Notice"); } } catch (Exception ex) { Console.Write(ex.ToString()); MessageBox.Show("Invalid dang an oshi!"); } }
private void Upload_Load(object sender, EventArgs e) { lstSave = SaveExp_BUL.LoadSave(); dtgv_SaveExp.DataSource = SaveExp_BUL.LoadSave(); dtgv_SaveExp.Columns[0].HeaderText = "ID"; dtgv_SaveExp.Columns[1].HeaderText = "Date"; dtgv_SaveExp.Columns[2].HeaderText = "Y"; dtgv_SaveExp.Columns[3].HeaderText = "Velocity"; dtgv_SaveExp.Columns[4].HeaderText = "Time"; dtgv_SaveExp.Columns[5].HeaderText = "Accerlation"; dtgv_SaveExp.Columns[6].HeaderText = "Radius"; dtgv_SaveExp.Columns[7].HeaderText = "Object Density"; dtgv_SaveExp.Columns[8].HeaderText = "Liquid Density"; dtgv_SaveExp.Columns[9].HeaderText = "X"; }