private void cmdNext_Click(object sender, EventArgs e) { if (EntryData.Count == 0) { MessageBox.Show("Nu exista nici o masina in asteptare!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } EntryData[0].dateEntry = DateTime.Now; AddEntryToCompleted(EntryData[0]); using (FixedObjectFileStream stream = new FixedObjectFileStream(dataFile, FileMode.Open, FileAccess.ReadWrite)) { stream.RemoveAt(0); } if (EntryData != null) { EntryData.RemoveAt(0); AutoIncrementNrCrt = EntryData.Count == 0 ? 1 : EntryData.Last().nrCrt + 1; lstTruckOrder.Items.RemoveAt(0); foreach (TruckInfo ti in EntryData) { lstTruckOrder.Items[--ti.nrCrt - 1].SubItems[0].Text = ti.nrCrt.ToString(); } } PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("EntryData")); }
private void cmdRemTruck_Click(object sender, EventArgs e) { if (lstTruckOrder.SelectedItems.Count == 1) { using (FixedObjectFileStream stream = new FixedObjectFileStream(dataFile, FileMode.Open, FileAccess.ReadWrite)) { stream.RemoveAt(lstTruckOrder.SelectedIndices[0]); if (EntryData != null) { foreach (TruckInfo ti in EntryData.Skip(lstTruckOrder.SelectedIndices[0] + 1)) { lstTruckOrder.Items[--ti.nrCrt].SubItems[0].Text = ti.nrCrt.ToString(); } } } if (EntryData != null) { EntryData.RemoveAt(lstTruckOrder.SelectedIndices[0]); AutoIncrementNrCrt = EntryData.Count == 0 ? 1 : EntryData.Last().nrCrt + 1; } if (lstTruckOrder != null) { lstTruckOrder.Items.Remove(lstTruckOrder.SelectedItems[0]); } if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("EntryData")); } } }
private void cmdReturnToList_Click(object sender, EventArgs e) { if (lstSkip.SelectedItems.Count == 1) { var entry = SkipData[lstSkip.SelectedIndices[0]]; entry.nrCrt = 1; entry.dateReturn = DateTime.Now; RestoreToList(entry); AddEntryToFile(entry, true); EntryData.Insert(0, entry); EntryData[0].nrCrt = 0; foreach (TruckInfo ti in EntryData) { lstTruckOrder.Items[ti.nrCrt].SubItems[0].Text = (++ti.nrCrt).ToString(); } using (FixedObjectFileStream stream = new FixedObjectFileStream(skipFile, FileMode.Open, FileAccess.ReadWrite)) { stream.RemoveAt(lstSkip.SelectedIndices[0]); if (SkipData != null) { foreach (TruckInfo ti in SkipData.Skip(lstSkip.SelectedIndices[0] + 1)) { lstSkip.Items[--ti.nrCrt].SubItems[0].Text = ti.nrCrt.ToString(); } } } if (SkipData != null) { SkipData.RemoveAt(lstSkip.SelectedIndices[0]); } if (lstSkip != null) { lstSkip.Items.Remove(lstSkip.SelectedItems[0]); } PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("EntryData")); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SkipData")); } }
private void cmdSkip_Click(object sender, EventArgs e) { if (EntryData.Count == 0) { MessageBox.Show("Nu exista nici o masina in asteptare!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var entry = EntryData[0]; CommentForm cForm = new CommentForm(); cForm.Comment = entry.comments; cForm.ShowDialog(); if (cForm.DialogResult == DialogResult.OK) { entry.comments = cForm.Comment; } entry.dateSkip = DateTime.Now; AddSkipToFile(entry); AddToSkipList(entry); SkipData.Add(entry); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SkipData")); using (FixedObjectFileStream stream = new FixedObjectFileStream(dataFile, FileMode.Open, FileAccess.ReadWrite)) { stream.RemoveAt(0); } if (EntryData != null) { EntryData.RemoveAt(0); AutoIncrementNrCrt = EntryData.Count == 0 ? 1 : EntryData.Last().nrCrt + 1; lstTruckOrder.Items.RemoveAt(0); foreach (TruckInfo ti in EntryData) { lstTruckOrder.Items[--ti.nrCrt - 1].SubItems[0].Text = ti.nrCrt.ToString(); } } PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("EntryData")); }
private void cmdSkip_Click(object sender, EventArgs e) { if (EntryData.Count == 0) { MessageBox.Show("Nu exista nici o masina in asteptare!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } var entry = EntryData[0]; CommentForm cForm = new CommentForm(); cForm.Comment = entry.comments; cForm.ShowDialog(); if (cForm.DialogResult == DialogResult.OK) { entry.comments = cForm.Comment; } entry.dateSkip = DateTime.Now; AddSkipToFile(entry); AddToSkipList(entry); SkipData.Add(entry); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SkipData")); using (FixedObjectFileStream stream = new FixedObjectFileStream(dataFile, FileMode.Open, FileAccess.ReadWrite)) { stream.RemoveAt(0); } if (EntryData != null) { EntryData.RemoveAt(0); AutoIncrementNrCrt = EntryData.Count == 0 ? 1 : EntryData.Last().nrCrt + 1; lstTruckOrder.Items.RemoveAt(0); foreach (TruckInfo ti in EntryData) lstTruckOrder.Items[--ti.nrCrt - 1].SubItems[0].Text = ti.nrCrt.ToString(); } PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("EntryData")); }
private void cmdReturnToList_Click(object sender, EventArgs e) { if (lstSkip.SelectedItems.Count == 1) { var entry = SkipData[lstSkip.SelectedIndices[0]]; entry.nrCrt = 1; entry.dateReturn = DateTime.Now; RestoreToList(entry); AddEntryToFile(entry, true); EntryData.Insert(0, entry); EntryData[0].nrCrt = 0; foreach (TruckInfo ti in EntryData) lstTruckOrder.Items[ti.nrCrt].SubItems[0].Text = (++ti.nrCrt).ToString(); using (FixedObjectFileStream stream = new FixedObjectFileStream(skipFile, FileMode.Open, FileAccess.ReadWrite)) { stream.RemoveAt(lstSkip.SelectedIndices[0]); if (SkipData != null) foreach (TruckInfo ti in SkipData.Skip(lstSkip.SelectedIndices[0] + 1)) lstSkip.Items[--ti.nrCrt].SubItems[0].Text = ti.nrCrt.ToString(); } if (SkipData != null) { SkipData.RemoveAt(lstSkip.SelectedIndices[0]); } if (lstSkip != null) lstSkip.Items.Remove(lstSkip.SelectedItems[0]); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("EntryData")); PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("SkipData")); } }
private void cmdRemTruck_Click(object sender, EventArgs e) { if (lstTruckOrder.SelectedItems.Count == 1) { using (FixedObjectFileStream stream = new FixedObjectFileStream(dataFile, FileMode.Open, FileAccess.ReadWrite)) { stream.RemoveAt(lstTruckOrder.SelectedIndices[0]); if (EntryData != null) foreach (TruckInfo ti in EntryData.Skip(lstTruckOrder.SelectedIndices[0] + 1)) lstTruckOrder.Items[--ti.nrCrt].SubItems[0].Text = ti.nrCrt.ToString(); } if (EntryData != null) { EntryData.RemoveAt(lstTruckOrder.SelectedIndices[0]); AutoIncrementNrCrt = EntryData.Count == 0 ? 1 : EntryData.Last().nrCrt + 1; } if (lstTruckOrder != null) lstTruckOrder.Items.Remove(lstTruckOrder.SelectedItems[0]); if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs("EntryData")); } } }
private void cmdNext_Click(object sender, EventArgs e) { if (EntryData.Count == 0) { MessageBox.Show("Nu exista nici o masina in asteptare!", "Warning", MessageBoxButtons.OK, MessageBoxIcon.Information); return; } EntryData[0].dateEntry = DateTime.Now; AddEntryToCompleted(EntryData[0]); using (FixedObjectFileStream stream = new FixedObjectFileStream(dataFile, FileMode.Open, FileAccess.ReadWrite)) { stream.RemoveAt(0); } if (EntryData != null) { EntryData.RemoveAt(0); AutoIncrementNrCrt = EntryData.Count == 0 ? 1 : EntryData.Last().nrCrt + 1; lstTruckOrder.Items.RemoveAt(0); foreach (TruckInfo ti in EntryData) lstTruckOrder.Items[--ti.nrCrt - 1].SubItems[0].Text = ti.nrCrt.ToString(); } PropertyChanged?.Invoke(this, new PropertyChangedEventArgs("EntryData")); }