protected void btnUpdateGoods_Click(object sender, EventArgs e) { if (!string.IsNullOrEmpty(Request["upid"])) { if (EnshineUnionManager.model.SearchDataClass.IsNumber(Request["upid"]) == true) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { goodspackage upNot = db.goodspackage.Single(x => x.goodsId == int.Parse(Request["upid"])); upNot.goodstitle = txtTitle.Value.Trim(); upNot.goodscontent = SearchDataClass.CheckStr(txtFckContent.Value); upNot.goodsvalidate = Convert.ToChar(drpValidate.SelectedValue); upNot.setindex = Convert.ToChar(drpSetIndex.SelectedValue); upNot.goodscode = txtGoodsCode.Value; upNot.goodsprice = Convert.ToDecimal(txtGoodsPrice.Value); upNot.goodssort = int.Parse(drpGoodsSort.SelectedValue); if (!string.IsNullOrEmpty(HFurl.Value)) { upNot.goodsimg = HFurl.Value.Trim(); } upNot.goodstock = int.Parse(txtStockNum.Value); upNot.goodsSales = Convert.ToChar(drpSales.SelectedValue); upNot.goodscost = Convert.ToDecimal(txtGoodsCost.Value); upNot.ifexchange = Convert.ToChar(drpExchangeGood.SelectedValue); if (!string.IsNullOrEmpty(txtExchangePoint.Value)) { upNot.exchangepoint = int.Parse(txtExchangePoint.Value); } if (!string.IsNullOrEmpty(txtGetGoodPoint.Value)) { upNot.getgoodpoint = int.Parse(txtGetGoodPoint.Value); } upNot.tichengpoint = ticheng.Value == "" ? "0/20/20/10" : ticheng.Value; //upNot.goodgoldprice = Convert.ToDecimal(txtGoldPrice.Value); //upNot.goodsilverprice = Convert.ToDecimal(txtSilverprice.Value); upNot.ifxiangou = Convert.ToChar(drpXianGou.SelectedValue); upNot.xiangounumber = txtXianGouNumber.Value == "" ? "0/0/0" : txtXianGouNumber.Value;; upNot.goodsspec = txtGoodsSpec.Value; upNot.goodscompany = txtGoodsCompany.Value; //upNot.iftuangou = Convert.ToChar(drpGroupBy.SelectedValue); // upNot.expiredate = Convert.ToDateTime(txtExpireDate.Value); // upNot.selectytsort = Convert.ToChar(drpSaleGoodsSort.SelectedValue); db.SubmitChanges(); } } Response.Redirect("GoodsPackageManager.aspx?mid=" + Request["mid"]); } }
protected void btnAddGoods_Click(object sender, EventArgs e) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { goodspackage addNot = new goodspackage(); 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.goodspackage.InsertOnSubmit(addNot); db.SubmitChanges(); } Response.Redirect("GoodsPackageManager.aspx?mid=" + Request["mid"]); }
public void BindShowUpInfo(string strUpid) { if (!string.IsNullOrEmpty(strUpid)) { if (EnshineUnionManager.model.SearchDataClass.IsNumber(strUpid) == true) { using (EnshineUnionDataContext db = new EnshineUnionDataContext()) { goodspackage getNot = db.goodspackage.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(); } } } }