private void saveBT_Click(object sender, EventArgs e) { List <WorksISS> saveLst = new List <WorksISS>(); foreach (ListViewItem item in listView1.Items) { WorksISS tmp = new WorksISS(); tmp.Hrv = item.SubItems[1].Text; tmp.Eng = item.SubItems[2].Text; tmp.Id = item.SubItems[3].Text; saveLst.Add(tmp); } if (qc.SaveToWork(saveLst)) { MessageBox.Show("All data are saved!"); this.Close(); } else { MessageBox.Show("Data not saved!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }
private void editBT_Click(object sender, EventArgs e) { WorksISS tmp = new WorksISS(); foreach (ListViewItem item in listView1.SelectedItems) { tmp.Hrv = item.SubItems[1].Text; tmp.Eng = item.SubItems[2].Text; tmp.Id = item.SubItems[3].Text; } WorkListAdder wla = new WorkListAdder(); wla.SendValues(tmp, this, false, maxValue); wla.ShowDialog(); if (okBtn) { worksLst.RemoveAll(o => o.Id == tmp.Id); worksLst.Add(wss); RefillList(); } }
public void SendValues(WorksISS _wss, WorkListISS form, Boolean idChange, int lastNbr) { //if(_hrv.Equals("") || _eng.Equals("") || _id.Equals("")) //{ //} //textBox3.Enabled = idChange; wli = form; this.wss.CopyFrom(_wss); textBox1.Text = wss.Hrv; textBox2.Text = wss.Eng; textBox3.Text = idChange ? (lastNbr + 1).ToString() : wss.Id; }
private void deletBT_Click(object sender, EventArgs e) { int k = 1; int mRB; foreach (ListViewItem item in listView1.SelectedItems) { mRB = int.Parse(item.SubItems[0].Text); WorksISS itm = new WorksISS(); itm = worksLst.Find(w => w.Id == item.SubItems[3].Text); listView1.Items.Remove(item); worksLst.Remove(itm); } RefillList(); }
private void addBT_Click(object sender, EventArgs e) { WorkListAdder wla = new WorkListAdder(); String mID = wss.Id; wss = new WorksISS(); wss.Id = mID; wla.SendValues(wss, this, true, maxValue); wla.ShowDialog(); if (okBtn) { RefillList(); } }
public void GetValues(WorksISS _wss, Boolean _okBtn) { okBtn = _okBtn; if (okBtn) { try { wss.CopyFrom(_wss); worksLst.Add(_wss); RefillList(); } catch (Exception e1) { MessageBox.Show(e1.Message); } } }