public FormWeight2(Tartim.SCENARIO Scenario) { InitializeComponent(); // Senaryo scenario = Scenario; // Tartýmlarý çekelim ve Combobox'a dolduralým tartims = Tartim.getTartims(scenario); if (tartims == null) { MessageBox.Show("Herhangi bir açýk tartým bulunamadý"); this.Close(); return; } cmbPlate.Items.Clear(); for (int n = 0; n < tartims.Length; n++) { cmbPlate.Items.Add(tartims[n].plateNumber.plateNumber); } // Senaryoya baðlý olarak belli alanlarý kapatacaðýz if (scenario != Tartim.SCENARIO.SALES) { txtBag.Enabled = false; } // Event'leri serbest býrak enablePlateEvents = true; }
private void btnSave_Click(object sender, EventArgs e) { tartim.areaFrom = txtFrom.Text; tartim.areaTo = txtTo.Text; tartim.counterPartyDocumentNumber = txtMubel.Text; tartim.firstWeight = weightMain.weight; tartim.notes = txtFree.Text; tartim.platformWeight = Program.steelyard.weight; tartim.driver = txtDrive.Text; tartim.employee = txtOpera.Text; if (tartim.document == null) { if (cmbParty.SelectedIndex == 0 || cmbMaterial.SelectedIndex == 0 || (scenario != Tartim.SCENARIO.SALES && cmbTransporter.SelectedIndex == 0)) { MessageBox.Show("Lütfen verilerin tamamýný seçin"); return; } tartim.counterParty = counterParty[cmbParty.SelectedIndex - 1]; tartim.material = material[cmbMaterial.SelectedIndex - 1]; tartim.plateNumber = plateMain.plateNumber; tartim.scenario = scenario; if (cmbTransporter.SelectedIndex > 0) { tartim.transporter = transporter[cmbTransporter.SelectedIndex - 1]; } } try { tartim.saveFirst(); } catch (TartimMissingFieldException ex) { MessageBox.Show("Eksik alan: " + ex.missingField, "Hata", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } Program.lastOperator = tartim.employee; tartim = Tartim.getTartims(plateMain.plateNumber, Tartim.ORDER.SECOND)[0]; setEverythingEnabled(false); plateMain.Enabled = false; }
private void getTartims() { Tartim.SCENARIO s = Tartim.SCENARIO.NULL; switch (cmbScenario.SelectedIndex) { case 0: s = Tartim.SCENARIO.NULL; break; case 1: s = Tartim.SCENARIO.PURCHASING; break; case 2: s = Tartim.SCENARIO.SALES; break; } tartims = Tartim.getTartims(date1.Value, date2.Value, s, ucPlate1.plateNumber); }
private void plateNumberEntered() { // Form setEverythingEnabled(false); // Bu plakaya istinaden bulabildiðimiz tartým / teslimatlarý bulalým try { tartimCandidates = Tartim.getTartims(plateMain.plateNumber, Tartim.ORDER.FIRST); } catch (TartimVehicleAlreadyPassedException ex) { MessageBox.Show("Bu araç ilk tartýmdan zaten geçmiþ"); return; } // Eðer herhangi birþey bulamadýysak, formu serbest býrakmalýyýz if (tartimCandidates == null) { tartim = new Tartim(); tartim.scenario = scenario; setComboBoxFree(cmbDocument); cmbDocument.Enabled = false; setComboBoxAndTextBoxFree(cmbParty, txtPartyNameAR); setComboBoxAndTextBoxFree(cmbMaterial, txtMaterialTextAR); setComboBoxAndTextBoxFree(cmbTransporter, txtTransporterNameAR); setTextBoxFree(txtFrom); setTextBoxFree(txtTo); setTextBoxFree(txtFree); setTextBoxFree(txtMubel); setTextBoxFree(txtOpera); txtOpera.Text = Program.lastOperator; setTextBoxFree(txtDrive); if (scenario == Tartim.SCENARIO.SALES) { counterParty = Counterparty.getAll(Counterparty.TYPE.CLIENT); } else { counterParty = Counterparty.getAllVendors(Counterparty.VENDOR_TYPE.VENDOR); } cmbParty.Items.Add("--- LÜTFEN SEÇÝNÝZ ---"); for (int n = 0; n < counterParty.Length; n++) { cmbParty.Items.Add(counterParty[n].ToString()); } cmbParty.DropDownStyle = ComboBoxStyle.DropDownList; cmbParty.SelectedIndex = 0; txtPartyNameAR.Enabled = false; material = Material.getAll(scenario); cmbMaterial.Items.Add("--- LÜTFEN SEÇÝNÝZ ---"); for (int n = 0; n < material.Length; n++) { cmbMaterial.Items.Add(material[n].ToString()); } cmbMaterial.DropDownStyle = ComboBoxStyle.DropDownList; cmbMaterial.SelectedIndex = 0; txtMaterialTextAR.Enabled = false; transporter = Counterparty.getAllVendors(Counterparty.VENDOR_TYPE.TRANSPORTER); cmbTransporter.Items.Add(scenario == Tartim.SCENARIO.SALES ? "(Müþterinin Aracý)" : "--- LÜTFEN SEÇÝNÝZ ---"); for (int n = 0; n < transporter.Length; n++) { cmbTransporter.Items.Add(transporter[n].ToString()); } cmbTransporter.DropDownStyle = ComboBoxStyle.DropDownList; cmbTransporter.SelectedIndex = 0; txtTransporterNameAR.Enabled = false; weightMain.Enabled = true; } // Eðer birþeyler bulduysak, formu ona göre dolduralým else { if (tartimCandidates.Length == 1) { tartim = tartimCandidates[0]; setComboBoxFree(cmbDocument); cmbDocument.Enabled = false; cmbDocument.Text = tartim.document.ToString(); displayTartim(); } else { cmbDocument.DropDownStyle = ComboBoxStyle.DropDownList; cmbDocument.Items.Clear(); cmbDocument.Items.Add("-- LÜTFEN ÝLGÝLÝ BELGEYÝ SEÇÝN --"); for (int n = 0; n < tartimCandidates.Length; n++) { cmbDocument.Items.Add(tartimCandidates[n].ToString()); } cmbDocument.SelectedIndex = 0; cmbDocument.DropDownStyle = ComboBoxStyle.DropDownList; cmbDocument.Enabled = true; enableDocumentEvent = true; } } }
public FormEdit(Tartim T) { InitializeComponent(); // Tartým tartim = T; tartim.deliveryUpperBoundExceeded += new Tartim.DeliveryUpperBoundExceededDelegate(tartim_deliveryUpperBoundExceeded); // Ana verileri çekelim if (tartim.scenario == Tartim.SCENARIO.PURCHASING) { counterParties = Counterparty.getAllVendors(Counterparty.VENDOR_TYPE.VENDOR); } else { counterParties = Counterparty.getAll(Counterparty.TYPE.CLIENT); } transporters = Counterparty.getAllVendors(Counterparty.VENDOR_TYPE.TRANSPORTER); materials = Material.getAll(tartim.scenario); // Formu dolduralým txtBag.Text = tartim.bagCount.ToString(); txtDate1.Text = tartim.firstWeightDate.ToShortDateString(); if (tartim.isOver) { txtDate2.Text = tartim.secondWeightDate.ToShortDateString(); } txtDrive.Text = tartim.driver; txtFree.Text = tartim.notes; txtFrom.Text = tartim.areaFrom; txtID.Text = tartim.weightId.ToString(); txtMubel.Text = tartim.counterPartyDocumentNumber; if (tartim.isOver) { txtNetWeight.Text = tartim.netWeight.getWeight().ToString(); } txtOpera.Text = tartim.employee; txtScenario.Text = Tartim.getScenarioText(tartim.scenario); txtSteelYard.Text = tartim.steelyard.ToString(); txtTo.Text = tartim.areaTo; txtWeight1.Text = tartim.firstWeight.getWeight().ToString(); if (tartim.isOver) { txtWeight2.Text = tartim.secondWeight.getWeight().ToString(); txtWtextAR.Text = tartim.weightTextAR; } plateMain.plateNumber = tartim.plateNumber; if (tartim.document != null) { plateMain.Enabled = false; } for (int n = 0; n < counterParties.Length; n++) { cmbParty.Items.Add(counterParties[n].ToString()); if (counterParties[n].id == tartim.counterParty.id) { cmbParty.SelectedIndex = n; } } for (int n = 0; n < transporters.Length; n++) { cmbTransporter.Items.Add(transporters[n].ToString()); if (tartim.transporter != null && transporters[n].id == tartim.transporter.id) { cmbTransporter.SelectedIndex = n; } } for (int n = 0; n < materials.Length; n++) { cmbMaterial.Items.Add(materials[n].ToString()); if (materials[n].id == tartim.material.id) { cmbMaterial.SelectedIndex = n; } } // Belge olayý switch (tartim.scenario) { case Tartim.SCENARIO.PURCHASING: cmbDocument.Enabled = false; break; case Tartim.SCENARIO.SALES: if (tartim.hasDocument) { cmbDocument.Items.Add(tartim.document.ToString()); cmbDocument.SelectedIndex = 0; tartimCandidates = Tartim.getTartims(plateMain.plateNumber); if (tartimCandidates == null) { cmbDocument.Enabled = false; } else { cmbDocument.Enabled = true; for (int n = 0; n < tartimCandidates.Length; n++) { cmbDocument.Items.Add(tartimCandidates[n].document.ToString()); } } cmbParty.Enabled = false; cmbTransporter.Enabled = false; cmbMaterial.Enabled = false; documentEventsEnabled = true; } else { cmbDocument.Enabled = false; } break; } // SAP'ye aktarýldýysa iyice kýsýtlayacaðýz if (tartim.transferredToSAP) { cmbDocument.Enabled = false; cmbMaterial.Enabled = false; cmbParty.Enabled = false; cmbTransporter.Enabled = false; btnSave.Enabled = false; txtBag.Enabled = false; txtDrive.Enabled = false; txtFree.Enabled = false; txtFrom.Enabled = false; txtTo.Enabled = false; txtFree.Enabled = false; txtMubel.Enabled = false; txtOpera.Enabled = false; txtWtextAR.Enabled = false; plateMain.Enabled = false; } }