Beispiel #1
0
 /// <summary>
 /// 更新一条数据
 /// </summary>
 public bool Update(Cms.Model.sc_Product model)
 {
     return(dal.Update(model));
 }
Beispiel #2
0
    protected void btnSubmit_Click(object sender, EventArgs e)
    {
        Cms.BLL.sc_Product   bll = new Cms.BLL.sc_Product();
        Cms.Model.sc_Product bml = new Cms.Model.sc_Product();
        string action            = this.Request.QueryString["action"] ?? "";//编辑:edit 添加:add
        int    id  = Convert.ToInt32(this.Request.QueryString["id"] ?? "0");
        bool   bl  = false;
        bool   bls = true;

        string urlhot = Request.Url.Host.ToString();

        if (action == "add")
        {
            bml.pid        = int.Parse(ddpid.SelectedValue.ToString());
            bml.Material   = ddcz.SelectedValue.ToString();
            bml.pname      = tbtilte.Text.Trim();
            bml.Price      = Convert.ToDecimal(tbPrice.Text.Trim());
            bml.marketpice = Convert.ToDecimal(tbmarketpice.Text.Trim());
            bml.Property   = tbProperty.Text;
            bml.isjf       = int.Parse(isjf.SelectedValue.ToString());
            bml.picurl     = photoUrl.Text.Trim();
            bml.stock      = int.Parse(tbstock.Text.Trim());
            bml.integral   = int.Parse(tbintegral.Text.Trim());
            bml.content    = tbinfo.Value;
            bml.updatetime = DateTime.Now;

            bl = bll.Add(bml) > 0 ? true : false;
        }
        else
        {
            bml            = bll.GetModel(id);
            bml.pid        = int.Parse(ddpid.SelectedValue.ToString());
            bml.Material   = ddcz.SelectedValue.ToString();
            bml.pname      = tbtilte.Text.Trim();
            bml.Price      = Convert.ToDecimal(tbPrice.Text.Trim());
            bml.marketpice = Convert.ToDecimal(tbmarketpice.Text.Trim());
            bml.Property   = tbProperty.Text;
            bml.isjf       = int.Parse(isjf.SelectedValue.ToString());
            bml.picurl     = photoUrl.Text.Trim();
            bml.stock      = int.Parse(tbstock.Text.Trim());
            bml.integral   = int.Parse(tbintegral.Text.Trim());
            bml.content    = tbinfo.Value;
            bml.updatetime = DateTime.Now;
            bl             = bll.Update(bml);
        }
        if (bl && bls)
        {
            if (action == "add")
            {
                adminUser.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "添加产品" + tbtilte.Text); //记录日志
                ShowConfirm("是否继续添加?", "productedit.aspx?action=add", "productlist.aspx");
            }
            else
            {
                adminUser.AddAdminLog(DTEnums.ActionEnum.Add.ToString(), "修改产品" + tbtilte.Text); //记录日志
                JscriptMsg("提交成功!", "productlist.aspx", "Success");
            }
        }
        else
        {
            JscriptMsg("提交失败!", "productedit.aspx?action=edit?id=" + id, "Error");
        }
    }
Beispiel #3
0
 /// <summary>
 /// 增加一条数据
 /// </summary>
 public int  Add(Cms.Model.sc_Product model)
 {
     return(dal.Add(model));
 }