private void EnterBuch() { if (tb_BuchCode.Text != "") { timer_input.Stop(); ShowBuchResults(); if (llb_BuchTitel.Text != "keine Treffer") { if (!rueckgabe.IsAvailable) { if (!rueckgabe.CheckRueckList()) { if (bt_Zu_aendern.Text == "Übernehmen") { DialogResult dr = MetroMessageBox.Show(this, "Möchten Sie die Zustandsänderung übernehmen?", "Achtung", MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (dr == DialogResult.Yes) { rueckgabe.EndCondition = new Condition(conditionHelper.FindIdByName(cb_Zustand.Text)); cb_Zustand.TabStop = false; tpanel.Visible = true; bt_Zu_aendern.Text = "Buchzustand ändern"; } else { rueckgabe.EndCondition = rueckgabe.StartCondition; cb_Zustand.TabStop = false; tpanel.Visible = true; bt_Zu_aendern.Text = "Buchzustand ändern"; } } rueckgabe.AddToRueckgabeList(); bt_AddBuch.Text = "-"; } else { rueckgabe.RemoveFromRueckgabeList(); bt_AddBuch.Text = "+"; } } else { MetroMessageBox.Show(this, "Dieses Buch wurde nicht verliehen. Es kann nicht zur Buchrückgabeliste hinzugefügt werden.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } rueckgabe.SetSlider(ref rueckList_Slider, ref tb_listVon, ref tb_listBis); tb_BuchCode.Focus(); tb_BuchCode.SelectAll(); } else { MetroMessageBox.Show(this, "Der eingegebene Buchcode ist nicht vorhanden!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void AddCopy() { Copy copy = new Copy(); Condition condition = new Condition(); if (!conditionHelper.AlreadyContains(acb_Zustand.Text)) { condition.ConditionName = acb_Zustand.Text; condition.Add(); conditionHelper.FillCombobox(ref acb_Zustand, conditionHelper.FindIdByName(acb_Zustand.Text)); } condition = new Condition(conditionHelper.FindIdByName(acb_Zustand.Text)); copy.Condition = condition; copy.CopyIsbn = tb_ISBN.Text; copy.DateRegistration = dTP_AufDat.Value; List <Copy> copies = new List <Copy>(); int copyCount = int.Parse(tb_ExempCount.Text); copy.Add(copyCount); copies = copy.SelectAddedCopies(copyCount); Clear_Form(); ShowMessage(SaveOption.add); DialogResult result = MetroMessageBox.Show(this, "Möchten Sie alle eben hinzugefügten Exemplare die entsprechenden Labels drucken?", "Buchlabel drucken?", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (result == DialogResult.Yes) { List <string> barcodes = new List <string>(); foreach (Copy c in copies) { string code = GetCode(c.CopyId.ToString()); barcodes.Add(code); } printerHelper.PrintMultipleBarcodes(barcodes, this); } }
private void Tb_ExemplarID_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == (char)13) { #region Buchcode parsen if (tb_ExemplarID.Text.Length == 8) { string seven = tb_ExemplarID.Text.Substring(0, 7); string eight = tb_ExemplarID.Text.Substring(7, 1); if (ParseBuchcode(seven).ToString().Equals(eight)) { tb_ExemplarID.Text = int.Parse(seven).ToString(); } } #endregion if (tb_ExemplarID.Text != "") { try { Copy copy = new Copy(int.Parse(tb_ExemplarID.Text)); if (copy.CopyActivated) { lb_selected.Text = "ausgewählte Bücher:"; returnHelper.Copy = copy; returnHelper.StartCondition = copy.Condition; returnHelper.EndCondition = copy.Condition; if (selectedBuecher.Columns.Count < 2) { selectedBuecher.Columns.Add("ID"); selectedBuecher.Columns.Add("Vorheriger Zustand"); selectedBuecher.Columns.Add("Titel"); } if (!copy.IsAvailable()) { DataGridViewRow Buchrow = new DataGridViewRow(); if (GetIndexInLeihBuecher() != -1) { Buchrow = gv_suggested.Rows[GetIndexInLeihBuecher()]; if (!returnHelper.CheckRueckList()) { SelectExemplar(); Buchrow.DefaultCellStyle.BackColor = Color.LimeGreen; Buchrow.DefaultCellStyle.ForeColor = Color.Black; } else { UnSelectExemplar(); Buchrow.DefaultCellStyle.BackColor = default; Buchrow.DefaultCellStyle.ForeColor = default; } } else { DialogResult dialogResult = MetroMessageBox.Show(this, "Dieses Buch wurde nicht von diesem Kunden ausgeliehen!", "Achtung", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } else { MetroMessageBox.Show(this, "Dieses Buch wurde nicht verliehen. Es kann nicht zur Buchrückgabeliste hinzugefügt werden.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } gv_selected.DataSource = selectedBuecher; gv_selected.Refresh(); if (gv_selected.Columns.Contains("cbzustand")) { gv_selected.Columns.Remove("cbzustand"); } DataGridViewComboBoxColumn combobox = new DataGridViewComboBoxColumn(); combobox = conditionHelper.FillDataGridViewComboBox(); gv_selected.Columns.Add(combobox); gv_selected.Columns["cbzustand"].DisplayIndex = 2; gv_selected.Columns["cbzustand"].HeaderText = "aktueller Ist-Zustand"; for (int i = 0; i < gv_selected.RowCount; i++) { DataGridViewComboBoxCell comboValue = (DataGridViewComboBoxCell)(gv_selected.Rows[i].Cells["cbzustand"]); //comboValue.Value = 0; string valueMember = gv_selected.Rows[i].Cells[1].Value.ToString(); Condition condition = new Condition(conditionHelper.FindIdByName(valueMember)); valueMember = condition.ConditionId.ToString(); gv_selected.Rows[i].Cells[3].Value = int.Parse(valueMember); } gv_selected.ClearSelection(); tb_ExemplarID.Focus(); tb_ExemplarID.SelectAll(); combobox.DisplayStyle = DataGridViewComboBoxDisplayStyle.ComboBox; } else { tb_ExemplarID.Focus(); tb_ExemplarID.SelectAll(); MetroMessageBox.Show(this, "Dieser Buchcode existiert nicht.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MetroMessageBox.Show(this, "Dieser Buchcode existiert nicht.", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } }