コード例 #1
0
        private void savePromotion()
        {
            try
            {
                Promotion promotion = new Promotion();
                promotion.Name = txtName.Text;
                promotion.Value = double.Parse(txtValue.Text);
                promotion.ImageUrl = txtImageUrl.Text;
                promotion.ShowOnFirstPage = chkShowOnFirstPage.Checked;
                promotion.DateFrom = DateTime.Parse(txtDateFrom.Text);
                promotion.DateTo = DateTime.Parse(txtDateTo.Text);
                if (lblPromotionID.Value != string.Empty)
                    promotion.PromotionID = int.Parse(lblPromotionID.Value);

                PromotionBL promotionBL = new PromotionBL();
                promotionBL.SavePromotion(promotion);
            }
            catch (BLException ex)
            {
                setStatus(ex.Message, System.Drawing.Color.Red, true);
            }
        }