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");
                }
            }
        }
Ejemplo n.º 2
0
        public string addNewInstrument(string _InstrumentId, string _Name, string _Parametr1, int _Provider, string _Parametr2 = "")
        {
            bool   flag = true;
            string str1 = "";

            if (_InstrumentId == "")
            {
                str1 += "Instrument id must be defined\n";
                flag  = false;
            }
            if (_Parametr1 == "" && _Provider == 3)
            {
                str1 += "Exchange must be defined";
                flag  = false;
            }
            if (_Name == "")
            {
                str1 += "Name  must be defined";
                flag  = false;
            }
            if (!flag)
            {
                return(str1);
            }
            string str2 = "";
            LicenseServiceClient licenseServiceClient = new LicenseServiceClient();
            int num = licenseServiceClient.addInstrument(new InstrumentsContract()
            {
                DisplayId   = _InstrumentId,
                Description = _Name,
                Parametr1   = _Parametr1,
                Parametr2   = _Parametr2,
                ProviderId  = _Provider
            });

            licenseServiceClient.Close();
            switch (num)
            {
            case 0:
                str2 = "Instument already under revision";
                break;

            case 1:
                str2 = "Your request has been added";
                break;
            }
            return(str2);
        }