コード例 #1
0
ファイル: Add.aspx.cs プロジェクト: nieo7/chienyehtsai
    protected void InsertData()
    {
        BannerInfo info = new BannerInfo();

        info.bc_id       = Tools.TryParseMethod(ddrBannerCategory.SelectedValue);
        info.bcs_id      = Tools.TryParseMethod(ddrBannerCustomer.SelectedValue);
        info.bl_id       = Tools.TryParseMethod(ddrBannerLocation.SelectedValue);
        info.b_title     = txtName.Text;
        info.b_url       = txtWebUrl.Text;
        info.b_imagename = hfNewsImage.Value;
        info.b_price     = Tools.TryParseMethod(txtPrice.Text);
        info.b_prob      = Tools.TryParseMethod(txtProb.Text);
        info.b_target    = ddlTarget.SelectedValue;
        info.b_hits      = 0;
        info.b_ts        = DateTime.Now;
        info.b_editDate  = DateTime.Now;
        info.b_startDate = DateTime.Parse(txtStartDate.Text);
        info.b_endDate   = DateTime.Parse(txtEndDate.Text);
        if (bBLL.Insert(info) > 0)
        {
            //加入BannerPic資料表
            BannerInfo bpinfos = bBLL.GetLastBanner();
            InsertBannerImage(bpinfos.b_id);
            Response.Redirect("List.aspx?header=" + Getmessage("30009"));
        }
    }
コード例 #2
0
        public ActionResult Edit(int Id = 0, string Title = "", string WapUrl = "", string ImgUrl = "", int State = 0, string StartTime = "", string EndTime = "", int Sort = 0)
        {
            Banner kv = new Banner();

            if (Id > 0)
            {
                kv = bannerDao.Single(Id);
            }
            JObject data = new JObject();

            kv.Title     = Title;
            kv.WapURL    = WapUrl;
            kv.ImgUrl    = ImgUrl;
            kv.Sort      = Sort;
            kv.State     = State;
            kv.StartTime = Convert.ToDateTime(StartTime);
            kv.EndTime   = Convert.ToDateTime(EndTime);
            bool flag = false;

            if (kv.ID > 0)
            {
                flag = bannerDao.Update(kv);
            }
            else
            {
                flag = bannerDao.Insert(kv) > 0;
            }
            int    state = flag ? 0 : -100;
            string msg   = flag ? "操作成功" : "操作失败";
            string url   = "/Banner/";

            MemcachHelper.Delete(Constant.list_banner_key);//清理缓存
            return(new RedirectResult($"/Prompt?state={state}&msg={msg}&url={url}"));
        }