Exemple #1
0
        private void btnRebateOK_Click(object sender, EventArgs e)
        {
            if (txtRebateName.Text.Trim() == "")
            {
                return;
            }

            ProductField f = cmbFieldSelection.SelectedItem as ProductField;

            if (f == null)
            {
                return;
            }
            f.SetRebateName(txtRebateName.Text.Trim());
            f.RebateType = cmbRebateType.SelectedItem as RebateType;

            if (!f.GridColumn.Visible)
            {
                f.GridColumn.Visible      = true;
                f.GridColumn.VisibleIndex = 4;
            }

            FillMeasureCombo();
            SetRebatesTab();
            pnlRebate.Visible = false;
        }
        private void btnApplyRate_Click(object sender, EventArgs e)
        {
            decimal dd      = 0;
            bool    success = false;

            success = decimal.TryParse(txtAmount.Text, out dd);
            if (!success)
            {
                return;
            }

            ProductField f = cmbFieldSelection.SelectedItem as ProductField;

            if (f == null)
            {
                return;
            }

            foreach (Product p in this.Products)
            {
                if (f.GridColumn == this.Rebate1)
                {
                    p.VarRebate1 = dd;
                    p.CalculatePromoPrice();
                }
                else if (f.GridColumn == this.Rebate2)
                {
                    p.VarRebate2 = dd;
                    p.CalculatePromoPrice();
                }
                else if (f.GridColumn == this.Rebate3)
                {
                    p.VarRebate3 = dd;
                    p.CalculatePromoPrice();
                }
                else if (f.GridColumn == this.Rebate4)
                {
                    p.VarRebate4 = dd;
                    p.CalculatePromoPrice();
                }
                else if (f.GridColumn == this.Rebate5)
                {
                    p.VarRebate5 = dd;
                    p.CalculatePromoPrice();
                }
                else if (f.GridColumn == this.BaseCasePrice)
                {
                    p.BaseCasePrice = dd;
                    p.CalculatePromoPrice();
                }
                else if (f.GridColumn == this.PromoCasePrice)
                {
                    p.PromoCasePrice = dd;
                }
            }
            grdProduct.RefreshDataSource();
        }
        private void cmbFieldSelection_SelectedIndexChanged(object sender, EventArgs e)
        {
            ProductField f = cmbFieldSelection.SelectedItem as ProductField;

            if (f == null)
            {
                return;
            }
            txtRebateName.Text = f.GridColumn.Caption;
        }
        private void btnRedefine_Click(object sender, EventArgs e)
        {
            pnlRebate.Visible = true;

            ProductField f = cmbFieldSelection.SelectedItem as ProductField;

            if (f == null)
            {
                return;
            }

            txtRebateName.Text = f.GridColumn.Caption;
        }
        private void btnRebateOK_Click(object sender, EventArgs e)
        {
            if (txtRebateName.Text.Trim() == "")
            {
                return;
            }

            ProductField f = cmbFieldSelection.SelectedItem as ProductField;

            if (f == null)
            {
                return;
            }
            f.SetRebateName(txtRebateName.Text.Trim());

            pnlRebate.Visible = false;
        }