Esempio n. 1
0
        public static void showError(string text)
        {
            Error2 error2 = new Error2();

            error2.setErrorText(text);
            int num = (int)error2.ShowDialog();
        }
        private void bSubmit_Click(object sender, EventArgs e)
        {
            bool   flag = true;
            string text = "";

            if (this.tbInstrumentId.Text == "")
            {
                text += "Instrument id must be defined\n";
                flag  = false;
            }
            if (this.tbExchange.Text == "" && this.cbProvider.Text == "Rithmic")
            {
                text += "Exchange must be defined";
                flag  = false;
            }
            if (this.tbName.Text == "")
            {
                text += "Name  must be defined";
                flag  = false;
            }
            if (this.cbProvider.Text == "")
            {
                text += "Provider must be defined";
                flag  = false;
            }
            if (!flag)
            {
                Error2.showError(text);
            }
            else
            {
                LicenseServiceClient licenseServiceClient = new LicenseServiceClient();
                int num = licenseServiceClient.addInstrument(new InstrumentsContract()
                {
                    DisplayId   = this.tbInstrumentId.Text,
                    Description = this.tbName.Text,
                    Parametr1   = this.tbExchange.Text,
                    ProviderId  = this.providerDict[this.cbProvider.Text]
                });
                licenseServiceClient.Close();
                if (num == 0)
                {
                    Error2.showError("Instument already under revision");
                }
                else
                {
                    if (num != 1)
                    {
                        return;
                    }
                    Error2.showError("Your request has been added");
                }
            }
        }