Пример #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                if (ConvertUtility.ToBoolean(AppEnv.AdvInZone))
                {
                    ZoneUtility.LoadZones(lstZones.Items); lstZones.Enabled = true;
                    lstZones.Items.Insert(0, new ListItem("Root 0", "0"));
                }
                else
                {
                    lstZones.Items.Insert(0, new ListItem("Root 0", "0"));
                    lstZones.Enabled = false; lstZones.SelectedIndex = 0;
                }


                lstPositions.DataSource     = PositionDB.GetAll();
                lstPositions.DataTextField  = "Pos_Name";
                lstPositions.DataValueField = "Pos_ID";
                lstPositions.DataBind();

                SelectDate1.SetDate(DateTime.Now);
                SelectDate2.SetDate(DateTime.Now.AddYears(1));
            }
            txtPath.fpUploadDir = AppEnv.UploadAdvertise;
        }
Пример #2
0
        private void LoadAdvertise()
        {
            int adID = ConvertUtility.ToInt32(Request.QueryString["advertiseid"]);

            if (adID != 0)
            {
                cmdAddNew.Enabled  = false;
                cmdAddNext.Enabled = false;
                cmdEmpty.Enabled   = false;
            }
            else
            {
                adID = ConvertUtility.ToInt32(txtID.Text);
            }
            AdvertiseInfo info = AdvertiseDB.GetInfo(adID);

            if (info == null)
            {
                cmdEmpty_Click(null, null); return;
            }
            txtID.Text   = info.Advertise_ID.ToString();
            txtPath.Text = info.Advertise_Path;

            txtName.Text      = info.Advertise_Name;
            txtUrl.Text       = info.Advertise_RedirectURL;
            txtWidth.Text     = info.Advertise_Width.ToString();
            txtHeight.Text    = info.Advertise_Height.ToString();
            chkEnable.Checked = info.Advertise_Enable;

            SelectDate1.SetDate(info.Advertise_StartDate);
            SelectDate2.SetDate(info.Advertise_EndDate);
            dropType.SelectedIndex = -1;
            MiscUtility.SetSelected(dropType.Items, info.Advertise_Type);

            lstPositions.SelectedIndex = -1;
            MiscUtility.SetSelected(lstPositions.Items, info.Advertise_PositionID.ToString());

            PositionInfo posInfo = PositionDB.GetInfo(info.Advertise_PositionID);

            if (txtWidth.Text == "0")
            {
                txtWidth.Text = posInfo.Pos_Width.ToString();
            }
            if (txtHeight.Text == "0")
            {
                txtHeight.Text = posInfo.Pos_Height.ToString();
            }

            txtEmbed.Text = info.Advertise_Embed;

            foreach (ListItem item in lstZones.Items)
            {
                if (Convert.ToString("|" + info.Advertise_Params).IndexOf("|" + item.Value + "|") >= 0)
                {
                    item.Selected = true;
                }
                else
                {
                    item.Selected = false;
                }
            }
        }