public void AddStation(bool IsBack = false) { if (!IsBack) { int Priority = 0; if (_Stations == null) { Priority = 1; } else { Priority = _Stations.Rows.Count + 1; } JLineStation LineStation = new JLineStation(); LineStation.IsBack = IsBack; LineStation.StationCode = ((JStation)txtStation.Tag).Code; LineStation.LineCode = Code; LineStation.Priority = Priority; if (LineStation.Insert() > 0) { RefreshStation(); } else { ClassLibrary.JMessages.Error("پردازش با خطا مواجه شد.", ""); } } else { int Priority = 0; if (_BackStations == null) { Priority = 1; } else { Priority = _BackStations.Rows.Count + 1; } JLineStation LineStation = new JLineStation(); LineStation.IsBack = IsBack; LineStation.StationCode = ((JStation)txtBackStation.Tag).Code; LineStation.LineCode = Code; LineStation.Priority = Priority; if (LineStation.Insert() > 0) { RefreshBackStation(); } else { ClassLibrary.JMessages.Error("پردازش با خطا مواجه شد.", ""); } } }
private void pictureBox4_Click(object sender, EventArgs e) { if (lstBackStations.SelectedItems.Count == 1) { foreach (var item in lstBackStations.SelectedItems) { DataRow row = (DataRow)((ListViewItem)item).Tag; JLineStation station = new JLineStation(); station.Code = Convert.ToInt32(row["Code"]); if (station.PriorityDown(true)) { RefreshBackStation(station.Code); } } } }
private void pictureBox6_Click(object sender, EventArgs e) { if (lstBackStations.SelectedItems.Count > 0) { if (ClassLibrary.JMessages.Question("آیا مایلید ایستگاه انتخاب شده حذف شود؟", "اخطار") == System.Windows.Forms.DialogResult.Yes) { foreach (var item in lstBackStations.SelectedItems) { DataRow row = (DataRow)((ListViewItem)item).Tag; JLineStation station = new JLineStation(); station.Code = Convert.ToInt32(row["Code"]); if (station.Delete()) { RefreshBackStation(); } } } } }
private void pictureBox2_Click(object sender, EventArgs e) { if (lstStations.SelectedItems.Count == 1) { foreach (var item in lstStations.SelectedItems) { ListViewItem Item = (ListViewItem)item; if (Item.Index != lstStations.Items.Count - 1) { DataRow row = (DataRow)Item.Tag; JLineStation station = new JLineStation(); station.Code = Convert.ToInt32(row["Code"]); if (station.PriorityUp(false)) { RefreshStation(station.Code); } } } } }