コード例 #1
0
ファイル: ProductsBLL.cs プロジェクト: uewill/qsnwl
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public void Update(TFXK.Model.Products model)
 {
     dal.Update(model);
 }
コード例 #2
0
ファイル: ProductsBLL.cs プロジェクト: uewill/qsnwl
        /// <summary>
        /// 获得数据列表
        /// </summary>
        public List <TFXK.Model.Products> DataTableToList(DataTable dt)
        {
            List <TFXK.Model.Products> modelList = new List <TFXK.Model.Products>();
            int rowsCount = dt.Rows.Count;

            if (rowsCount > 0)
            {
                TFXK.Model.Products model;
                for (int n = 0; n < rowsCount; n++)
                {
                    model = new TFXK.Model.Products();
                    if (dt.Rows[n]["id"].ToString() != "")
                    {
                        model.id = int.Parse(dt.Rows[n]["id"].ToString());
                    }
                    if (dt.Rows[n]["parentID"].ToString() != "")
                    {
                        model.parentID = int.Parse(dt.Rows[n]["parentID"].ToString());
                    }
                    model.title  = dt.Rows[n]["title"].ToString();
                    model.codeNo = dt.Rows[n]["codeNo"].ToString();
                    if (dt.Rows[n]["brandID"].ToString() != "")
                    {
                        model.brandID = int.Parse(dt.Rows[n]["brandID"].ToString());
                    }
                    model.brandName = dt.Rows[n]["brandName"].ToString();
                    model.danwei    = dt.Rows[n]["danwei"].ToString();
                    if (dt.Rows[n]["salePrice"].ToString() != "")
                    {
                        model.salePrice = decimal.Parse(dt.Rows[n]["salePrice"].ToString());
                    }
                    if (dt.Rows[n]["cusPrice"].ToString() != "")
                    {
                        model.cusPrice = decimal.Parse(dt.Rows[n]["cusPrice"].ToString());
                    }
                    model.mianliao  = dt.Rows[n]["mianliao"].ToString();
                    model.colorname = dt.Rows[n]["colorname"].ToString();
                    model.cpdes     = dt.Rows[n]["cpdes"].ToString();
                    model.fzccdes   = dt.Rows[n]["fzccdes"].ToString();
                    model.xdbxdes   = dt.Rows[n]["xdbxdes"].ToString();
                    model.shfwdes   = dt.Rows[n]["shfwdes"].ToString();
                    model.admindes  = dt.Rows[n]["admindes"].ToString();
                    if (dt.Rows[n]["clicks"].ToString() != "")
                    {
                        model.clicks = int.Parse(dt.Rows[n]["clicks"].ToString());
                    }
                    if (dt.Rows[n]["orderID"].ToString() != "")
                    {
                        model.orderID = int.Parse(dt.Rows[n]["orderID"].ToString());
                    }
                    if (dt.Rows[n]["isHot"].ToString() != "")
                    {
                        model.isHot = int.Parse(dt.Rows[n]["isHot"].ToString());
                    }
                    if (dt.Rows[n]["isTuijian"].ToString() != "")
                    {
                        model.isTuijian = int.Parse(dt.Rows[n]["isTuijian"].ToString());
                    }
                    if (dt.Rows[n]["desFild1"].ToString() != "")
                    {
                        model.desFild1 = int.Parse(dt.Rows[n]["desFild1"].ToString());
                    }
                    model.desFild2 = dt.Rows[n]["desFild2"].ToString();
                    model.desFild3 = dt.Rows[n]["desFild3"].ToString();
                    model.desFild4 = dt.Rows[n]["desFild4"].ToString();
                    if (dt.Rows[n]["typeID"].ToString() != "")
                    {
                        model.typeID = int.Parse(dt.Rows[n]["typeID"].ToString());
                    }
                    model.imgPath = dt.Rows[n]["imgPath"].ToString();
                    modelList.Add(model);
                }
            }
            return(modelList);
        }
コード例 #3
0
ファイル: ProductsBLL.cs プロジェクト: uewill/qsnwl
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int Add(TFXK.Model.Products model)
 {
     return(dal.Add(model));
 }
コード例 #4
0
ファイル: Action.aspx.cs プロジェクト: uewill/qsnwlweb
    protected void ibtnAdd_Click(object sender, EventArgs e)
    {
        //验证代码
        try
        {
            TFXK.Model.Products model = new TFXK.Model.Products();
            try
            {
                model.id = int.Parse(Request.QueryString["id"].ToString());
            }
            catch { model.id = 0; }

            model.title = txtTitle.Text;
            try
            {
                model.clicks = int.Parse(this.txtClick.Text);
            }
            catch
            {
                model.clicks = 0;
            }

            try
            {
                model.orderID = int.Parse(txtOrderby.Text);
            }
            catch
            {
                model.orderID = 0;
            }

            model.cpdes     = txtCpmsDes.Value;
            model.codeNo    = this.txtCode.Text;
            model.brandName = txtBrandName.Text;
            model.danwei    = txtDanwei.Text;
            try
            {
                model.salePrice = decimal.Parse(txtSalePrice.Text);
            }
            catch
            {
                model.salePrice = 0;
            }

            try
            {
                model.cusPrice = decimal.Parse(txtCusPrice.Text);
            }
            catch
            {
                model.cusPrice = 0;
            }

            model.mianliao  = txtMianliao.Text;
            model.colorname = txtColorName.Text;
            model.parentID  = int.Parse(ddlType.SelectedValue);
            model.admindes  = txtDescription.Text;
            if (hdfImgPath.Value.Length > 10)
            {
                model.imgPath = hdfImgPath.Value;
            }

            model.cpdes   = txtCpmsDes.Value;
            model.fzccdes = txtFzccDes.Value;
            model.xdbxdes = txtXdbyDes.Value;
            model.shfwdes = txtSHfwDes.Value;

            model.desFild1  = chkIsCX.Checked == true ? 1 : 0;
            model.isTuijian = chkTuiJian.Checked == true ? 1 : 0;
            model.isHot     = chkIsHot.Checked == true ? 1 : 0;

            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);
            Msg.Show("网络错误!原因:" + ex.Message);
        }
    }