Пример #1
0
        private void btnSearchProm_Click(object sender, EventArgs e)
        {
            if (promotionLookupForm == null)
            {
                promotionLookupForm = new frmPromotionLookup();
            }
            promotionLookupForm.ShowDialog();

            if (promotionLookupForm.SelectedPromotion != null && (promotionLookupForm.SelectedPromotion.RowState == DataRowState.Unchanged))
            {
                DataRow row = promotionLookupForm.SelectedPromotion;

                this.txtPromID.Text          = row["promotionID"].ToString();
                this.txtPromName.Text        = row["promotionName"].ToString();
                this.txtPromTypeID.Text      = row["promotionTypeID"].ToString();
                this.txtBaseProductID.Text   = row["baseProductID"].ToString();
                this.txtBudgetProductID.Text = row["budgetProductID"].ToString();
                //this.txtBudgetProductID.Text = row["active"].ToString();
                this.txtPromCost.Text   = row["promotionCost"].ToString();
                this.txtPromBudget.Text = row["promotionBudget"].ToString();
                this.txtSortOrder.Text  = row["sortOrder"].ToString();
                this.txtStories.Text    = row["stories"].ToString();
                this.txtBrandID.Text    = row["brandID"].ToString();
                //this.txtRegionID.Text = row["regionID"].ToString();
                try
                {
                    DateTime temp = DateTime.Parse(row["effectiveDate"].ToString());
                    this.txtEffectiveDate.Text = temp.ToString("dd/MM/yyyy");
                }
                catch (FormatException fe)
                {
                    this.txtEffectiveDate.Text = "";
                    MessageBox.Show(fe.ToString());
                }
                if (row["active"].ToString() == "True")
                {
                    this.chkActive.Checked = true;
                }
                else
                {
                    this.chkActive.Checked = false;
                }
                if (row["published"].ToString() == "True")
                {
                    this.chkPublished.Checked     = true;
                    this.labelEfDate.Visible      = true;
                    this.txtEffectiveDate.Visible = true;
                }
                else
                {
                    this.chkPublished.Checked     = false;
                    this.labelEfDate.Visible      = false;
                    this.txtEffectiveDate.Visible = false;
                }
            }
        }
Пример #2
0
        private void btnSearchPromID_Click(object sender, EventArgs e)
        {
            if (promForm == null)
            {
                promForm = new frmPromotionLookup();
            }
            promForm.ShowDialog();

            if (promForm.SelectedPromotion != null && (promForm.SelectedPromotion.RowState == DataRowState.Unchanged))
            {
                DataRow row = promForm.SelectedPromotion;
                txtPromID.Text   = row["promotionID"].ToString();
                txtPromID2.Text  = row["promotionID"].ToString();
                txtPromName.Text = row["promotionName"].ToString();
            }
        }