protected void Repeater1_ItemDataBound(object sender, RepeaterItemEventArgs e) { if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem)) { int iID = Convert.ToInt32(DataBinder.Eval(e.Item.DataItem, "ID")); LinkButton lbtnAudit = (LinkButton)e.Item.FindControl("lbtnAudit"); LinkButton lbtnEdit = (LinkButton)e.Item.FindControl("lbtnEdit"); LinkButton lbtnDel = (LinkButton)e.Item.FindControl("lbtnDel"); LinkButton lbtnLucky = (LinkButton)e.Item.FindControl("lbtnLucky"); lgk.Model.tb_goods_cxth model = _goodsBLL.GetModel(iID); //IList<lgk.Model.tb_OrderDetail> list = orderDetailBLL.GetJoinListAll("o.TypeID = 5 AND d.ProcudeID = " + iID + ""); if (model.Purchase == model.SealPurchase && model.IsLucky == 0)// && list.Count >= 1) { lbtnLucky.Visible = true; } else if (model.Purchase == model.SealPurchase && model.IsLucky == 1) { lbtnAudit.Visible = false; lbtnEdit.Visible = false; lbtnDel.Visible = false; lbtnLucky.Visible = false; } else { lbtnLucky.Visible = false; } } }
protected void ShowInfo() { lgk.Model.tb_goods_cxth model = goodsOneBLL.GetModel(Convert.ToInt32(GetPID())); txtGoodsCode.Text = model.GoodsCode; //编号 txtGoodsName.Text = model.GoodsName; //名称 txtPrice.Text = model.Price.ToString(); //原价 txtRealityPrice.Text = model.RealityPrice.ToString("0"); //促销价 txtPurchase.Text = model.Purchase.ToString(); //竞拍次数 //txtCity.Text = model.City; dropOneType.SelectedValue = model.TypeID.ToString(); //一级 ListItem item_list = new ListItem(); item_list.Value = "0"; item_list.Text = "请选择"; this.dropSecondType.Items.Add(item_list); bind_DropDownList(this.dropSecondType, produceTypeBLL.GetList("ParentID=" + model.TypeID).Tables[0], "ID", "TypeName"); dropSecondType.SelectedValue = model.GoodsType.ToString();//二级 bind_DropDownList_ht(this.dropThreeType, produceTypeBLL.GetList("ParentID=" + dropSecondType.SelectedValue).Tables[0], "ID", "TypeName"); dropThreeType.SelectedValue = model.PareTopId.ToString(); //三级 textPubContext.Text = model.Remarks; //详情 Image1.ImageUrl = "../../Upload/" + model.Pic1; //图片 txtPlay.Text = model.Goods004; //支付时间 txtCount.Text = model.Goods006.ToString(); //数量 txtStart.Text = model.Goods007.ToString(); //k开始时间 txtEnd.Text = model.Goods008.ToString(); }
/// <summary> /// 增加一条数据 /// </summary> public int Add(lgk.Model.tb_goods_cxth model) { StringBuilder strSql = new StringBuilder(); strSql.Append("insert into tb_goods_cxth("); strSql.Append("GoodsCode,GoodsName,Price,RealityPrice,TypeID,GoodsType,Pic1,Pic2,Pic3,Pic4,Pic5,Remarks,AddTime,Goods001,Goods002,Goods003,Goods004,Goods005,Goods006,Goods007,Goods008,[UploadUser],[SealCount],PareTopId,City,Purchase,SealPurchase,UserCode)"); strSql.Append(" values ("); strSql.Append("@GoodsCode,@GoodsName,@Price,@RealityPrice,@TypeID,@GoodsType,@Pic1,@Pic2,@Pic3,@Pic4,@Pic5,@Remarks,@AddTime,@Goods001,@Goods002,@Goods003,@Goods004,@Goods005,@Goods006,@Goods007,@Goods008,@UploadUser,@SealCount,@PareTopId,@City,@Purchase,@SealPurchase,@UserCode)"); strSql.Append(";select @@IDENTITY"); SqlParameter[] parameters = { new SqlParameter("@GoodsCode", SqlDbType.VarChar, 100), new SqlParameter("@GoodsName", SqlDbType.VarChar, 100), new SqlParameter("@Price", SqlDbType.Decimal, 9), new SqlParameter("@RealityPrice", SqlDbType.Decimal, 9), new SqlParameter("@TypeID", SqlDbType.Int, 4), new SqlParameter("@GoodsType", SqlDbType.Int, 4), new SqlParameter("@Pic1", SqlDbType.VarChar, 100), new SqlParameter("@Pic2", SqlDbType.VarChar, 100), new SqlParameter("@Pic3", SqlDbType.VarChar, 100), new SqlParameter("@Pic4", SqlDbType.VarChar, 100), new SqlParameter("@Pic5", SqlDbType.VarChar, 100), new SqlParameter("@Remarks", SqlDbType.Text), new SqlParameter("@AddTime", SqlDbType.DateTime), new SqlParameter("@Goods001", SqlDbType.Int, 4), new SqlParameter("@Goods002", SqlDbType.Int, 4), new SqlParameter("@Goods003", SqlDbType.Int), new SqlParameter("@Goods004", SqlDbType.VarChar, 100), new SqlParameter("@Goods005", SqlDbType.Decimal, 9), new SqlParameter("@Goods006", SqlDbType.Int), new SqlParameter("@Goods007", SqlDbType.DateTime), new SqlParameter("@Goods008", SqlDbType.DateTime), new SqlParameter("@UploadUser", SqlDbType.Int), new SqlParameter("@SealCount", SqlDbType.Int), new SqlParameter("@PareTopId", SqlDbType.Int), new SqlParameter("@City", SqlDbType.VarChar, 20), new SqlParameter("@Purchase", SqlDbType.Int), new SqlParameter("@SealPurchase", SqlDbType.Int), new SqlParameter("@UserCode", SqlDbType.VarChar, 50) }; parameters[0].Value = model.GoodsCode; parameters[1].Value = model.GoodsName; parameters[2].Value = model.Price; parameters[3].Value = model.RealityPrice; parameters[4].Value = model.TypeID; parameters[5].Value = model.GoodsType; parameters[6].Value = model.Pic1; parameters[7].Value = model.Pic2; parameters[8].Value = model.Pic3; parameters[9].Value = model.Pic4; parameters[10].Value = model.Pic5; parameters[11].Value = model.Remarks; parameters[12].Value = model.AddTime; parameters[13].Value = model.Goods001; parameters[14].Value = model.Goods002; parameters[15].Value = model.Goods003; parameters[16].Value = model.Goods004; parameters[17].Value = model.Goods005; parameters[18].Value = model.Goods006; parameters[19].Value = model.Goods007; parameters[20].Value = model.Goods008; parameters[21].Value = model.UploadUser; parameters[22].Value = model.SealCount; parameters[23].Value = model.PareTopId; parameters[24].Value = model.City; parameters[25].Value = model.Purchase; parameters[26].Value = model.SealPurchase; parameters[27].Value = model.UserCode; object obj = DbHelperSQL.GetSingle(strSql.ToString(), parameters); if (obj == null) { return(0); } else { return(Convert.ToInt32(obj)); } }
public lgk.Model.tb_goods_cxth GetModel(string where) { StringBuilder strSql = new StringBuilder(); strSql.Append("select top 1 * from tb_goods_cxth where " + where); lgk.Model.tb_goods_cxth model = new lgk.Model.tb_goods_cxth(); DataSet ds = DbHelperSQL.Query(strSql.ToString(), null); if (ds.Tables[0].Rows.Count > 0) { if (ds.Tables[0].Rows[0]["ID"] != null && ds.Tables[0].Rows[0]["ID"].ToString() != "") { model.ID = int.Parse(ds.Tables[0].Rows[0]["ID"].ToString()); } if (ds.Tables[0].Rows[0]["GoodsCode"] != null && ds.Tables[0].Rows[0]["GoodsCode"].ToString() != "") { model.GoodsCode = ds.Tables[0].Rows[0]["GoodsCode"].ToString(); } if (ds.Tables[0].Rows[0]["GoodsName"] != null && ds.Tables[0].Rows[0]["GoodsName"].ToString() != "") { model.GoodsName = ds.Tables[0].Rows[0]["GoodsName"].ToString(); } if (ds.Tables[0].Rows[0]["Price"] != null && ds.Tables[0].Rows[0]["Price"].ToString() != "") { model.Price = decimal.Parse(ds.Tables[0].Rows[0]["Price"].ToString()); } if (ds.Tables[0].Rows[0]["RealityPrice"] != null && ds.Tables[0].Rows[0]["RealityPrice"].ToString() != "") { model.RealityPrice = decimal.Parse(ds.Tables[0].Rows[0]["RealityPrice"].ToString()); } if (ds.Tables[0].Rows[0]["TypeID"] != null && ds.Tables[0].Rows[0]["TypeID"].ToString() != "") { model.TypeID = int.Parse(ds.Tables[0].Rows[0]["TypeID"].ToString()); } if (ds.Tables[0].Rows[0]["GoodsType"] != null && ds.Tables[0].Rows[0]["GoodsType"].ToString() != "") { model.GoodsType = int.Parse(ds.Tables[0].Rows[0]["GoodsType"].ToString()); } if (ds.Tables[0].Rows[0]["PareTopId"] != null && ds.Tables[0].Rows[0]["PareTopId"].ToString() != "") { model.PareTopId = Convert.ToInt32(ds.Tables[0].Rows[0]["PareTopId"].ToString()); } if (ds.Tables[0].Rows[0]["Pic1"] != null && ds.Tables[0].Rows[0]["Pic1"].ToString() != "") { model.Pic1 = ds.Tables[0].Rows[0]["Pic1"].ToString(); } if (ds.Tables[0].Rows[0]["Pic2"] != null && ds.Tables[0].Rows[0]["Pic2"].ToString() != "") { model.Pic2 = ds.Tables[0].Rows[0]["Pic2"].ToString(); } if (ds.Tables[0].Rows[0]["Pic3"] != null && ds.Tables[0].Rows[0]["Pic3"].ToString() != "") { model.Pic3 = ds.Tables[0].Rows[0]["Pic3"].ToString(); } if (ds.Tables[0].Rows[0]["Pic4"] != null && ds.Tables[0].Rows[0]["Pic4"].ToString() != "") { model.Pic4 = ds.Tables[0].Rows[0]["Pic4"].ToString(); } if (ds.Tables[0].Rows[0]["Pic5"] != null && ds.Tables[0].Rows[0]["Pic5"].ToString() != "") { model.Pic5 = ds.Tables[0].Rows[0]["Pic5"].ToString(); } if (ds.Tables[0].Rows[0]["Remarks"] != null && ds.Tables[0].Rows[0]["Remarks"].ToString() != "") { model.Remarks = ds.Tables[0].Rows[0]["Remarks"].ToString(); } if (ds.Tables[0].Rows[0]["AddTime"] != null && ds.Tables[0].Rows[0]["AddTime"].ToString() != "") { model.AddTime = DateTime.Parse(ds.Tables[0].Rows[0]["AddTime"].ToString()); } if (ds.Tables[0].Rows[0]["Goods001"] != null && ds.Tables[0].Rows[0]["Goods001"].ToString() != "") { model.Goods001 = int.Parse(ds.Tables[0].Rows[0]["Goods001"].ToString()); } if (ds.Tables[0].Rows[0]["Goods002"] != null && ds.Tables[0].Rows[0]["Goods002"].ToString() != "") { model.Goods002 = int.Parse(ds.Tables[0].Rows[0]["Goods002"].ToString()); } if (ds.Tables[0].Rows[0]["Goods003"] != null && ds.Tables[0].Rows[0]["Goods003"].ToString() != "") { model.Goods003 = int.Parse(ds.Tables[0].Rows[0]["Goods003"].ToString()); } if (ds.Tables[0].Rows[0]["Goods004"] != null && ds.Tables[0].Rows[0]["Goods004"].ToString() != "") { model.Goods004 = ds.Tables[0].Rows[0]["Goods004"].ToString(); } if (ds.Tables[0].Rows[0]["Goods005"] != null && ds.Tables[0].Rows[0]["Goods005"].ToString() != "") { model.Goods005 = decimal.Parse(ds.Tables[0].Rows[0]["Goods005"].ToString()); } if (ds.Tables[0].Rows[0]["Goods006"] != null && ds.Tables[0].Rows[0]["Goods006"].ToString() != "") { model.Goods006 = int.Parse(ds.Tables[0].Rows[0]["Goods006"].ToString()); } if (ds.Tables[0].Rows[0]["Goods007"] != null && ds.Tables[0].Rows[0]["Goods007"].ToString() != "") { model.Goods007 = DateTime.Parse(ds.Tables[0].Rows[0]["Goods007"].ToString()); } if (ds.Tables[0].Rows[0]["Goods008"] != null && ds.Tables[0].Rows[0]["Goods008"].ToString() != "") { model.Goods008 = DateTime.Parse(ds.Tables[0].Rows[0]["Goods008"].ToString()); } if (ds.Tables[0].Rows[0]["UploadUser"] != null && ds.Tables[0].Rows[0]["UploadUser"].ToString() != "") { model.UploadUser = Convert.ToInt32(ds.Tables[0].Rows[0]["UploadUser"].ToString()); } if (ds.Tables[0].Rows[0]["StateType"] != null && ds.Tables[0].Rows[0]["StateType"].ToString() != "") { model.StateType = Convert.ToInt32(ds.Tables[0].Rows[0]["StateType"].ToString()); } if (ds.Tables[0].Rows[0]["SealCount"] != null && ds.Tables[0].Rows[0]["SealCount"].ToString() != "") { model.SealCount = Convert.ToInt32(ds.Tables[0].Rows[0]["SealCount"].ToString()); } if (ds.Tables[0].Rows[0]["City"] != null && ds.Tables[0].Rows[0]["City"].ToString() != "") { model.City = ds.Tables[0].Rows[0]["City"].ToString(); } if (ds.Tables[0].Rows[0]["Purchase"] != null && ds.Tables[0].Rows[0]["Purchase"].ToString() != "") { model.Purchase = Convert.ToInt32(ds.Tables[0].Rows[0]["Purchase"].ToString()); } if (ds.Tables[0].Rows[0]["SealPurchase"] != null && ds.Tables[0].Rows[0]["SealPurchase"].ToString() != "") { model.SealPurchase = Convert.ToInt32(ds.Tables[0].Rows[0]["SealPurchase"].ToString()); } if (ds.Tables[0].Rows[0]["UserCode"] != null && ds.Tables[0].Rows[0]["UserCode"].ToString() != "") { model.UserCode = ds.Tables[0].Rows[0]["UserCode"].ToString(); } if (ds.Tables[0].Rows[0]["IsLucky"] != null && ds.Tables[0].Rows[0]["IsLucky"].ToString() != "") { model.IsLucky = Convert.ToInt32(ds.Tables[0].Rows[0]["IsLucky"].ToString()); } return(model); } else { return(null); } }
/// <summary> /// 更新一条数据 /// </summary> public bool Update(lgk.Model.tb_goods_cxth model) { StringBuilder strSql = new StringBuilder(); strSql.Append("update tb_goods_cxth set "); strSql.Append("GoodsCode=@GoodsCode,"); strSql.Append("GoodsName=@GoodsName,"); strSql.Append("Price=@Price,"); strSql.Append("RealityPrice=@RealityPrice,"); strSql.Append("Pic1=@Pic1,"); strSql.Append("Pic2=@Pic2,"); strSql.Append("Pic3=@Pic3,"); strSql.Append("Pic4=@Pic4,"); strSql.Append("Pic5=@Pic5,"); strSql.Append("Remarks=@Remarks,"); strSql.Append("AddTime=@AddTime,"); strSql.Append("Goods001=@Goods001,"); strSql.Append("Goods002=@Goods002,"); strSql.Append("Goods003=@Goods003,"); strSql.Append("Goods004=@Goods004,"); strSql.Append("Goods005=@Goods005,"); strSql.Append("Goods006=@Goods006,"); strSql.Append("Goods007=@Goods007,"); strSql.Append("Goods008=@Goods008,"); strSql.Append("UserCode=@UserCode,"); strSql.Append("SealCount=@SealCount,"); strSql.Append("TypeID=@TypeID,"); strSql.Append("GoodsType=@GoodsType,"); strSql.Append("PareTopId=@PareTopId,"); strSql.Append("City=@City,"); strSql.Append("StateType=@StateType,"); strSql.Append("Purchase=@Purchase,"); strSql.Append("SealPurchase=@SealPurchase,"); strSql.Append("UploadUser=@UploadUser,"); strSql.Append("IsLucky=@IsLucky"); strSql.Append(" where ID=@ID"); SqlParameter[] parameters = { new SqlParameter("@GoodsCode", SqlDbType.VarChar, 100), new SqlParameter("@GoodsName", SqlDbType.VarChar, 100), new SqlParameter("@Price", SqlDbType.Decimal, 9), new SqlParameter("@RealityPrice", SqlDbType.Decimal, 9), new SqlParameter("@Pic1", SqlDbType.VarChar, 100), new SqlParameter("@Pic2", SqlDbType.VarChar, 100), new SqlParameter("@Pic3", SqlDbType.VarChar, 100), new SqlParameter("@Pic4", SqlDbType.VarChar, 100), new SqlParameter("@Pic5", SqlDbType.VarChar, 100), new SqlParameter("@Remarks", SqlDbType.Text), new SqlParameter("@AddTime", SqlDbType.DateTime), new SqlParameter("@Goods001", SqlDbType.Int, 4), new SqlParameter("@Goods002", SqlDbType.Int, 4), new SqlParameter("@Goods003", SqlDbType.Int), new SqlParameter("@Goods004", SqlDbType.VarChar, 100), new SqlParameter("@Goods005", SqlDbType.Decimal, 9), new SqlParameter("@Goods006", SqlDbType.Int), new SqlParameter("@Goods007", SqlDbType.DateTime), new SqlParameter("@Goods008", SqlDbType.DateTime), new SqlParameter("@UserCode", SqlDbType.VarChar, 50), new SqlParameter("@SealCount", SqlDbType.Int), new SqlParameter("@TypeID", SqlDbType.Int), new SqlParameter("@GoodsType", SqlDbType.Int), new SqlParameter("@PareTopId", SqlDbType.Int), new SqlParameter("@City", SqlDbType.VarChar, 20), new SqlParameter("@StateType", SqlDbType.Int), new SqlParameter("@Purchase", SqlDbType.Int), new SqlParameter("@SealPurchase", SqlDbType.Int), new SqlParameter("@UploadUser", SqlDbType.Int), new SqlParameter("@IsLucky", SqlDbType.Int), new SqlParameter("@ID", SqlDbType.Int, 4) }; parameters[0].Value = model.GoodsCode; parameters[1].Value = model.GoodsName; parameters[2].Value = model.Price; parameters[3].Value = model.RealityPrice; parameters[4].Value = model.Pic1; parameters[5].Value = model.Pic2; parameters[6].Value = model.Pic3; parameters[7].Value = model.Pic4; parameters[8].Value = model.Pic5; parameters[9].Value = model.Remarks; parameters[10].Value = model.AddTime; parameters[11].Value = model.Goods001; parameters[12].Value = model.Goods002; parameters[13].Value = model.Goods003; parameters[14].Value = model.Goods004; parameters[15].Value = model.Goods005; parameters[16].Value = model.Goods006; parameters[17].Value = model.Goods007; parameters[18].Value = model.Goods008; parameters[19].Value = model.UserCode; parameters[20].Value = model.SealCount; parameters[21].Value = model.TypeID; parameters[22].Value = model.GoodsType; parameters[23].Value = model.PareTopId; parameters[24].Value = model.City; parameters[25].Value = model.StateType; parameters[26].Value = model.Purchase; parameters[27].Value = model.SealPurchase; parameters[28].Value = model.UploadUser; parameters[29].Value = model.IsLucky; parameters[30].Value = model.ID; int rows = DbHelperSQL.ExecuteSql(strSql.ToString(), parameters); if (rows > 0) { return(true); } else { return(false); } }
protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e) { int iID = Convert.ToInt32(e.CommandArgument.ToString()); lgk.Model.tb_goods_cxth model = _goodsBLL.GetModel(iID); if (model == null) { MessageBox.Show(this, "该商品已删除!"); return; } if (e.CommandName.Equals("Audit")) //审核商品 { if (model.StateType == 1) { model.StateType = 0; if (_goodsBLL.Update(model)) { MessageBox.Show(this, "审核不通过!"); } } else { model.StateType = 1; if (_goodsBLL.Update(model)) { MessageBox.Show(this, "审核通过!"); } } } if (e.CommandName.Equals("edit")) //编辑商品 { Response.Redirect("EditSalesroom.aspx?pid=" + iID); } if (e.CommandName.Equals("up")) { model.Goods001 = 1; if (_goodsBLL.Update(model)) { MessageBox.Show(this, "上架成功!"); } } if (e.CommandName.Equals("down")) { model.Goods001 = 0; if (_goodsBLL.Update(model)) { MessageBox.Show(this, "下架成功!"); } } if (e.CommandName.Equals("del")) //商品上架 { if (model.Goods001 > 0) { MessageBox.Show(this, "请先下架后再删除!"); return; } if (_goodsBLL.Delete1(iID)) { MessageBox.Show(this, "删除成功!"); } //if (getOrder(id) > 0) //{ // MessageBox.Show(this, "该商品已有订单,不能删除!"); // return; //} //if (goodsBLL.Delete(id)) //{ // MessageBox.Show(this, "删除成功!"); //} } if (e.CommandName.Equals("lucky")) //抽奖 { model.IsLucky = 1; if (_goodsBLL.Update(model)) { MessageBox.Show(this, "抽奖成功!"); } //SELECT o.UserID FROM [NN15080570].[dbo].[tb_OrderDetail] d //join [tb_Order] as o on o.OrderCode = d.OrderCode where o.TypeID = 5 AND d.ProcudeID = 1 long iUserID = 0; int iProcudeID = 0; string strOrderCode = ""; IList <lgk.Model.tb_OrderDetail> listone = orderDetailBLL.GetJoinList("o.TypeID = 5 AND d.ProcudeID = " + iID + " ORDER BY NEWID()"); foreach (lgk.Model.tb_OrderDetail item in listone) { iUserID = item.UserID; iProcudeID = item.ProcudeID; strOrderCode = item.OrderCode; } IList <lgk.Model.tb_OrderDetail> list = orderDetailBLL.GetJoinListAll("o.TypeID = 5 AND d.ProcudeID = " + iID + ""); foreach (lgk.Model.tb_OrderDetail item in list) { //删除未抽中的订单 if (strOrderCode != item.OrderCode) { orderBLL.Delete(item.OrderCode); orderDetailBLL.Delete(item.OrderCode); } } } bind(); }
protected void lbtnSubmit_Click(object sender, EventArgs e) { if (this.dropOneType.SelectedValue == "0") { MessageBox.Show(this, "请选择一级类别"); return; } if (this.dropSecondType.SelectedValue == "0") { MessageBox.Show(this, "请选择二级类别"); return; } if (this.dropThreeType.SelectedValue == "0") { MessageBox.Show(this, "请选择三级类别"); return; } if (this.txtGoodsCode.Text.Trim() == "") { MessageBox.Show(this, "请输入商品编号"); return; } if (this.txtGoodsName.Text.Trim() == "") { MessageBox.Show(this, "请输入商品名称"); return; } if (this.txtPrice.Text.Trim() == "") { MessageBox.Show(this, "请输入市场价"); return; } if (txtRealityPrice.Text.Trim() == "") { MessageBox.Show(this, "请输入竞拍价"); return; } if (txtCount.Text.Trim() == "") { MessageBox.Show(this, "请输入商品数量"); return; } //if ( txtCity.Text.Trim() == "") //{ // MessageBox.Show(this, "请输入城市名"); // return; //} //if (txtPurchase.Text.Trim() == "") //{ // MessageBox.Show(this, "请输入每账号限制购买数量"); // return; //} try { decimal lsj = Convert.ToDecimal(txtPrice.Text); decimal ls = Convert.ToDecimal(txtRealityPrice.Text); } catch (Exception) { MessageBox.Show(this, "市场价、优惠价必须是数字"); return; } //try //{ // Convert.ToInt32(txtPurchase.Text); //} //catch (Exception) //{ // MessageBox.Show(this, "每账号限制购买数量必须是数字"); // return; //} if (GetPID() == "") { if (goodsBLL.GetModel(" GoodsCode='" + this.txtGoodsCode.Text.Trim() + "'") != null) { MessageBox.Show(this, "商品编号已存在,请重新输入"); return; } string upload1 = ""; if (ViewState["urlname1"] != null) { upload1 = ViewState["urlname1"].ToString(); } if (upload1 == "") { MessageBox.Show(this, "请上传商品图片"); return; } // upload1 = upload1.Substring(upload1.LastIndexOf("/") + 1, upload1.Length - upload1.LastIndexOf("/") - 1); if (this.textPubContext.Text.Trim() == "") { MessageBox.Show(this, "请输入商品详情"); return; } lgk.Model.tb_goods_cxth model = new lgk.Model.tb_goods_cxth(); model.Goods001 = 1; //上架 model.Goods002 = 0; //积分 model.AddTime = DateTime.Now; model.GoodsCode = txtGoodsCode.Text.Trim(); model.GoodsName = txtGoodsName.Text.Trim(); model.Pic1 = upload1; //图片 model.Price = Convert.ToDecimal(txtPrice.Text.Trim()); //市场价 // model.City = txtCity.Text.Trim(); model.RealityPrice = Convert.ToDecimal(txtRealityPrice.Text.Trim()); //竞拍价 model.Remarks = textPubContext.Text; //详情 model.Goods003 = 0; //不删除 model.Goods004 = txtPlay.Text.Trim(); //支付时间 model.Goods005 = 0; //折扣 model.Goods006 = Convert.ToInt32(txtCount.Text.Trim()); //数量 model.Goods007 = DateTime.Now; //Convert.ToDateTime(txtStart.Text.Trim());//开始时间 model.Goods008 = DateTime.Now; //Convert.ToDateTime(txtEnd.Text.Trim());//结束时间 model.TypeID = Convert.ToInt32(dropOneType.SelectedValue); //一级分类 model.GoodsType = Convert.ToInt32(dropSecondType.SelectedValue); //二级分类 model.PareTopId = Convert.ToInt32(dropThreeType.SelectedValue); //三级分类 model.UploadUser = Convert.ToInt32(getLoginID()); //上传者ID model.SealCount = 0; //卖出数量 int iPurchase = Convert.ToInt32(model.Price / model.RealityPrice); model.Purchase = iPurchase; //Convert.ToInt32(txtPurchase.Text); //竞拍次数 model.SealPurchase = 0; model.UserCode = ""; model.UploadUser = 0;//上传者ID if (goodsOneBLL.Add(model) > 0) { MessageBox.ShowAndRedirect(this, "添加成功", "SalesroomList.aspx"); } else { MessageBox.Show(this, "添加失败"); } } else { lgk.Model.tb_goods_cxth model = goodsOneBLL.GetModel(Convert.ToInt32(GetPID())); string upload1 = ""; if (ViewState["urlname1"] != null) { upload1 = ViewState["urlname1"].ToString(); } if (upload1 != "") { upload1 = upload1.Substring(upload1.LastIndexOf("/") + 1, upload1.Length - upload1.LastIndexOf("/") - 1); model.Pic1 = upload1; } model.GoodsCode = txtGoodsCode.Text.Trim(); model.GoodsName = txtGoodsName.Text.Trim(); model.Price = Convert.ToDecimal(txtPrice.Text.Trim()); model.RealityPrice = Convert.ToDecimal(txtRealityPrice.Text.Trim()); model.Remarks = textPubContext.Text; model.Goods002 = 0; //积分 model.Goods004 = txtPlay.Text.Trim(); //支付时间 model.Goods005 = 0; //折扣 model.Goods006 = Convert.ToInt32(txtCount.Text.Trim()); //数量 model.Goods007 = DateTime.Now; //Convert.ToDateTime(txtStart.Text.Trim());//开始时间 model.Goods008 = DateTime.Now; //Convert.ToDateTime(txtEnd.Text.Trim());//结束时间 model.TypeID = Convert.ToInt32(dropOneType.SelectedValue); //一级分类 model.GoodsType = Convert.ToInt32(dropSecondType.SelectedValue); //二级分类 model.PareTopId = Convert.ToInt32(dropThreeType.SelectedValue);; //促销 // model.UploadUser = Convert.ToInt32(getLoginID());//上传者ID model.StateType = 0; //审核不通过 int iPurchase = Convert.ToInt32(model.Price / model.RealityPrice); model.Purchase = iPurchase; model.UserCode = ""; model.UploadUser = 0;//上传者ID // model.City = txtCity.Text.Trim(); if (goodsOneBLL.Update(model)) { MessageBox.ShowAndRedirect(this, "更新成功", "SalesroomList.aspx"); } else { MessageBox.Show(this, "更新失败"); } } }