private bool DoEdit(int _id) { DateTime now = DateTime.Now; string note_no = now.ToString("yy") + now.ToString("MM") + now.ToString("dd") + now.ToString("HH") + now.ToString("mm") + now.ToString("ss"); bool result = false; ps_here_depot model = new ps_here_depot(); model.GetModel(_id); model.product_num = int.Parse(Litproduct_num.Text) - int.Parse(txtproduct_num.Text); ps_join_depot model1 = new ps_join_depot(); model1.product_category_id = model.product_category_id; model1.note_no = note_no; model1.add_time = DateTime.Now; model1.product_name = model.product_name; model1.product_code_state = "退货"; model1.go_price = model.go_price; model1.salse_price = model.salse_price; model1.user_id = Convert.ToInt32(Session["AID"]); model1.product_num = int.Parse(txtproduct_num.Text); model1.here_depot_id = _id; model1.dw = model.dw; model1.Add(); if (model.UpdateALL()) { mym.AddAdminLog("出库", "出库商品:" + txtproduct_name.Text); //记录日志 result = true; } return(result); }
/// <summary> /// 获得购物车列表 /// </summary> public static IList <cart_items> GetList() { IDictionary <string, int> dic = GetCart(); if (dic != null) { IList <cart_items> iList = new List <cart_items>(); foreach (var item in dic) { ps_here_depot model = new ps_here_depot(); model.GetModel(Convert.ToInt32(item.Key)); cart_items modelt = new cart_items(); modelt.id = model.id; modelt.title = model.product_name; modelt.img_url = model.product_url; modelt.product_category_id = Convert.ToInt32(model.product_category_id); modelt.dw = model.dw; modelt.price = Utils.StrToDecimal(model.salse_price.ToString(), 0); modelt.quantity = item.Value; iList.Add(modelt); } return(iList); } return(null); }
private void ShowInfo(int _id) { ps_here_depot model1 = new ps_here_depot(); model1.GetModel(_id); this.dw = model1.dw; this.ddlproduct_category_id.Text = new ps_product_category().GetTitle(Convert.ToInt32(model1.product_category_id)); this.txtImgUrl.ImageUrl = model1.product_url; this.txtproduct_name.Text = model1.product_name; this.txtgo_price.Text = MyConvert(model1.go_price.ToString()); this.txtsalse_price.Text = MyConvert(model1.salse_price.ToString()); this.Litproduct_num.Text = model1.product_num.ToString(); }
// 可以订购 protected void lbtnRefuseCaDG_Click(object sender, EventArgs e) { this.page = AXRequest.GetQueryInt("page", 1); // 当前点击的按钮 LinkButton lb = (LinkButton)sender; int caId = int.Parse(lb.CommandArgument); ps_here_depot bll = new ps_here_depot(); bll.GetModel(caId); bll.id = caId; bll.is_xs = 0; bll.UpdateXS(); //更新是否暂停订购 mym.JscriptMsg(this.Page, " 设置成功!", Utils.CombUrlTxt("depot_manager.aspx", "product_category_id={0}¬e_no={1}", this.product_category_id.ToString(), txtNote_no.Text), "Success"); }
//绑定记录 public void binddr() { string sqlstr = ""; ps_here_depot bll = new ps_here_depot(); if (Convert.ToInt32(Session["DepotID"]) == 0 && Convert.ToInt32(Session["DepotCatID"]) == 0) { sqlstr = "id>0"; sqlstr = sqlstr + CombSqlTxt(this.product_category_id, this.note_no); } sqlstr = sqlstr + " order by add_time desc,id desc"; DataView dv = bll.GetList(sqlstr).Tables[0].DefaultView; repCategory.DataSource = dv; repCategory.DataBind(); }
private bool DoEdit(int _id) { bool result = false; ps_here_depot model = new ps_here_depot(); model.GetModel(_id); model.product_url = this.txtImgUrl.Text; model.product_category_id = int.Parse(ddlproduct_category_id.SelectedValue); model.product_name = txtproduct_name.Text; model.go_price = Convert.ToDecimal(this.txtgo_price.Text); model.salse_price = Convert.ToDecimal(this.txtsalse_price.Text); if (model.UpdateALL()) { mym.AddAdminLog("修改", "修改商品:" + txtproduct_name.Text); //记录日志 result = true; } return(result); }
private bool DoAdd() { DateTime now = DateTime.Now; string note_no = now.ToString("yy") + now.ToString("MM") + now.ToString("dd") + now.ToString("HH") + now.ToString("mm") + now.ToString("ss"); ps_join_depot model = new ps_join_depot(); model.product_category_id = int.Parse(ddlproduct_category_id.SelectedValue); model.note_no = note_no; model.add_time = DateTime.Now; model.product_name = txtproduct_name.Text; model.product_code_state = "入库"; model.go_price = Convert.ToDecimal(txtgo_price.Text); model.salse_price = Convert.ToDecimal(txtsalse_price.Text); model.user_id = Convert.ToInt32(Session["AID"]); model.product_num = int.Parse(txtproduct_num.Text); model.dw = txtdw.Text; ps_here_depot model1 = new ps_here_depot(); model1.product_url = txtImgUrl.Text; model1.product_category_id = int.Parse(ddlproduct_category_id.SelectedValue); model1.add_time = DateTime.Now; model1.product_name = txtproduct_name.Text; model1.go_price = Convert.ToDecimal(txtgo_price.Text); model1.salse_price = Convert.ToDecimal(txtsalse_price.Text); model1.user_id = Convert.ToInt32(Session["AID"]); model1.product_num = int.Parse(txtproduct_num.Text); model1.dw = txtdw.Text; model1.remark = txtremark.Text; model1.Add(); model.here_depot_id = model1.GetMaxId(Convert.ToInt32(Session["AID"])); if (model.Add() > 0) { mym.AddAdminLog("入库", "商品入库,入库单号:" + note_no); //记录日志 return(true); } return(false); }
private void RptBind(string _strWhere, string _orderby) { this.page = AXRequest.GetQueryInt("page", 1); if (this.product_category_id > 0) { this.ddlproduct_category_id.SelectedValue = this.product_category_id.ToString(); } txtNote_no.Text = this.note_no; ps_here_depot bll = new ps_here_depot(); this.rptList.DataSource = bll.GetList(this.pageSize, this.page, _strWhere, _orderby, out this.totalCount); this.rptList.DataBind(); //绑定页码 txtPageNum.Text = this.pageSize.ToString(); string pageUrl = Utils.CombUrlTxt("depot_manager.aspx", "product_category_id={0}¬e_no={1}&page={2}", this.product_category_id.ToString(), this.note_no, "__id__"); PageContent.InnerHtml = Utils.OutPageList(this.pageSize, this.page, this.totalCount, pageUrl, 8); }
// 单个删除 protected void lbtnDelCa_Click(object sender, EventArgs e) { // 当前点击的按钮 LinkButton lb = (LinkButton)sender; int caId = int.Parse(lb.CommandArgument); ps_product_category bll = new ps_product_category(); bll.GetModel(caId); string title = bll.title; ps_here_depot bllpp = new ps_here_depot(); bllpp.product_category_id = caId; if (!bllpp.ExistsBM())//查找是否存在下级商品 { bll.Delete(caId); mym.AddAdminLog("删除", "删除商品类别:" + title + ""); //记录日志 mym.JscriptMsg(this.Page, " 成功删除商品类别:" + title + "", Utils.CombUrlTxt("product_category_list.aspx", "keywords={0}&page={1}", this.keywords, this.page.ToString()), "Success"); } else { mym.JscriptMsg(this.Page, "有商品属于该商品类别,不能删除!", "", "Error"); return; } }
//提交订单 protected void btnSubmit_Click(object sender, EventArgs e) { int user_id = 0; int depot_category_id = 0; int depot_id = 0; string user_name = string.Empty; user_id = Convert.ToInt32(Session["AID"]); depot_category_id = Convert.ToInt32(Session["DepotCatID"]); depot_id = Convert.ToInt32(Session["DepotID"]); user_name = Session["AdminName"].ToString(); //检查购物车商品 IList <cart_items> iList = ShopCart.GetList(); if (iList == null) { mym.JscriptMsg(this.Page, "对不起,购物车为空,无法结算!", "", "Error"); return; } //统计购物车 cart_total cartModel = ShopCart.GetTotal(); //判断是否有商品 if (cartModel.payable_amount == 0) { mym.JscriptMsg(this.Page, "对不起,购物车为空,无法结算!", "", "Error"); return; } //保存订单======================================================================= ps_orders model = new ps_orders(); model.order_no = Utils.GetOrderNumber(); //订单号B开头为商品订单 model.user_id = user_id; model.depot_category_id = depot_category_id; model.depot_id = depot_id; model.user_name = user_name; model.payment_id = 1;//未支付 model.message = message.Text; model.payable_amount = cartModel.payable_amount; model.real_amount = 0; //订单总金额=实付商品金额 model.order_amount = cartModel.payable_amount; model.add_time = DateTime.Now; if (model.Add() == 0) { mym.JscriptMsg(this.Page, "订单保存过程中发生错误,请重新提交!", "", "Error"); return; } //商品详细列表 ps_order_goods gls = new ps_order_goods(); ps_here_depot my = new ps_here_depot(); foreach (cart_items item in iList) { my.GetModel(item.id); gls.order_id = model.GetMaxId(); gls.goods_id = item.id; gls.goods_title = item.title; gls.goods_price = my.go_price; gls.real_price = item.price; gls.quantity = item.quantity; gls.product_category_id = item.product_category_id; gls.dw = item.dw; gls.Add(); } //清空购物车 ShopCart.Clear("0"); //提交成功,返回URL mym.JscriptMsg(this.Page, "恭喜您,订单已成功提交!", "my_order.aspx", "Success"); return; }