public ActionResult GetGoodsCollect(string uid, int goodsid, int isactive) { try { var usmodel = db.tb_userinfos.FirstOrDefault(s => s.UserID == uid); goods goodsmodel = new goods(); //如果不是活动商品 if (isactive == 0) { goodsmodel = db.goods.FirstOrDefault(s => s.ID == goodsid); } else { var activegood = db.zyactivitygoods.FirstOrDefault(s => s.ID == goodsid); goodsmodel = db.goods.FirstOrDefault(s => s.ID == activegood.goodsid); } if (usmodel != null) { var collectmodel = db.MyZyGoodsCollect.FirstOrDefault(s => s.userid == usmodel.ID && s.goodid == goodsmodel.ID); if (collectmodel != null) { return(Json(Comm.ToJsonResult("Success", "成功", "1"), JsonRequestBehavior.AllowGet)); } else { return(Json(Comm.ToJsonResult("Success", "成功", "0"), JsonRequestBehavior.AllowGet)); } } else { return(Json(Comm.ToJsonResult("NotFind", "用户不存在"), JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(Comm.ToJsonResult("Error", "获取失败"), JsonRequestBehavior.AllowGet)); } }
protected void btnAddGoods_Click(object sender, EventArgs e) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { goods addNot = new goods(); addNot.goodstitle = txtTitle.Value.Trim(); addNot.goodscontent = SearchDataClass.CheckStr(txtFckContent.Value); addNot.goodsvalidate = Convert.ToChar(drpValidate.SelectedValue); addNot.setindex = Convert.ToChar(drpSetIndex.SelectedValue); addNot.goodscode = txtGoodsCode.Value; addNot.goodsprice = Convert.ToDecimal(txtGoodsPrice.Value); addNot.goodssort = int.Parse(drpGoodsSort.SelectedValue); addNot.goodsimg = HFurl.Value.Trim(); addNot.addtime = DateTime.Now; addNot.goodstock = int.Parse(txtStockNum.Value); addNot.goodsSales = Convert.ToChar(drpSales.SelectedValue); addNot.getgoodpoint = txtGetGoodPoint.Value == "" ? 0 : int.Parse(txtGetGoodPoint.Value); addNot.goodscost = txtGoodsCost.Value == "" ? 0.00m : Convert.ToDecimal(txtGoodsCost.Value); addNot.ifexchange = Convert.ToChar(drpExchangeGood.SelectedValue); addNot.exchangepoint = txtExchangePoint.Value == "" ? 0 : int.Parse(txtExchangePoint.Value); addNot.tichengpoint = ticheng.Value == "" ? "0/20/20/10" : ticheng.Value; //addNot.goodgoldprice = txtGoldPrice.Value == "" ? 0.00m : Convert.ToDecimal(txtGoldPrice.Value); //addNot.goodsilverprice = txtSilverprice.Value == "" ? 0.00m : Convert.ToDecimal(txtSilverprice.Value); addNot.ifxiangou = Convert.ToChar(drpXianGou.SelectedValue); addNot.xiangounumber = txtXianGouNumber.Value == "" ? "0/0/0" : txtXianGouNumber.Value; addNot.goodsspec = txtGoodsSpec.Value; addNot.goodscompany = txtGoodsCompany.Value; //addNot.iftuangou = Convert.ToChar(drpGroupBy.SelectedValue); addNot.expiredate = Convert.ToDateTime(txtExpireDate.Value); addNot.selectytsort = Convert.ToChar(drpSaleGoodsSort.SelectedValue); db.goods.InsertOnSubmit(addNot); db.SubmitChanges(); } Response.Redirect("GoodsManager.aspx?mid=" + Request["mid"] + "&type=" + Request["type"]); }
public String Creategoodsinfo(String goodsname, String goodstype, String goodslow, String goodshigh, String goodsdes) { try { String cid = (String)Session["uid"]; if (cid == null) { return("-1"); } user cuser = EFOperationdll.PersonOp.getAllInfo(db, cid); if (cuser == null) { return("-1"); } goods newgoods = new goods() { gid = "", sid = cid, gname = goodsname, gtype = goodstype, glow = int.Parse(goodslow), ghigh = int.Parse(goodshigh), gdes = goodsdes, gstate = "1", gstarttime = DateTime.Now }; //return EFOperationdll.GoodsOp.addGoods(db, newgoods); db.goods.Add(newgoods); db.SaveChanges(); return("1"); } catch (DbUpdateConcurrencyException e) { Console.WriteLine(e.StackTrace); return(e.StackTrace); } }
public List <goods> getAllGoods(string request = "") { List <goods> li = new List <goods>(); SQLiteCommand cmd = new SQLiteCommand(m_con); cmd.CommandText = "select * from global " + request; SQLiteDataReader dr = cmd.ExecuteReader(); StringBuilder sb = new StringBuilder(); while (dr.Read()) { goods one = new goods(); one.number = dr.GetString(0); one.source = dr.GetString(1); one.dest = dr.GetString(2); one.arriveTime = dr.GetString(3); one.deadline = dr.GetString(4); one.status = dr.GetString(5); one.objVechicle = dr.GetString(6); one.finishTime = dr.GetString(7); li.Add(one); } return(li); }
public ActionResult GetBuyTerm(string uid, int goodsid, int isactive) { try { var usmodel = db.tb_userinfos.FirstOrDefault(s => s.UserID == uid); goods goodsmodel = new goods(); if (usmodel != null) { int fitusergrade = 0; //如果不是活动商品 if (isactive == 1) { var activegood = db.zyactivitygoods.FirstOrDefault(s => s.ID == goodsid); var activemodel = db.zyactivity.FirstOrDefault(s => s.ID == activegood.activityid); if (activemodel.GradeAsk == usmodel.UserGrade) { fitusergrade = 1; } } var returndata = new { userok = 1, usgradeok = fitusergrade }; return(Json(Comm.ToJsonResult("Success", "成功", returndata), JsonRequestBehavior.AllowGet)); } else { return(Json(Comm.ToJsonResult("NotFind", "用户不存在"), JsonRequestBehavior.AllowGet)); } } catch (Exception ex) { return(Json(Comm.ToJsonResult("Error", "获取失败"), JsonRequestBehavior.AllowGet)); } }
public void updateGoods(goods one) { string str = "update global set deadline ='" + one.deadline + "', status ='" + one.status + "', objVechicle = '" + one.objVechicle + "', finishTime = '" + one.finishTime + "' where number =" + "'" + one.number + "'"; excuteCommand(str); }
/// <summary> /// 架构中不存在 goods 的注释。 /// </summary> public void AddTogoods(goods goods) { base.AddObject("goods", goods); }
/// <summary> /// 插入方法 /// </summary> /// <param name="goods">goods表实例</param> /// <returns>int</returns> public static int Insert(goods goodsExample) { return(Service.Insert(goodsExample)); }
public void BindShowUpInfo(string strUpid) { if (!string.IsNullOrEmpty(strUpid)) { if (EnshineUnionManager.model.SearchDataClass.IsNumber(strUpid) == true) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { goods getNot = db.goods.Single(x => x.goodsId == int.Parse(strUpid)); txtTitle.Value = getNot.goodstitle; txtFckContent.Value = SearchDataClass.CheckStr(getNot.goodscontent); drpValidate.SelectedValue = getNot.goodsvalidate.ToString(); drpSetIndex.SelectedValue = getNot.setindex.ToString(); this.drpGoodsSort.SelectedValue = getNot.goodssort.ToString(); txtGoodsCode.Value = getNot.goodscode; txtGoodsPrice.Value = getNot.goodsprice.ToString();; this.hfDel.Value = getNot.goodsimg; this.HFurl.Value = getNot.goodsimg; if (!string.IsNullOrEmpty(getNot.goodsimg)) { this.iShowPhoto.Src = getNot.goodsimg; } else { this.iShowPhoto.Src = "assets/images/nophoto.gif"; } txtStockNum.Value = getNot.goodstock.ToString(); drpSales.SelectedValue = getNot.goodsSales.ToString(); txtGoodsCost.Value = getNot.goodscost.ToString();; txtExchangePoint.Value = getNot.exchangepoint.ToString();; drpExchangeGood.SelectedValue = getNot.ifexchange.ToString(); txtGetGoodPoint.Value = getNot.getgoodpoint.ToString(); //txtGoldPrice.Value = getNot.goodgoldprice.ToString(); //txtSilverprice.Value = getNot.goodsilverprice.ToString(); //判断分成比例 0/20/20/10 var tichengsplit = getNot.tichengpoint.Split('/'); decimal fencheng1 = (Convert.ToDecimal(getNot.goodsprice) - Convert.ToDecimal(getNot.goodscost)) * Convert.ToDecimal(75 / 100) * Convert.ToDecimal(tichengsplit[1]) / Convert.ToDecimal(100); decimal fencheng2 = (Convert.ToDecimal(getNot.goodsprice) - Convert.ToDecimal(getNot.goodscost)) * Convert.ToDecimal(75 / 100) * Convert.ToDecimal(tichengsplit[2]) / Convert.ToDecimal(100); decimal fencheng3 = (Convert.ToDecimal(getNot.goodsprice) - Convert.ToDecimal(getNot.goodscost)) * Convert.ToDecimal(75 / 100) * Convert.ToDecimal(tichengsplit[3]) / Convert.ToDecimal(100); if (tichengsplit.Length > 0) { if (int.Parse(tichengsplit[0]) == 0) { //sp1.InnerText = "分成比例20%=" + Convert.ToDecimal((getNot.goodsprice * (int.Parse(tichengsplit[1]) / 100))).ToString("N2") + "元"; //sp2.InnerText = "分成比例20%=" + Convert.ToDecimal((getNot.goodsprice * (int.Parse(tichengsplit[2]) / 100))).ToString("N2") + "元"; //sp3.InnerText = "分成比例10%=" + Convert.ToDecimal((getNot.goodsprice * (int.Parse(tichengsplit[3]) / 100))).ToString("N2") + "元"; sp1.InnerText = "分成比例20%=" + Convert.ToDecimal(fencheng1).ToString("N2") + "元"; sp2.InnerText = "分成比例20%=" + Convert.ToDecimal(fencheng2).ToString("N2") + "元"; sp3.InnerText = "分成比例10%=" + Convert.ToDecimal(fencheng3).ToString("N2") + "元"; } else { Text1.Value = tichengsplit[1]; Text2.Value = tichengsplit[2]; Text3.Value = tichengsplit[3]; //spz1.InnerText = "%=" + Convert.ToDecimal((getNot.goodsprice * (Convert.ToDecimal(tichengsplit[1]) / 100))).ToString("N2") + "元"; //spz2.InnerText = "%=" + Convert.ToDecimal((getNot.goodsprice * (Convert.ToDecimal(tichengsplit[2]) / 100))).ToString("N2") + "元"; //spz3.InnerText = "%=" + Convert.ToDecimal((getNot.goodsprice * (Convert.ToDecimal(tichengsplit[3]) / 100))).ToString("N2") + "元"; spz1.InnerText = "%=" + Convert.ToDecimal(fencheng1).ToString("N2") + "元"; spz2.InnerText = "%=" + Convert.ToDecimal(fencheng2).ToString("N2") + "元"; spz3.InnerText = "%=" + Convert.ToDecimal(fencheng3).ToString("N2") + "元"; } } drpXianGou.SelectedValue = getNot.ifxiangou.ToString(); txtXianGouNumber.Value = getNot.xiangounumber.ToString(); txtGoodsSpec.Value = getNot.goodsspec; txtGoodsCompany.Value = getNot.goodscompany; //drpGroupBy.SelectedValue = getNot.iftuangou.ToString(); txtExpireDate.Value = Convert.ToDateTime(getNot.expiredate).ToString("yyyy/MM/dd"); drpSaleGoodsSort.SelectedValue = getNot.selectytsort.ToString(); } } } }
/// <summary> /// 插入方法 /// </summary> /// <param name="goods">goods表实例</param> /// <returns>int</returns> public int Insert(goods goodsExample) { DBHelper.sqlstr = "insert into goods (g_price_yuan,g_standby1,g_standby2,g_standby3,gdate,gdate1,gdate2,gdate3,gimg,gimg2,gname,gprice1,gprice2,gremark1,gremark2,gstate,gstate1,gstate2,gstate3,gtid,gtitle,gurl,gurl_yuan,gurl2)values(@g_price_yuan,@g_standby1,@g_standby2,@g_standby3,'" + goodsExample.gdate.ToString("yyyy-MM-dd") + "','" + goodsExample.gdate1.ToString("yyyy-MM-dd") + "','" + goodsExample.gdate2.ToString("yyyy-MM-dd") + "','" + goodsExample.gdate3.ToString("yyyy-MM-dd") + "',@gimg,@gimg2,@gname,@gprice1,@gprice2,@gremark1,@gremark2,@gstate,@gstate1,@gstate2,@gstate3,@gtid,@gtitle,@gurl,@gurl_yuan,@gurl2)"; return(DBHelper.ExecuteNonQuery(GetSqlParameter(goodsExample))); }
public IActionResult AddGoods(goods goods) { _goodsService.addNewGoods(goods); return(RedirectToAction("Index", "ShoppingCart")); }
public IActionResult editPrice(goods goods) { _goodsService.updatePrice(goods); return(RedirectToAction("Index", "ShoppingCart")); }
private void myListGood_ItemClick(object sender, ItemClickEventArgs e) { var tmp = ((popularListGoods)e.ClickedItem).name; goods tmpGood = new goods(tmp, 1.0); listGoods.Add(tmpGood); nowList.ItemsSource = listGoods; }
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e) { string state = e.CommandName; if (state == "state_up") { int id = Convert.ToInt32(GridView1.DataKeys[((e.CommandSource as LinkButton).NamingContainer as GridViewRow).RowIndex].Values["gid"].ToString()); if (id != 0) { goods g = BLL.goodsManager.SearchBygid(id); g.gstate2 = g.gstate2 == "1" ? "2" : "1"; if (g.gstate2 == "2") { g.gdate2 = DateTime.Now; } if (BLL.goodsManager.Update(g) != 1) { AJAXManager.Alert(this.UpdatePanel1, "修改失败"); } else { bind(); } } } if (state == "state_img") { int id = Convert.ToInt32(GridView1.DataKeys[((e.CommandSource as LinkButton).NamingContainer as GridViewRow).RowIndex].Values["gid"].ToString()); if (id != 0) { goods g = BLL.goodsManager.SearchBygid(id); g.gstate1 = g.gstate1 == "1" ? "2" : "1"; if (g.gstate1 == "2") { g.gdate1 = DateTime.Now; } if (BLL.goodsManager.Update(g) != 1) { AJAXManager.Alert(this.UpdatePanel1, "修改失败"); } else { bind(); } } } if (state == "state_yh") { int id = Convert.ToInt32(GridView1.DataKeys[((e.CommandSource as LinkButton).NamingContainer as GridViewRow).RowIndex].Values["gid"].ToString()); if (id != 0) { goods g = BLL.goodsManager.SearchBygid(id); g.gstate3 = g.gstate3 == "1" ? "2" : "1"; if (g.gstate3 == "2") { g.gdate3 = DateTime.Now; } if (BLL.goodsManager.Update(g) != 1) { AJAXManager.Alert(this.UpdatePanel1, "修改失败"); } else { bind(); } } } if (state == "state_important") { int id = Convert.ToInt32(GridView1.DataKeys[((e.CommandSource as LinkButton).NamingContainer as GridViewRow).RowIndex].Values["gid"].ToString()); if (id != 0) { goods g = BLL.goodsManager.SearchBygid(id); g.g_standby1 = g.g_standby1 == "1" ? "2" : "1"; if (BLL.goodsManager.Update(g) != 1) { AJAXManager.Alert(this.UpdatePanel1, "修改失败"); } else { bind(); } } } }
/// <summary> /// 更新 /// </summary> /// <param name="goods">goods表实例</param> /// <returns>int</returns> public static int Update(goods goodsExample) { return(Service.Update(goodsExample)); }
//结束 #endregion /// <summary> /// 代码生成数据库中的订单数据 /// </summary> void sckjmen() { for (int i = 0; i < 10; i++)//重新载入订单表需要清空生的控件们 { foreach (Control item in pan_goods.Controls) { if (item == lab_tip) { continue; //除了悬浮提示外其它的都清除,然后重新再生成,达到刷新的效果 } pan_goods.Controls.Remove(item); } } //查询有关于这个买家的数据 string sql = string.Format("select * from goods where buydename = '{0}'", love.denglu_username == string.Empty ? "b" : love.denglu_username); DataTable d = sqlHelper.ExecutedataTable(sql, CommandType.Text, null); //查询总金额 string fdas = string.Format("select sum(fkje) from goods where goods.buydename = '{0}'", love.denglu_username == string.Empty ? "b" : love.denglu_username); DataTable jlk = sqlHelper.ExecutedataTable(fdas, CommandType.Text, null); string zongjinge = string.Empty;//总金额 try { zongjinge = jlk.Rows[0][0].ToString();//如果没有金额就会出错 lab_tip.Text = string.Format("tip:亲爱的 {0} ,你总共购买了 {1} 件商品,总共交易金额 {2} 元", love.denglu_username == string.Empty ? "b" : love.denglu_username, d.Rows.Count.ToString(), zongjinge.ToString()); } catch (Exception) { lab_tip.Text = string.Format("tip:亲爱的 {0} ,你总共购买了 {1} 件商品,总共交易金额 {2} 元", love.denglu_username == string.Empty ? "b" : love.denglu_username, d.Rows.Count.ToString(), 0); throw; } Point panzuixin = new Point(); //用来记录下pannel的最新的位置,一个pannel一个商品订单 bool bol = true; //如果pannel是第一次诞生那么他是true,否则会false for (int i = 0; i < d.Rows.Count; i++) //有多少个订单就循环多少次 { Panel pan_gs = new Panel(); //用来记录下最新的位置 pan_goods.Controls.Add(pan_gs); pan_gs.BorderStyle = BorderStyle.FixedSingle; pan_gs.Size = new Size(pan_goods.Width - 80, 140); #region pan_gs的位置算法 if (bol) //说明它是第一次诞生 { bol = false; //说明有过了第一个pannel pan_gs.Location = new Point((pan_goods.Width - pan_gs.Width) / 2, pan_goods.Top + 20); //x等于平均,y等于最外的pannel,最外的自带内边距,y轴不加 Point poc = new Point(pan_gs.Location.X, pan_gs.Location.Y + pan_gs.Height + 20); //第一个pannel的x,y加20像素 panzuixin = poc; //把第一次的我位置传出去 } else//如果不是第一次诞生就使用上次的位置y轴加20像素 { pan_gs.Location = panzuixin; Point poc = new Point(pan_gs.Location.X, pan_gs.Location.Y + pan_gs.Height + 20); //第一个pannel的x,y加20像素 panzuixin = poc; //把最后一个pannel的位置传出去 } #endregion PictureBox compic = new PictureBox();//商品图片 compic.Name = "compic"; compic.SizeMode = PictureBoxSizeMode.Zoom; compic.Size = new Size(120, 120); sqlHelper.imagechu(d.Rows[i]["compic"], compic); //compic.BorderStyle = BorderStyle.FixedSingle; compic.Location = new Point(25, (pan_gs.Height - compic.Height) / 2); Label comname = new Label();//商品名 comname.AutoSize = true; comname.Text = "商品名称: " + d.Rows[i]["comname"].ToString(); comname.Location = new Point(compic.Right + 30, compic.Top + 7); Label fkje = new Label();//付款金额 fkje.AutoSize = true; fkje.Text = "付款金额: " + d.Rows[i]["fkje"].ToString(); fkje.Location = new Point(comname.Left, comname.Bottom); Label fktime = new Label();//付款时间 fktime.AutoSize = true; fktime.Text = "付款时间:" + d.Rows[i]["fktime"].ToString(); fktime.Location = new Point(fkje.Left + 120, fkje.Top); Label cmid = new Label();//商品编号 cmid.AutoSize = true; cmid.Text = "商品编号: " + d.Rows[i]["cmid"].ToString(); cmid.Location = new Point(fkje.Left, fkje.Bottom); Label pjdh = new Label();//评价单号 pjdh.AutoSize = true; pjdh.Text = "订单编号:" + d.Rows[i]["pjdh"].ToString(); pjdh.Location = new Point(fktime.Left, cmid.Top); //获取昵称 Label sellednicheng = new Label();//卖家昵称 sellednicheng.AutoSize = true; string nnc = string.Format("select nicheng from sellde where username = '******'", d.Rows[i]["selledname"].ToString()); sellednicheng.Text = "卖家昵称:" + sqlHelper.ExecutedataTable(nnc, CommandType.Text, null).Rows[0][0].ToString(); sellednicheng.Location = new Point(fktime.Right + 100, fktime.Location.Y); goods ggg = new goods(); ggg.Pjdh = long.Parse(d.Rows[i]["pjdh"].ToString()); if (ggg.isorneirong())//ture说明没有评价内容,也没有评价星级,那么就开始评价 { Label xj1 = new Label(); xj1.Text = "我想给"; //这里加1-5的小数框 xj1.Tag = "xj1"; xj1.AutoSize = true; pan_gs.Controls.Add(xj1); // xj1.Location = new Point(pjdh.Right + 30, pjdh.Top); xj1.Location = new Point(sellednicheng.Left, pjdh.Top); NumericUpDown num = new NumericUpDown(); num.AutoSize = true; pan_gs.Controls.Add(num); num.Maximum = 5; num.Width = 13; num.Location = new Point(xj1.Right, xj1.Top - 4); Label xj2 = new Label(); xj2.AutoSize = true; xj2.Text = "颗星星的评价"; xj2.Tag = "xj2"; xj2.Location = new Point(num.Right, xj1.Top); pan_gs.Controls.Add(xj2); Label nrts = new Label(); pan_gs.Controls.Add(nrts); nrts.Text = "评价内容:"; nrts.AutoSize = true; //nrts.Font = new Font(nrts.Font.FontFamily, 25); nrts.Location = new Point(cmid.Left, cmid.Bottom); TextBox pj = new TextBox(); pan_gs.Controls.Add(pj); pj.Multiline = true; pj.Size = new Size(350, 40); pj.ScrollBars = ScrollBars.Vertical; pj.Location = new Point(nrts.Right, nrts.Top); Button submit = new Button(); submit.Name = d.Rows[i]["pjdh"].ToString();//用按钮记录下单号 submit.Text = "立即评价"; pan_gs.Controls.Add(submit); submit.Location = new Point(pj.Right + 20, pj.Top + (pj.Height - submit.Height) / 2); //submit.Size = new Size(submit.Size.Width, submit.Size.Height + 1); submit.Click += new EventHandler(submit_Click); } else//说明评价完星级和内容了,可以开始直接显示了 { Label pjxj = new Label(); pan_gs.Controls.Add(pjxj); pjxj.AutoSize = true; pjxj.Location = new Point(cmid.Left, cmid.Bottom); pjxj.Text = "评价星级:"; //后面记得加上数据库的星级 //查询数据库的星级然后循环出对应的星星数量 bool diyicixx = true; //判断是否第一次产生星星 Point pinxx = new Point(); //存储星星的最新位置 DataTable tabxj = sqlHelper.ExecutedataTable(string.Format("select xingji,neirong from goods where pjdh = {0}", d.Rows[i]["pjdh"].ToString()), CommandType.Text, null); int jkx = int.Parse(tabxj.Rows[0]["xingji"].ToString()); for (int forxx = 0; forxx < jkx; forxx++) { PictureBox xx = new PictureBox(); //星级放到评价单号的右边 pan_gs.Controls.Add(xx); xx.Size = new Size(19, 19); //图片为19,正好盛放 xx.Image = Image.FromFile(Application.StartupPath + "\\image\\haop.png"); //好评图片 if (diyicixx) { xx.Location = new Point(pjxj.Right, pjxj.Top - 4); pinxx = new Point(xx.Right + xx.Width + 10, xx.Top); diyicixx = false;//执行后说明它不是第一次运行 } else { xx.Location = pinxx; Point temp = new Point(xx.Right + xx.Width + 10, xx.Top); pinxx = temp; } } Label pjtime = new Label(); pjtime.AutoSize = true; pjtime.Text = "评价时间:" + d.Rows[0]["pjtime"].ToString(); pjtime.Location = new Point(sellednicheng.Left, pjxj.Top); pan_gs.Controls.Add(pjtime); Label neirong = new Label();//评价内容 neirong.AutoSize = true; neirong.Text = "评价内容:" + tabxj.Rows[0]["neirong"].ToString(); neirong.Location = new Point(pjxj.Left, pjxj.Bottom + pjxj.Height); pan_gs.Controls.Add(neirong); } Control[] ctl = { pjdh, cmid, sellednicheng, comname, compic, fkje, fktime }; pan_gs.Controls.AddRange(ctl); Button bbb = new Button(); pan_goods.Controls.Add(bbb); bbb.Location = new Point(100, 100);//让它来承载焦点,否则将会自动把焦点赋予给星级框 bbb.Focus(); foreach (Control item in pan_gs.Controls) { if (item is Button) { Button bb = (Button)item; SetBtnStyle(bb); } } }//订单循环结束 }
public event EventHandler zjbz; //申明事件 private void btn_OK_Click(object sender, EventArgs e) //点击了付款的按钮 { if (isorcg) //判断是否交易成功了 { DialogResult dr = MessageBox.Show("亲!你已经付款成功了哟!是否返回订单表查看你的订单信息?", "付款提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (dr == DialogResult.Yes) { //打开订单表 //Hide(); Frm_BuydeGoods f = new Frm_BuydeGoods(); f.ShowDialog(); //Show(); } else { Close();//订单表被关闭后关闭此页回到商品表 } return; } //开始判断金额是否足够 if (decimal.Parse(lab_buydeyue.Text) < decimal.Parse(lab_zfje.Text)) { MessageBox.Show("余额不足,请充值(๑•﹏•)。", "余额不足提示", MessageBoxButtons.YesNo, MessageBoxIcon.Information); return;//不让它执行数据库插入动作 } //开始确认订单 //订单信息 string ddxx = string.Format(@" 商品名称:{0} 物流公司:{1} 收 货 人:{2} 收货电话:{3} 收货地址:{4} 你的余额:{5} 应付金额:{6} 交易后的余额:{7}", lab_comname.Text, lab_kuaidi.Text, txt_ZFbuydeName.Text, txt_telephone.Text, txt_ZFShouhuoDZ.Text, lab_buydeyue.Text, lab_shoujia.Text, decimal.Parse(lab_buydeyue.Text) - decimal.Parse(lab_shoujia.Text)); DialogResult qrdd = MessageBox.Show(ddxx, "确认订单信息", MessageBoxButtons.YesNo, MessageBoxIcon.Information); if (qrdd == DialogResult.No) { return; } //下面开始为两家数据库的余额进行操作 if (shoppin.State == ConnectionState.Closed) { shoppin.Open(); } SqlTransaction st = shoppin.BeginTransaction(); SqlCommand cmd1 = new SqlCommand(string.Format("update buyde set yue-={0} where username = '******'", lab_shoujia.Text), shoppin); SqlCommand cmd2 = new SqlCommand(string.Format("update sellde set yue+={0} where username = '******'", lab_shoujia.Text), shoppin); cmd1.Transaction = st; cmd2.Transaction = st; if (cmd1.ExecuteNonQuery() + cmd2.ExecuteNonQuery() == 2) { st.Commit(); isorcg = true; MessageBox.Show("购买成功!╭(╯3╰)╮", "交易提示", MessageBoxButtons.OK, MessageBoxIcon.Information); //下面开始插入订单表数据库 goods g = new goods(); g.Cmid = long.Parse(love.goumaiid == string.Empty ? "1" : love.goumaiid); //商品id g.Comname = lab_comname.Text; //商品名 //查到商品的持有者 string username = string.Format("select username from commodity where comid = {0}", g.Cmid); DataTable d = sqlHelper.ExecutedataTable(username, CommandType.Text, null); g.Selledname = d.Rows[0][0].ToString(); //用户名 g.Buydename = lab_Buyde_id.Text; //买家名 g.Fkje = decimal.Parse(lab_zfje.Text); //应该付款金额 g.Compic = sqlHelper.tiqupic(pic_com, Application.StartupPath + "\\image\\jfkljfklsdjkflsdjflksajdkfj.jpg"); g.insertgoods(); //插入到订单表,插入到数据库 //开始刷新余额 lab_buydeyue.Text = sqlHelper.ExecutedataTable(string.Format("select yue from buyde where username = '******'", lab_Buyde_id.Text), CommandType.Text, null).Rows[0][0].ToString(); //直接进入订单表 if (this.Parent != null) { Frm_BuydeZhifu f = new Frm_BuydeZhifu(); f.TopLevel = false; f.Parent = this.Parent; f.Show(); f.BringToFront(); } else { Hide(); Frm_BuydeZhifu f = new Frm_BuydeZhifu(); f.ShowDialog(); Show(); } //Show(); } else { MessageBox.Show("出错,请稍后重试", "提示", MessageBoxButtons.OK, MessageBoxIcon.Error); st.Rollback();//回滚事务 } }
protected void btn_save_Click(object sender, EventArgs e) { try { DateTime dt = DateTime.Now; string gname = txt_name.Text.Trim(); string gtitle = txt_title.Text.Trim(); string gurl = txt_url.Text.Trim(); string gurl2 = txt_url2.Text.Trim(); string gimg = ""; string gimg2 = ""; string gstate1 = ddl_state_img.SelectedValue; string gstate2 = ddl_state_up.SelectedValue; string gstate3 = ddl_state_yh.SelectedValue; string gremark1 = txt_remark.Text.Trim(); int gtid = int.Parse(ddl_goodstype.SelectedValue); string gprice1 = txt_price1.Text.Trim(); string gprice2 = txt_price2.Text.Trim(); string gurl_yuan = txt_url_yuan.Text.Trim(); string gprice = txt_price.Text.Trim(); string important = ddl_important.SelectedValue; goods g = new goods(); if (!string.IsNullOrEmpty(id)) { g = BLL.goodsManager.SearchBygid(Convert.ToInt32(id)); gimg = g.gimg; gimg2 = g.gimg2; } else { g.gdate = dt; } if (string.IsNullOrEmpty(gname)) { //Manager.Alert("请输入商品简称", Page); AJAXManager.Alert(UpdatePanel1, "请输入商品简称"); Manager.TextBox_Select(txt_name); return; } if (gtid == 0) { //Manager.Alert("请选择店铺", Page); AJAXManager.Alert(UpdatePanel1, "请选择店铺"); ddl_goodstype.Focus(); return; } if (fu_img.HasFile && fu_img2.HasFile) { //Manager.Alert("暂时不能同时上传两个图片,请单独上传!", Page); AJAXManager.Alert(UpdatePanel1, "暂时不能同时上传两个图片,请单独上传!"); return; } else { if (fu_img.HasFile) { gimg = Manager.UpImage(fu_img, Request.PhysicalApplicationPath + "OA\\upload\\", Page); if (string.IsNullOrEmpty(gimg)) { //Manager.Alert("淘宝图片上传失败,请稍后再试", Page); AJAXManager.Alert(UpdatePanel1, "淘宝图片上传失败,请稍后再试"); return; } } if (fu_img2.HasFile) { gimg2 = Manager.UpImage(fu_img2, Request.PhysicalApplicationPath + "OA\\upload\\", Page); if (string.IsNullOrEmpty(gimg2)) { //Manager.Alert("淘宝图片上传失败,请稍后再试", Page); AJAXManager.Alert(UpdatePanel1, "淘宝图片上传失败,请稍后再试"); return; } } } g.gdate1 = gstate1 == "2" ? dt : new DateTime(); g.gdate2 = gstate2 == "2" ? dt : new DateTime(); g.gdate3 = gstate3 == "2" ? dt : new DateTime(); g.gimg = gimg; g.gimg2 = gimg2; g.gname = gname; g.gprice1 = gprice1; g.gprice2 = gprice2; g.gremark1 = gremark1; g.gstate1 = gstate1; g.gstate2 = gstate2; g.gstate3 = gstate3; g.gtid = gtid; g.gtitle = gtitle; g.gurl = gurl; g.gurl2 = gurl2; g.gurl_yuan = gurl_yuan; g.g_price_yuan = gprice; g.g_standby1 = important; int res; if (string.IsNullOrEmpty(id)) { res = BLL.goodsManager.Insert(g); } else { res = BLL.goodsManager.Update(g); } if (res == 1) { //Manager.Alert("保存成功", Page); AJAXManager.Alert(UpdatePanel1, "保存成功"); clear(); } else { //Manager.Alert("保存失败", Page); AJAXManager.Alert(UpdatePanel1, "保存失败"); } } catch (Exception ex) { //Manager.Alert(ex.ToString(), Page); AJAXManager.Alert(UpdatePanel1, ex.ToString()); } //Manager.page_href_reload(Page); }
public static int InsertGoods(goods goods) { return(igoods.InsertGoods(goods)); }
private void addgood_Click(object sender, RoutedEventArgs e) { ++k; var tmpNameGood = boxGood.Text; countAddGood.Text = k.ToString(); goods tmpGood= new goods(tmpNameGood, sliderCount.Value); listGoods.Add(tmpGood); nowList.ItemsSource = listGoods; boxGood.Text = ""; /* bool flag = false; for (int i = 0; i < popList.Count(); ++i) { if (tmpNameGood == popList[i].name) { popList[i].amount++; flag = true; break; } } if(flag==false) { popularListGoods tmpPop = new popularListGoods(tmpNameGood,1); popList.Add(tmpPop); } var listXml = docs.Descendants("good"); flag = false; for(int i=0;i<sortList.Count();++i){ foreach (var j in listXml){ if( j.Element("good").Value==popList[i].name) { j.Element("good").Attribute("count").Value = popList[i].amount.ToString(); flag = true; break; } } if (flag == false) { var writer = docs.CreateWriter(); writer.WriteElementString() // var element = docs.CreateElement("element"); //document.DocumentElement.AppendChild(element); // указываем родителя //XmlAttribute attribute = document.CreateAttribute("number"); // создаём атрибут attribute.Value = 1; // устанавливаем значение атрибута element.Attributes.Append(attribute); // добавляем атрибут } } */ }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { gsCount = esbll.GetModelList("").Count; if (gsCount % 5 == 0) { gsMaxPage = gsCount / 5; } else { gsMaxPage = gsCount / 5 + 1; } } // 点击客房收入时获取客房收入信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "grincome") { string sqlStrByPage = "select RoomType, BedType, count(*) as ckorderCount, SUM(C.cTotalPrice) as Total_gr_Income from CheckIn C, GuestRoomInfo G" + " where(CheckinStatus = 0 or CheckinStatus = 1 or CheckinStatus = 2 or CheckinStatus = 3)" + " and C.Gid = G.Gid group by G.RoomType, G.BedType"; Response.Write(Get_Serialize_Data_FromSql(connectString, sqlStrByPage)); Response.End(); } } // 点击额外服务收入时获取额外服务收入信息 if (!string.IsNullOrEmpty(Request["postTag"])) { if (Request["postTag"] == "gsincome") { List <ServiceOrder> sorderList = new List <ServiceOrder>(); sorderList = new ServiceOrderBLL().GetModelList("esOrderStatus = 0 or esOrderStatus = 1 or esOrderStatus = 2 or esOrderStatus = 3"); List <esorderInfo> orderinfoList = new List <esorderInfo>(); for (int b = 0; b < sorderList.Count; b++) { if (sorderList[b].esOrderContent != "") { esorderInfo info = new esorderInfo() { ordercontent = sorderList[b].esOrderContent }; orderinfoList.Add(info); } } List <goods> goodsList = new List <goods>(); string[] goodsinfo; for (int k = 0; k < orderinfoList.Count; k++) { goodsinfo = orderinfoList[k].ordercontent.Split(','); for (int c = 0; c < goodsinfo.Length; c++) { goods singlegoods = new goods() { goodsname = goodsinfo[c].Split('*')[0], count = int.Parse(goodsinfo[c].Split('*')[1]) }; goodsList.Add(singlegoods); } } List <goods> gsInfoList = new List <goods>(); goods singlegoods2 = new goods(); bool hasSame = false; for (int m = 0; m < goodsList.Count; m++) { for (int n = 0; n < gsInfoList.Count; n++) { if (gsInfoList[n].goodsname == goodsList[m].goodsname) { gsInfoList[n].count += goodsList[m].count; hasSame = true; break; } } if (!hasSame) { singlegoods2 = new goods { goodsname = goodsList[m].goodsname, count = goodsList[m].count }; gsInfoList.Add(singlegoods2); } else { hasSame = false; } } ExServiceBLL esbll = new ExServiceBLL(); for (int r = 0; r < gsInfoList.Count; r++) { gsInfoList[r].TotalPrice = float.Parse(esbll.GetModelList("GoodsName = '" + gsInfoList[r].goodsname + "'")[0].GoodsPrice.ToString()) * gsInfoList[r].count; } JavaScriptSerializer subjson = new JavaScriptSerializer(); object serializer_obj = subjson.Serialize(gsInfoList); Response.Write(serializer_obj); Response.End(); } } }
public IActionResult editPricePartialView(goods goods) { return(PartialView("editpricePartialView", goods)); }
public ActionResult addGoods() { service = new GoodService(); swapperService = new SwapperService(); categoryService = new CategoryService(); subCategoryService = new SubCategoryService(); int connectedSwapper = 1; // connected swapper -identity swapper user = swapperService.Get(u => u.id_swapper == connectedSwapper); ViewBag.user = user; string brand = Request.Form["brand"]; string description = Request.Form["desc"]; DateTime date = DateTime.Now; int validity = 0; int quantity = int.Parse(Request.Form["quantity"]); string label = Request.Form["label"]; Accpted accepted = Accpted.no; int catId = int.Parse(Request.Form["cat"]); //category cat = categoryService.Get(c => c.id_category == catId); int subCatId = int.Parse(Request.Form["subCat"]); //subCategory subCat = subCategoryService.Get(sc => sc.id_subCategory == subCatId); goods newGood = new goods(); newGood.label = label; newGood.brand = brand; newGood.description = description; newGood.date = date; newGood.validity = validity; newGood.quantity = quantity; newGood.accepted = accepted; //subCat.category = cat; newGood.subCategoryID = subCatId; newGood.swapperID = user.id_swapper; service.Add(newGood); service.Commit(); if (Request.Files[0].ContentLength > 0) // on a ajouté une image pour le produit { byte[] file = null; using (var binaryReader = new BinaryReader(Request.Files[0].InputStream)) { file = binaryReader.ReadBytes(Request.Files[0].ContentLength); } Image img = this.byteArrayToImage(file); img = new Bitmap(img, new Size(180, 180)); string path = "~/swapperImgs/" + newGood.id_goods + ".jpg"; img.Save(Server.MapPath(path), System.Drawing.Imaging.ImageFormat.Jpeg); newGood.image = path; service.Update(newGood); service.Commit(); } return(RedirectToAction("SearchGood")); }
private void metroTile6_Click(object sender, EventArgs e) { goods g = new goods(); g.Show(); }
/// <summary> /// 根据表,获取一个SqlParameter数组 /// </summary> /// <returns>SqlParameter[]</returns> public static SqlParameter[] GetSqlParameter(goods goodsExample) { List <SqlParameter> list_param = new List <SqlParameter>(); if (!string.IsNullOrEmpty(goodsExample.g_price_yuan)) { list_param.Add(new SqlParameter("@g_price_yuan", goodsExample.g_price_yuan)); } else { list_param.Add(new SqlParameter("@g_price_yuan", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.g_standby1)) { list_param.Add(new SqlParameter("@g_standby1", goodsExample.g_standby1)); } else { list_param.Add(new SqlParameter("@g_standby1", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.g_standby2)) { list_param.Add(new SqlParameter("@g_standby2", goodsExample.g_standby2)); } else { list_param.Add(new SqlParameter("@g_standby2", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.g_standby3)) { list_param.Add(new SqlParameter("@g_standby3", goodsExample.g_standby3)); } else { list_param.Add(new SqlParameter("@g_standby3", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gimg)) { list_param.Add(new SqlParameter("@gimg", goodsExample.gimg)); } else { list_param.Add(new SqlParameter("@gimg", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gimg2)) { list_param.Add(new SqlParameter("@gimg2", goodsExample.gimg2)); } else { list_param.Add(new SqlParameter("@gimg2", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gname)) { list_param.Add(new SqlParameter("@gname", goodsExample.gname)); } else { list_param.Add(new SqlParameter("@gname", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gprice1)) { list_param.Add(new SqlParameter("@gprice1", goodsExample.gprice1)); } else { list_param.Add(new SqlParameter("@gprice1", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gprice2)) { list_param.Add(new SqlParameter("@gprice2", goodsExample.gprice2)); } else { list_param.Add(new SqlParameter("@gprice2", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gremark1)) { list_param.Add(new SqlParameter("@gremark1", goodsExample.gremark1)); } else { list_param.Add(new SqlParameter("@gremark1", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gremark2)) { list_param.Add(new SqlParameter("@gremark2", goodsExample.gremark2)); } else { list_param.Add(new SqlParameter("@gremark2", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gstate)) { list_param.Add(new SqlParameter("@gstate", goodsExample.gstate)); } else { list_param.Add(new SqlParameter("@gstate", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gstate1)) { list_param.Add(new SqlParameter("@gstate1", goodsExample.gstate1)); } else { list_param.Add(new SqlParameter("@gstate1", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gstate2)) { list_param.Add(new SqlParameter("@gstate2", goodsExample.gstate2)); } else { list_param.Add(new SqlParameter("@gstate2", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gstate3)) { list_param.Add(new SqlParameter("@gstate3", goodsExample.gstate3)); } else { list_param.Add(new SqlParameter("@gstate3", DBNull.Value)); } if (goodsExample.gtid != 0) { list_param.Add(new SqlParameter("@gtid", goodsExample.gtid)); } else { list_param.Add(new SqlParameter("@gtid", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gtitle)) { list_param.Add(new SqlParameter("@gtitle", goodsExample.gtitle)); } else { list_param.Add(new SqlParameter("@gtitle", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gurl)) { list_param.Add(new SqlParameter("@gurl", goodsExample.gurl)); } else { list_param.Add(new SqlParameter("@gurl", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gurl_yuan)) { list_param.Add(new SqlParameter("@gurl_yuan", goodsExample.gurl_yuan)); } else { list_param.Add(new SqlParameter("@gurl_yuan", DBNull.Value)); } if (!string.IsNullOrEmpty(goodsExample.gurl2)) { list_param.Add(new SqlParameter("@gurl2", goodsExample.gurl2)); } else { list_param.Add(new SqlParameter("@gurl2", DBNull.Value)); } SqlParameter[] param = new SqlParameter[list_param.Count]; int index = 0; foreach (SqlParameter p in list_param) { param[index] = p; index++; } return(param); }
public void addNewGoods(goods goods) { _goodsRepo.addGoods(goods); }
/// <summary> /// 更新 /// </summary> /// <param name="goods">goods表实例</param> /// <returns>int</returns> public int Update(goods goodsExample) { DBHelper.sqlstr = "update goods set g_price_yuan=@g_price_yuan,g_standby1=@g_standby1,g_standby2=@g_standby2,g_standby3=@g_standby3,gdate='" + goodsExample.gdate.ToString("yyyy-MM-dd") + "',gdate1='" + goodsExample.gdate1.ToString("yyyy-MM-dd") + "',gdate2='" + goodsExample.gdate2.ToString("yyyy-MM-dd") + "',gdate3='" + goodsExample.gdate3.ToString("yyyy-MM-dd") + "',gimg=@gimg,gimg2=@gimg2,gname=@gname,gprice1=@gprice1,gprice2=@gprice2,gremark1=@gremark1,gremark2=@gremark2,gstate=@gstate,gstate1=@gstate1,gstate2=@gstate2,gstate3=@gstate3,gtid=@gtid,gtitle=@gtitle,gurl=@gurl,gurl_yuan=@gurl_yuan,gurl2=@gurl2 where gid=" + goodsExample.gid; return(DBHelper.ExecuteNonQuery(GetSqlParameter(goodsExample))); }
public void updatePrice(goods goods) { _goodsRepo.updatePrice(goods); }
/// <summary> /// 创建新的 goods 对象。 /// </summary> /// <param name="goodsid">goodsid 的初始值。</param> /// <param name="name">name 的初始值。</param> public static goods Creategoods(string goodsid, string name) { goods goods = new goods(); goods.goodsid = goodsid; goods.name = name; return goods; }
//结束 #endregion /// <summary> /// 代码生成数据库中的订单数据 /// </summary> void sckjmen() { for (int i = 0; i < 10; i++)//重新载入订单表需要清空生的控件们 { foreach (Control item in pan_goods.Controls) { if (item == lab_tip) { continue; //除了悬浮提示外其它的都清除,然后重新再生成,达到刷新的效果 } pan_goods.Controls.Remove(item); } } //查询有关于这个卖家的数据 string sql = string.Format("select * from goods where selledname = '{0}'", love.denglu_username == string.Empty ? "a" : love.denglu_username); DataTable d = sqlHelper.ExecutedataTable(sql, CommandType.Text, null); //查询总金额 string fdas = string.Format("select sum(fkje) from goods where goods.selledname = '{0}'", love.denglu_username == string.Empty ? "a" : love.denglu_username); DataTable jlk = sqlHelper.ExecutedataTable(fdas, CommandType.Text, null); string zongjinge = string.Empty;//总金额 try { zongjinge = jlk.Rows[0][0].ToString();//如果没有金额就会出错 lab_tip.Text = string.Format("tip:亲爱的 {0} (づ ̄3 ̄)づ╭❤~,你总共售出了 {1} 件商品,总共获得盈利 {2} 元,再接再厉哦!", love.denglu_username == string.Empty ? "a" : love.denglu_username, d.Rows.Count.ToString(), zongjinge.ToString()); } catch (Exception) { lab_tip.Text = string.Format("tip:亲爱的 {0} (づ ̄3 ̄)づ╭❤~,你总共售出了 {1} 件商品,总共获得盈利 {2} 元,再接再厉哦!", love.denglu_username == string.Empty ? "a" : love.denglu_username, d.Rows.Count.ToString(), 0); throw; } Point panzuixin = new Point(); //用来记录下pannel的最新的位置,一个pannel一个商品订单 bool bol = true; //如果pannel是第一次诞生那么他是true,否则会false for (int i = 0; i < d.Rows.Count; i++) //有多少个订单就循环多少次 { Panel pan_gs = new Panel(); //用来记录下最新的位置 pan_goods.Controls.Add(pan_gs); pan_gs.BorderStyle = BorderStyle.FixedSingle; pan_gs.Size = new Size(pan_goods.Width - 80, 140); #region pan_gs的位置算法 if (bol) //说明它是第一次诞生 { bol = false; //说明有过了第一个pannel pan_gs.Location = new Point((pan_goods.Width - pan_gs.Width) / 2, pan_goods.Top + 5); //x等于平均,y等于最外的pannel,最外的自带内边距,y轴不加 Point poc = new Point(pan_gs.Location.X, pan_gs.Location.Y + pan_gs.Height + 20); //第一个pannel的x,y加20像素 panzuixin = poc; //把第一次的我位置传出去 } else//如果不是第一次诞生就使用上次的位置y轴加20像素 { pan_gs.Location = panzuixin; Point poc = new Point(pan_gs.Location.X, pan_gs.Location.Y + pan_gs.Height + 20); //第一个pannel的x,y加20像素 panzuixin = poc; //把最后一个pannel的位置传出去 } #endregion // PictureBox compic = new PictureBox();//商品图片 compic.Name = "compic"; compic.SizeMode = PictureBoxSizeMode.Zoom; compic.Size = new Size(120, 120); sqlHelper.imagechu(d.Rows[i]["compic"], compic); //compic.BorderStyle = BorderStyle.FixedSingle; compic.Location = new Point(25, (pan_gs.Height - compic.Height) / 2); Label comname = new Label();//商品名 comname.AutoSize = true; comname.Text = "商品名称: " + d.Rows[i]["comname"].ToString(); comname.Location = new Point(compic.Right + 30, compic.Top + 7); Label fkje = new Label();//付款金额 fkje.AutoSize = true; fkje.Text = "付款金额: " + d.Rows[i]["fkje"].ToString(); fkje.Location = new Point(comname.Left, comname.Bottom); Label fktime = new Label();//付款时间 fktime.AutoSize = true; fktime.Text = "付款时间:" + d.Rows[i]["fktime"].ToString(); fktime.Location = new Point(fkje.Left + 150, fkje.Top); Label cmid = new Label();//商品编号 cmid.AutoSize = true; cmid.Text = "商品编号: " + d.Rows[i]["cmid"].ToString(); cmid.Location = new Point(fkje.Left, fkje.Bottom); Label pjdh = new Label();//评价单号 pjdh.AutoSize = true; pjdh.Text = "订单编号:" + d.Rows[i]["pjdh"].ToString(); pjdh.Location = new Point(cmid.Left + 150, cmid.Top); goods ggg = new goods(); ggg.Pjdh = long.Parse(d.Rows[i]["pjdh"].ToString()); if (ggg.isorneirong())//ture说明没有评价内容,也没有评价星级,那么就开始评价 { //开始获取买家的昵称 string strnc = string.Format("select nicheng from buyde where username= '******'", d.Rows[i]["buydename"].ToString()); DataTable dtnc = sqlHelper.ExecutedataTable(strnc, CommandType.Text, null); Label pjren = new Label();//评价人的昵称 pjren.Text = "买家名称: " + dtnc.Rows[0]["nicheng"].ToString(); pjren.Tag = "pjren"; pjren.AutoSize = true; pan_gs.Controls.Add(pjren); pjren.Location = new Point(cmid.Left, cmid.Bottom); Label pjnr = new Label();//评价者的 pjnr.Text = "买家 " + dtnc.Rows[0]["nicheng"].ToString() + " 对此次交易暂时未给出评价"; pjnr.Tag = "pjnr"; pjnr.AutoSize = true; pan_gs.Controls.Add(pjnr); pjnr.Location = new Point(pjren.Left, pjren.Bottom + pjren.Height); } else//说明评价完星级和内容了,可以开始直接显示了 { Label pjxj = new Label(); pan_gs.Controls.Add(pjxj); pjxj.AutoSize = true; pjxj.Location = new Point(cmid.Left, cmid.Bottom); pjxj.Text = "评价星级:"; //后面记得加上数据库的星级 //查询数据库的星级然后循环出对应的星星数量 bool diyicixx = true; //判断是否第一次产生星星 Point pinxx = new Point(); //存储星星的最新位置 DataTable tabxj = sqlHelper.ExecutedataTable(string.Format("select xingji,neirong from goods where pjdh = {0}", d.Rows[i]["pjdh"].ToString()), CommandType.Text, null); int jkx = int.Parse(tabxj.Rows[0]["xingji"].ToString()); for (int forxx = 0; forxx < jkx; forxx++) { PictureBox xx = new PictureBox(); //星级放到评价单号的右边 pan_gs.Controls.Add(xx); xx.Size = new Size(19, 19); //图片为19,正好盛放 xx.Image = Image.FromFile(Application.StartupPath + "\\image\\haop.png"); //好评图片 if (diyicixx) { xx.Location = new Point(pjxj.Right, pjxj.Top - 4); pinxx = new Point(xx.Right + xx.Width + 10, xx.Top); diyicixx = false;//执行后说明它不是第一次运行 } else { xx.Location = pinxx; Point temp = new Point(xx.Right + xx.Width + 10, xx.Top); pinxx = temp; } } Label pjtime = new Label(); pjtime.AutoSize = true; pjtime.Text = "评价时间:" + d.Rows[0]["pjtime"].ToString(); pjtime.Location = new Point(pjxj.Right + 240, pjxj.Top);//240五颗星位置 pan_gs.Controls.Add(pjtime); Label neirong = new Label();//评价内容 neirong.AutoSize = true; neirong.Text = "评价内容:" + tabxj.Rows[0]["neirong"].ToString(); neirong.Location = new Point(pjxj.Left, pjxj.Bottom + pjxj.Height); pan_gs.Controls.Add(neirong); //开始获取买家的昵称 string strnc = string.Format("select nicheng from buyde where username= '******'", d.Rows[i]["buydename"].ToString()); DataTable dtnc = sqlHelper.ExecutedataTable(strnc, CommandType.Text, null); Label pjren = new Label();//评价人的昵称 pjren.Text = "买家名称: " + dtnc.Rows[0]["nicheng"].ToString(); pjren.Tag = "pjren"; pjren.AutoSize = true; pan_gs.Controls.Add(pjren); pjren.Location = new Point(pjdh.Right + 50, pjdh.Top); } //pan_gs.ForeColor = Color.Transparent; Control[] ctl = { pjdh, cmid, comname, compic, fkje, fktime }; pan_gs.Controls.AddRange(ctl); Button bbb = new Button(); pan_goods.Controls.Add(bbb); bbb.Location = new Point(100, 100);//让它来承载焦点,否则将会自动把焦点赋予给星级框 bbb.Focus(); }//订单循环结束 }
public GoodModels() { listGoods = IGS.GetAll(); goood = new goods(); }
public void deleteGoods(goods one) { string str = "delete from global where number =" + "'" + one.number + "'"; excuteCommand(str); }