Beispiel #1
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}"));
        }
Beispiel #2
0
    protected void InsertData()
    {
        BannerInfo info = bBLL.GetDataById(id);

        info.bc_id       = Tools.TryParseMethod(ddrBannerCategory.SelectedValue);
        info.bl_id       = Tools.TryParseMethod(ddrBannerLocation.SelectedValue);
        info.bcs_id      = Tools.TryParseMethod(ddrBannerCustomer.SelectedValue);
        info.b_title     = txtName.Text;
        info.b_url       = txtWebUrl.Text;
        info.b_imagename = hfImageIndex.Value;
        info.b_price     = Tools.TryParseMethod(txtPrice.Text);
        info.b_prob      = Tools.TryParseMethod(txtProb.Text);
        info.b_target    = ddlTarget.SelectedValue;
        info.b_editDate  = DateTime.Now;
        info.b_startDate = Tools.TryParseDateMethod(txtStartDate.Text);
        info.b_endDate   = Tools.TryParseDateMethod(txtEndDate.Text);
        if (bBLL.Update(info) > 0)
        {
            Response.Redirect("List.aspx?header=修改訊息完成!", true);
        }
    }