예제 #1
0
        public static Counterparty[] getAllVendors(VENDOR_TYPE V)
        {
            Counterparty[] cnt = getAll(TYPE.VENDOR);

            ArrayList al = new ArrayList();

            for (int n = 0; n < cnt.Length; n++)
            {
                bool valid = true;

                if (V == VENDOR_TYPE.VENDOR && !cnt[n].usableAsVendor)
                {
                    valid = false;
                }
                if (V == VENDOR_TYPE.TRANSPORTER && !cnt[n].usableAsTransporter)
                {
                    valid = false;
                }

                if (valid)
                {
                    al.Add(cnt[n]);
                }
            }

            if (al.Count <= 0)
            {
                return(null);
            }

            Counterparty[] ret = new Counterparty[al.Count];
            for (int n = 0; n < al.Count; n++)
            {
                ret[n] = (Counterparty)al[n];
            }

            return(ret);
        }
예제 #2
0
        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;
                }
            }
        }
예제 #3
0
        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;
            }
        }