private void RptBind(string _strWhere, string _orderby) { this.txtKeywords.Text = this.keywords; BLL.distribution bll = new BLL.distribution(); this.rptList.DataSource = bll.GetList(0, _strWhere, _orderby); this.rptList.DataBind(); }
private void ShowInfo(int _id) { BLL.distribution bll = new BLL.distribution(); Model.distribution model = bll.GetModel(_id); txtTitle.Text = model.title; rblType.SelectedValue = model.type.ToString(); rblIsLock.SelectedValue = model.is_lock.ToString(); txtSortId.Text = model.sort_id.ToString(); txtAmount.Text = model.amount.ToString(); txtRemark.Text = model.remark; }
/// <summary> /// 返回配送列表 /// </summary> /// <param name="top">显示条数</param> /// <param name="strwhere">查询条件</param> /// <returns>DataTable</returns> protected DataTable get_distribution_list(int top, string strwhere) { DataTable dt = new DataTable(); string _where = "is_lock=0"; if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } dt = new BLL.distribution().GetList(top, _where, "sort_id asc,id desc").Tables[0]; return dt; }
/// <summary> /// 返回配送列表 /// </summary> /// <param name="top">显示条数</param> /// <param name="strwhere">查询条件</param> /// <returns>DataTable</returns> protected DataTable get_distribution_list(int top, string strwhere) { DataTable dt = new DataTable(); string _where = "is_lock=0"; if (!string.IsNullOrEmpty(strwhere)) { _where += " and " + strwhere; } dt = new BLL.distribution().GetList(top, _where, "sort_id asc,id desc").Tables[0]; return(dt); }
//批量删除 protected void btnDelete_Click(object sender, EventArgs e) { ChkAdminLevel("distribution", DTEnums.ActionEnum.Delete.ToString()); //检查权限 BLL.distribution bll = new BLL.distribution(); for (int i = 0; i < rptList.Items.Count; i++) { int id = Convert.ToInt32(((HiddenField)rptList.Items[i].FindControl("hidId")).Value); CheckBox cb = (CheckBox)rptList.Items[i].FindControl("chkId"); if (cb.Checked) { bll.Delete(id); } } JscriptMsg("批量删除成功啦!", Utils.CombUrlTxt("distribution_list.aspx", "keywords={0}", this.keywords), "Success"); }
private bool DoAdd() { bool result = true; Model.distribution model = new Model.distribution(); BLL.distribution bll = new BLL.distribution(); model.title = txtTitle.Text.Trim(); model.type = int.Parse(rblType.SelectedValue); model.is_lock = int.Parse(rblIsLock.SelectedValue); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.amount = decimal.Parse(txtAmount.Text.Trim()); model.remark = txtRemark.Text; if (bll.Add(model) < 1) { result = false; } return result; }
private bool DoAdd() { bool result = true; Model.distribution model = new Model.distribution(); BLL.distribution bll = new BLL.distribution(); model.title = txtTitle.Text.Trim(); model.type = int.Parse(rblType.SelectedValue); model.is_lock = int.Parse(rblIsLock.SelectedValue); model.sort_id = int.Parse(txtSortId.Text.Trim()); model.amount = decimal.Parse(txtAmount.Text.Trim()); model.remark = txtRemark.Text; if (bll.Add(model) < 1) { result = false; } return(result); }
private void order_save(HttpContext context) { int payment_id = DTRequest.GetFormInt("payment_id"); int distribution_id = DTRequest.GetFormInt("distribution_id"); string accept_name = DTRequest.GetFormString("accept_name"); string post_code = DTRequest.GetFormString("post_code"); string telphone = DTRequest.GetFormString("telphone"); string mobile = DTRequest.GetFormString("mobile"); string address = DTRequest.GetFormString("address"); string message = DTRequest.GetFormString("message"); //检查配送方式 if (distribution_id == 0) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请选择配送方式!\"}"); return; } Model.distribution disModel = new BLL.distribution().GetModel(distribution_id); if (disModel == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您选择的配送方式不存在或已删除!\"}"); return; } //检查支付方式 if (payment_id == 0) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请选择支付方式!\"}"); return; } Model.payment payModel = new BLL.payment().GetModel(payment_id); if (payModel == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,您选择的支付方式不存在或已删除!\"}"); return; } //检查收货人 if (string.IsNullOrEmpty(accept_name)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入收货人姓名!\"}"); return; } //检查手机和电话 if (string.IsNullOrEmpty(telphone) && string.IsNullOrEmpty(mobile)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入收货人联系电话或手机!\"}"); return; } //检查地址 if (string.IsNullOrEmpty(address)) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,请输入详细的收货地址!\"}"); return; } //检查用户是否登录 Model.users userModel = new BasePage().GetUserInfo(); if (userModel == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,用户没有登录或登录超时啦!\"}"); return; } //检查购物车商品 IList<Model.cart_items> iList = DTcms.Web.UI.ShopCart.GetList(userModel.group_id); if (iList == null) { context.Response.Write("{\"msg\":0, \"msgbox\":\"对不起,购物车为空,无法结算!\"}"); return; } //统计购物车 Model.cart_total cartModel = DTcms.Web.UI.ShopCart.GetTotal(userModel.group_id); //保存订单======================================================================= Model.orders model = new Model.orders(); model.order_no = Utils.GetOrderNumber(); //订单号 model.user_id = userModel.id; model.user_name = userModel.user_name; model.payment_id = payment_id; model.distribution_id = distribution_id; model.accept_name = accept_name; model.post_code = post_code; model.telphone = telphone; model.mobile = mobile; model.address = address; model.message = message; model.payable_amount = cartModel.payable_amount; model.real_amount = cartModel.real_amount; model.payable_freight = disModel.amount; //应付运费 model.real_freight = disModel.amount; //实付运费 //如果是先款后货的话 if (payModel.type == 1) { if (payModel.poundage_type == 1) //百分比 { model.payment_fee = model.real_amount * payModel.poundage_amount / 100; } else //固定金额 { model.payment_fee = payModel.poundage_amount; } } //订单总金额=实付商品金额+运费+支付手续费 model.order_amount = model.real_amount + model.real_freight + model.payment_fee; //购物积分,可为负数 model.point = cartModel.total_point; model.add_time = DateTime.Now; //商品详细列表 List<Model.order_goods> gls = new List<Model.order_goods>(); foreach (Model.cart_items item in iList) { gls.Add(new Model.order_goods { goods_id = item.id, goods_name = item.title, goods_price = item.price, real_price = item.user_price, quantity = item.quantity, point = item.point }); } model.order_goods = gls; int result = new BLL.orders().Add(model); if (result < 1) { context.Response.Write("{\"msg\":0, \"msgbox\":\"订单保存过程中发生错误,请重新提交!\"}"); return; } //扣除积分 if (model.point < 0) { new BLL.point_log().Add(model.user_id, model.user_name, model.point, "积分换购,订单号:" + model.order_no); } //清空购物车 DTcms.Web.UI.ShopCart.Clear("0"); //提交成功,返回URL context.Response.Write("{\"msg\":1, \"url\":\"" + new Web.UI.BasePage().linkurl("payment1", "confirm", DTEnums.AmountTypeEnum.BuyGoods.ToString(), model.order_no) + "\", \"msgbox\":\"恭喜您,订单已成功提交!\"}"); return; }