示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                return;
            }
            int           id   = ConvertUtility.ToInt32(Request.QueryString["id"]);
            AdvertiseInfo info = AdvertiseDB.GetInfo(id);

            if (info == null)
            {
                ClientScript.RegisterStartupScript(typeof(Page), "Close", "<script>javascript:window.close()</script>");
                return;
            }
            else
            {
                if (info.Advertise_RedirectURL == string.Empty)
                {
                    ClientScript.RegisterStartupScript(typeof(Page), "Close", "<script>javascript:window.close()</script>");
                }
                else
                {
                    AdvertiseDB.Clicks(info.Advertise_ID, 1);
                    Response.Redirect(info.Advertise_RedirectURL);
                }
            }
        }
示例#2
0
        protected void cmdUpdate_Click(object sender, EventArgs e)
        {
            AdvertiseInfo info = AdvertiseDB.GetInfo(ConvertUtility.ToInt32(txtID.Text));

            if (info == null)
            {
                cmdEmpty_Click(null, null); return;
            }
            info.Advertise_Name        = txtName.Text;
            info.Advertise_Enable      = chkEnable.Checked;
            info.Advertise_Height      = ConvertUtility.ToInt32(txtHeight.Text);
            info.Advertise_Width       = ConvertUtility.ToInt32(txtWidth.Text);
            info.Advertise_StartDate   = SelectDate1.GetDate();
            info.Advertise_EndDate     = SelectDate2.GetDate();
            info.Advertise_Path        = txtPath.Text;
            info.Advertise_PositionID  = ConvertUtility.ToInt32(lstPositions.SelectedValue);
            info.Advertise_Type        = dropType.SelectedValue;
            info.Advertise_RedirectURL = txtUrl.Text;
            info.Advertise_Lang        = AppEnv.GetLanguage();
            string location = string.Empty;

            foreach (ListItem item in lstZones.Items)
            {
                if (item.Selected)
                {
                    location += item.Value + "|";
                }
            }
            info.Advertise_Params = location;
            info.Advertise_Embed  = txtEmbed.Text.Trim();

            try
            {
                AdvertiseDB.Update(info);
                lblStatusUpdate.Text = MiscUtility.UPDATE_SUCCESS;
            }
            catch
            {
                lblStatusUpdate.Text = MiscUtility.UPDATE_ERROR;
            }
        }
示例#3
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;
                }
            }
        }