private void save_grid() //Copy(down) butonu kodları(gridler arası veri kopyalama yapar) { List <int> copygrid = new List <int>(); for (int i = 0; i <= gridView1.DataRowCount; i++) { if (gridView1.IsRowSelected(i)) { copygrid.Add(i); } } foreach (int x in copygrid)//Burada listeden çekilen seçili eleman verisi diğer table üstüne yazılır. { BackupTB backuptb = new BackupTB(); int cid = int.Parse(gridView1.GetListSourceRowCellValue(x, "Id").ToString()); RegistryTB sel_row = data.RegistryTBs.First(p => p.Id == cid); backuptb.NAME = sel_row.Name; backuptb.LASTNAME = sel_row.Lastname; backuptb.GSM = sel_row.Gsm; data.BackupTBs.InsertOnSubmit(backuptb); data.SubmitChanges(); showdata(); showdata_backup(); } }
private void delete(int selnumber) // delete butonu kodları(iki grid ekranında da silme işlemi yapar) { int selnum = selnumber % 2; if (selnum == 1) { List <int> seciligridd = new List <int>(); for (int i = 0; i <= gridView1.DataRowCount; i++) { if (gridView1.IsRowSelected(i)) { seciligridd.Add(i); } } seciligridd.Reverse(); foreach (int eleman in seciligridd)//Grid ekranında seçilen verileri seçilen table'lara yazar(bu işlemi id değerlerini bulup bunları tabledan işleyerek yapar) { int id = int.Parse(gridView1.GetListSourceRowCellValue(eleman, "Id").ToString()); RegistryTB selrow = data.RegistryTBs.First(p => p.Id == id); data.RegistryTBs.DeleteOnSubmit(selrow); data.SubmitChanges(); showdata(); } } else if (selnum == 0) { List <int> seciligrid2 = new List <int>(); for (int i = 0; i <= gridView2.DataRowCount; i++) { if (gridView2.IsRowSelected(i)) { seciligrid2.Add(i); } } seciligrid2.Reverse(); foreach (int eleman2 in seciligrid2) { int id2 = int.Parse(gridView2.GetListSourceRowCellValue(eleman2, "ID").ToString()); BackupTB sel_row = data.BackupTBs.First(p => p.ID == id2); data.BackupTBs.DeleteOnSubmit(sel_row); data.SubmitChanges(); showdata_backup(); showdata(); } } }
private void saveButton_Click(object sender, EventArgs e)//texteditten alınan veriler database'e kaydedilir. { if (textE_name.EditValue == null) { make_null(); XtraMessageBox.Show("FILL IN THE ALL BLANKS", "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } RegistryTB datatb = new RegistryTB(); datatb.Name = Convert.ToString(textE_name.EditValue); datatb.Lastname = Convert.ToString(textE_lastname.EditValue); datatb.Gsm = Convert.ToString(textE_gsm.EditValue); data.RegistryTBs.InsertOnSubmit(datatb); data.SubmitChanges(); make_null(); showdata(); XtraMessageBox.Show("INSERT IS SUCCED", "SUCCED", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); }
private void update_grid(int selnumber)//Seçili id'nin değerlerini güncellemeye yarar { int selnum = selnumber % 2; if (selnum == 1) { for (int i = 0; i <= gridView1.DataRowCount; i++) { if (gridView1.IsRowSelected(i)) { int id = int.Parse(gridView1.GetRowCellValue(i, "Id").ToString()); RegistryTB selrow = data.RegistryTBs.First(p => p.Id == id); selrow.Name = Convert.ToString(textE_name.EditValue); selrow.Lastname = Convert.ToString(textE_lastname.EditValue); selrow.Gsm = Convert.ToString(textE_gsm.EditValue); make_null(); data.SubmitChanges(); showdata(); } } } else if (selnum == 0) { for (int i = 0; i <= gridView2.DataRowCount; i++) { if (gridView2.IsRowSelected(i)) { int id = int.Parse(gridView2.GetRowCellValue(i, "ID").ToString()); BackupTB selrow = data.BackupTBs.First(p => p.ID == id); selrow.NAME = Convert.ToString(textE_name.EditValue); selrow.LASTNAME = Convert.ToString(textE_lastname.EditValue); selrow.GSM = Convert.ToString(textE_gsm.EditValue); make_null(); data.SubmitChanges(); showdata_backup(); } } } }
partial void DeleteRegistryTB(RegistryTB instance);
partial void UpdateRegistryTB(RegistryTB instance);
partial void InsertRegistryTB(RegistryTB instance);