예제 #1
0
    protected void BTN_Add_Click(object sender, EventArgs e)
    {
        if (CheckNull())
        {
            if (DDL_SiteList.SelectedValue != Guid.Empty.ToString())
            {
                AdsInfo info = new AdsInfo(new Guid(DDL_SiteList.SelectedValue), TB_AdsName.Text.Trim(), TB_AdsSize.Text.Trim());
                info.AdsType = int.Parse(DDL_AdsType.SelectedValue);

                FUP_Up.SaveAs(Server.MapPath("~/adsimg") + "/" + info.AdsId + ".jpg");
                info.AdsPic = "/adsimg/" + info.AdsId + ".jpg";

                adsSiteDal.AddAds(info);
                CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLADSINFO);
                Response.Redirect("AddAds.aspx?siteid=" + info.SiteId);
            }
        }
    }
예제 #2
0
    protected void BTN_Add_Click(object sender, EventArgs e)
    {
        if (DDL_SiteList.SelectedValue != Guid.Empty.ToString())
        {
            SiteAdsInfo info = new SiteAdsInfo();
            info.AdsId        = new Guid(DDL_AdsList.SelectedValue);
            info.SiteId       = new Guid(DDL_SiteList.SelectedValue);
            info.AdsPosition  = TB_AdsName.Text.Trim();
            info.AdsCount     = int.Parse(TB_Count.Text.Trim());
            info.AdsCalCount  = info.AdsCount;
            info.PositionCode = int.Parse(TB_PostCode.Text.Trim());
            info.Id           = Guid.NewGuid();

            FUP_Up.SaveAs(Server.MapPath("~/adsimg") + "/" + info.Id + ".jpg");
            info.AdsPic = "/adsimg/" + info.Id + ".jpg";

            new SiteAdsService().InsertSiteAds(info);
            CacheCollection.RemoveCacheByKey(CacheCollection.KEY_ALLSITEADS);
            Response.Redirect("AddAds.aspx?siteid=" + info.SiteId);
        }
    }