Ejemplo n.º 1
0
        private void cbCountryID_SelectedValueChanged(object sender, EventArgs e)
        {
            cbDocName.SelectedValueChanged -= new EventHandler(cbDocName_SelectedValueChanged);
            cbDocName.Items.Clear();
            cbDocName.Text  = null;
            txtType.Text    = null;
            txtXmlText.Text = null;

            mng.CountryDetail detail = (mng.CountryDetail)cbCountryID.SelectedItem;
            if (detail != null)
            {
                var service2 = new vp.VoucherNumberingAllocationPrinting();
                var formats  = service2.GetSavedVoucherFormats(detail.Number);
                foreach (var format in formats)
                {
                    cbDocName.Items.Add(format);
                }
            }

            cbDocName.SelectedValueChanged += new EventHandler(cbDocName_SelectedValueChanged);
        }
Ejemplo n.º 2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(cbDocName.Text))
            {
                this.ShowExclamation("Doc name may not be empty.");
                return;
            }

            if (string.IsNullOrEmpty(txtType.Text))
            {
                this.ShowExclamation("Voucher type should be a valid C# class name.");
                return;
            }

            if (Type.GetType(txtType.Text) == null)
            {
                this.ShowExclamation("Can not create type of: " + txtType.Text);
                return;
            }

            mng.CountryDetail detail = (mng.CountryDetail)cbCountryID.SelectedItem;
            if (detail == null)
            {
                this.ShowExclamation("No country selected");
                return;
            }

            txtXmlText.refresh();

            var service = new vp.VoucherNumberingAllocationPrinting();

            service.SaveVoucherFormat(cbDocName.Text, detail.Number, txtXmlText.Text, 0, txtType.Text);

            ServiceDataAccess.Instance.LogOperation(OperationHistory.ScanLayoutUpdate, Program.SessionId, detail.Number, 0, 0, 0, 0, cbDocName.Text.join("-", txtType.Text));

            this.ShowInfo("Format '" + cbDocName.Text + "' saved.");

            ReloadLayouts();
        }