Exemple #1
0
        private void TerminateYesBtn_Click_1(object sender, EventArgs e)
        {
            try
            {

                    IQuote terminQuote = new QuoteService();
                    bool check = terminQuote.TerminationRFQ(quoteId);

                    if (check)
                    {
                        MessageBox.Show("Quote was terminated. ", "Termination RFQ", MessageBoxButtons.OK);
                        instanceMainForm.LoadData();
                        this.Close();

                    }

                    else
                    {
                        throw new TerminationFailed();
                    }

            }
            catch (TerminationFailed)
            {
                MessageBox.Show("Quote was not terminated!", "Termination RFQ", MessageBoxButtons.OK);
            }
        }
 private void btnActiveBids_Click(object sender, EventArgs e)
 {
     requiredButton = 1;
     dgvBidsInfo.DataSource = null;
        // QuoteService qs = new QuoteService();
     IQuote quote = new QuoteService();
     dgvBidsInfo.DataSource = quote.GetAllActiveQuotes(compId);
     dgvBidsInfo.Columns["QuoteId"].Visible = false;
     dgvBidsInfo.Columns["CompanyId"].Visible = false;
     dgvBidsInfo.Columns["Status"].Visible = false;
     dgvBidsInfo.Columns["Text"].DisplayIndex = 1;
     dgvBidsInfo.Columns["Text"].Width = 250;
     dgvBidsInfo.Columns["Value"].DisplayIndex = 2;
     dgvBidsInfo.Columns["StartDate"].DisplayIndex = 3;
     dgvBidsInfo.Columns["EndDate"].DisplayIndex = 4;
 }
Exemple #3
0
        private void buttonCreate_Click(object sender, EventArgs e)
        {
            try
            {
                ApplicationServices appService = new ApplicationServices();
                bool emptyText = appService.EmptyTextValidation(this);
                appService.EmptyTextMark(this);

                if (!emptyText)
                    throw new EmptyText();

                DateTime StartDate = new DateTime();
                DateTime EndDate = new DateTime();
                string sStartDate = textBoxStartDate.Text;
                string sEndDate = textBoxEndDate.Text;
                bool startDateValid = DateTime.TryParse(sStartDate, out StartDate);
                bool endDateValid = DateTime.TryParse(sEndDate, out EndDate);

                if (!startDateValid)
                {
                    textBoxStartDate.BackColor = Color.Red;
                    throw new InvalidDateFormat();

                }

                if (!endDateValid)
                {
                    textBoxEndDate.BackColor = Color.Red;
                    throw new InvalidDateFormat();
                }

                if (StartDate > EndDate)
                {
                    throw new DateChronolgy();
                }

                QuoteDTO QuoteIn = new QuoteDTO();
                QuoteIn.CompanyID = companyIDIn;
                QuoteIn.StartDate = StartDate;
                QuoteIn.EndDate = EndDate;

                IQuote QuoteFunctions = new QuoteService();
                QuoteAdded QuoteValidation = QuoteFunctions.CreateNewQuoation(QuoteIn);
                if (QuoteValidation.Added == true)
                {
                    QuoteDetailToCreateDTO DetailToCreate = new QuoteDetailToCreateDTO();
                    DetailToCreate.QuoteID = QuoteValidation.LastId;
                    DetailToCreate.Text = textBoxDescription.Text;
                    string sValue = textBoxQuantity.Text;
                    decimal dValue;
                    bool isParsed = decimal.TryParse(sValue, out dValue);

                    if (!isParsed)
                    { throw new QuantityWrong(); }

                    DetailToCreate.Value = dValue;

                    bool check = QuoteFunctions.CreateNewQuoteDetail(DetailToCreate);

                    if (check)
                    {
                        MessageBox.Show("Quote was created. ", "app", MessageBoxButtons.OK);

                        this.Close();
                        instanceMainForm.LoadData();
                    }
                    else
                    {
                        throw new QuoteFailed();
                    }

                }
                else
                {
                    throw new QuoteFailed();
                }

            }
            catch (EmptyText et)
            {
                MessageBox.Show("Empty Text, all fields must be filled out.", "app", MessageBoxButtons.OK);
            }
            catch (InvalidDateFormat idf)
            {
                MessageBox.Show("Date format is invalid. Date format is: 'yyyy/mm/dd' ", "app", MessageBoxButtons.OK);

            }
            catch (QuoteFailed qf)
            {
                MessageBox.Show("Quote creation failed. Please check your data. ", "app", MessageBoxButtons.OK);

            }
            catch (DateChronolgy dc)
            {
                MessageBox.Show("Dates are not choronological. ", "app", MessageBoxButtons.OK);

            }
            catch(QuantityWrong qw)
            {
                MessageBox.Show("Quanity should be decimal. ", "app", MessageBoxButtons.OK);

            }
        }