示例#1
0
    private void EditSavePage()
    {
        int      id        = int.Parse(Utils.GetRequest("id", "post", 2, @"^[0-9]\d*$", "ID错误"));
        string   Title     = Utils.GetRequest("Title", "post", 2, @"^[\s\S]{2,20}$", "请输入20字内的广告标题");
        string   AdUrl     = Utils.GetRequest("AdUrl", "post", 2, @"^[\s\S]{1,500}$", "广告限500字内,不能留空");
        DateTime StartTime = Utils.ParseTime(Utils.GetRequest("StartTime", "post", 2, DT.RegexTime, "投放时间格式填写出错,正确格式如" + DateTime.Now.ToString("yyy-MM-dd HH:mm:ss") + ""));
        DateTime OverTime  = Utils.ParseTime(Utils.GetRequest("OverTime", "post", 2, DT.RegexTime, "过期时间格式填写出错,正确格式如" + DateTime.Now.ToString("yyy-MM-dd HH:mm:ss") + ""));
        int      Click     = int.Parse(Utils.GetRequest("Click", "post", 2, @"^[0-9]\d*$", "点击数填写错误"));
        int      iGold     = int.Parse(Utils.GetRequest("iGold", "post", 2, @"^[0-9]\d*$", "会员点击送币填写错误,不送币请填0"));
        int      adType    = int.Parse(Utils.GetRequest("adType", "post", 2, @"^[0-2]$", "送币性质选择错误"));
        int      Status    = int.Parse(Utils.GetRequest("Status", "post", 2, @"^[0-9]\d*$", "状态选择错误"));

        if (!new BCW.BLL.Advert().Exists(id))
        {
            Utils.Error("不存在的记录", "");
        }
        //过期时间应大于投放时间
        if (StartTime > OverTime)
        {
            Utils.Error("过期时间应大于投放时间", "");
        }
        //广告类型
        int UrlType = 0;

        if (AdUrl.Contains("<") || AdUrl.Contains("&gt;"))
        {
            UrlType = 2;
        }
        else if (AdUrl.Contains("[") || AdUrl.Contains("("))
        {
            UrlType = 1;
        }
        else
        {
            UrlType = 0;
        }
        BCW.Model.Advert model = new BCW.Model.Advert();
        model.ID        = id;
        model.Title     = Title;
        model.AdUrl     = AdUrl;
        model.StartTime = StartTime;
        model.OverTime  = OverTime;
        model.iGold     = iGold;
        model.adType    = adType;
        model.Status    = Status;
        model.Click     = Click;
        model.UrlType   = UrlType;
        model.AddTime   = DateTime.Now;
        new BCW.BLL.Advert().Update(model);
        Utils.Success("修改广告", "修改广告成功..", Utils.getPage("advert.aspx"), "1");
    }
示例#2
0
文件: Advert.cs 项目: radtek/GitKB288
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(BCW.Model.Advert model)
 {
     dal.Update(model);
 }
示例#3
0
文件: Advert.cs 项目: radtek/GitKB288
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(BCW.Model.Advert model)
 {
     return(dal.Add(model));
 }