Beispiel #1
0
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <TFXK.Model.Ads> DataTableToList(DataTable dt)
        {
            List <TFXK.Model.Ads> modelList = new List <TFXK.Model.Ads>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                TFXK.Model.Ads model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new TFXK.Model.Ads();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    model.title = dt.Rows[n]["title"].ToString();
                    if (dt.Rows[n]["typeid"].ToString() != "")
                    {
                        model.typeid = int.Parse(dt.Rows[n]["typeid"].ToString());
                    }
                    model.linkUrl   = dt.Rows[n]["linkUrl"].ToString();
                    model.linkImage = dt.Rows[n]["linkImage"].ToString();
                    model.linkdes   = dt.Rows[n]["linkdes"].ToString();
                    if (dt.Rows[n]["orderid"].ToString() != "")
                    {
                        model.orderid = int.Parse(dt.Rows[n]["orderid"].ToString());
                    }
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
Beispiel #2
0
    protected void ibtnAdd_Click(object sender, EventArgs e)
    {
        try
        {
            TFXK.Model.Ads model = new TFXK.Model.Ads();
            try
            {
                model.id = int.Parse(Request.QueryString["id"].ToString());
            }
            catch { model.id = 0; }
            model.title   = txtTitle.Text;
            model.orderid = int.Parse(txtOrderby.Text);
            model.linkUrl = txtLinkUrl.Text;
            model.typeid  = int.Parse(ddlPicArea.SelectedValue);

            if (hdfImgPath.Value.Length > 10)
            {
                model.linkImage = hdfImgPath.Value;
            }
            string type = this.hdfAction.Value.Trim();
            // 判断动作
            switch (type)
            {
            case "add":
                Add(model);
                break;

            case "modify":
                Modify(model);
                break;
            }
        }
        catch (Exception ex)
        {
            log.Error(ex.Message);
            ArtDilog.Alert("网络错误!原因:" + ex.Message, "error", 2);
        }
    }
Beispiel #3
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(TFXK.Model.Ads model)
 {
     dal.Update(model);
 }
Beispiel #4
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TFXK.Model.Ads model)
 {
     return(dal.Add(model));
 }