private void btnSave_Click(object sender, EventArgs e) { List <AppItem> appList = _A.Select <AppItem>(); _A.DeletedValues(appList); //全部刪除 List <AppItem> itemlist = new List <AppItem>(); foreach (DataGridViewRow row in dataGridViewX1.Rows) { if (row.IsNewRow) { continue; } AppItem item = new AppItem(); item.SchoolName = "" + row.Cells[colSchoolName.Index].Value; //學校名稱 item.AppName = "" + row.Cells[colAppName.Index].Value; //APP名稱 item.PackageName = "" + row.Cells[colPackageName.Index].Value; //PackageName item.BundleID = "" + row.Cells[colBundleID.Index].Value; //BundleID item.SchoolDsns = "" + row.Cells[colDSNS.Index].Value; //位置 item.SchoolAppVer = "" + row.Cells[colAndroidVer.Index].Value; //Android版本編號 item.SchoolAppIOSVer = "" + row.Cells[colIOSVer.Index].Value; //IOS版本編號 item.Remark = "" + row.Cells[colRemake.Index].Value; //備注 itemlist.Add(item); } //新增 _A.SaveAll(itemlist); MsgBox.Show("儲存成功!"); }
private void buttonX1_Click(object sender, EventArgs e) { _AccessHelper.DeletedValues(_MapRecords); _MapRecords.Clear(); AbsenceMapRecord amr; foreach (DataGridViewRow row in dataGridViewX1.Rows) { amr = new AbsenceMapRecord(); amr.absence = "" + row.Cells[0].Value; amr.allow1 = (bool)row.Cells[1].Value == true ? "1" : "0"; amr.allow2 = (bool)row.Cells[2].Value == true ? "1" : "0"; _MapRecords.Add(amr); } _MapRecords.SaveAll(); this.DialogResult = DialogResult.OK; this.Close(); }
private void btnDelete_Click(object sender, EventArgs e) { //刪除資料 List <Reply> ReplyList = new List <Reply>(); foreach (DataGridViewRow row in dataGridViewX1.SelectedRows) { Reply each = (Reply)row.Tag; ReplyList.Add(each); } _A.DeletedValues(ReplyList); this.Text = "資料載入中..."; bgw.RunWorkerAsync(); MsgBox.Show("資料已刪除!!"); }
private void buttonX1_Click(object sender, EventArgs e) { _AccessHelper.DeletedValues(_MapRecords); _MapRecords.Clear(); MapRecord mr; foreach (DataGridViewRow row in dataGridView1.Rows) { if (string.IsNullOrWhiteSpace("" + row.Cells["student_tag"].Value)) { continue; } mr = new MapRecord(); mr.student_tag = "" + row.Cells["student_tag"].Value; mr.code1 = "" + row.Cells["code1"].Value; mr.code2 = "" + row.Cells["code2"].Value; mr.note = "" + row.Cells["note"].Value; _MapRecords.Add(mr); } _MapRecords.SaveAll(); this.Close(); }