/*#region 绑定类别================================= * private void TreeBind(int _channel_id) * { * BLL.article_category bll = new BLL.article_category(); * DataTable dt = bll.GetList(0, _channel_id); * * this.ddlCategoryId.Items.Clear(); * this.ddlCategoryId.Items.Add(new ListItem("请选择类别...", "")); * foreach (DataRow dr in dt.Rows) * { * string Id = dr["id"].ToString(); * int ClassLayer = int.Parse(dr["class_layer"].ToString()); * string Title = dr["title"].ToString().Trim(); * * if (ClassLayer == 1) * { * this.ddlCategoryId.Items.Add(new ListItem(Title, Id)); * } * else * { * Title = "├ " + Title; * Title = Vincent._DTcms.Utils.StringOfChar(ClassLayer - 1, " ") + Title; * this.ddlCategoryId.Items.Add(new ListItem(Title, Id)); * } * } * } #endregion*/ #region 赋值操作================================= private void ShowInfo(int _id) { BLL.openarea bll = new BLL.openarea(); Model.openarea model = bll.GetModel(_id); provinces.Value = model.provinces; provinces1.Value = model.provinces; city.Value = model.city; city1.Value = model.city; }
protected string CombSqlTxt(int _outlet_id, int _city_id, string _keywords) { StringBuilder strTemp = new StringBuilder(); if (_city_id > 0) { BLL.openarea open = new BLL.openarea(); Model.openarea openm = open.GetModel(_city_id); if (openm != null) { BLL.outlet outlet = new BLL.outlet(); DataTable dt = outlet.GetList(0, " city='" + openm.city + "'", " id").Tables[0]; if (dt.Rows.Count > 0) { StringBuilder st = new StringBuilder(); string ss = string.Empty; st.Append("("); foreach (DataRow item in dt.Rows) { st.Append(item["id"] + ","); } if (st.ToString().Trim() != "(") { ss = DelLastComma(st.ToString().Trim()); st.Append(")"); } strTemp.Append(" and store_id in" + ss + ")"); } else { strTemp.Append(" and store_id in(null)"); } } } if (_outlet_id > 0) { strTemp.Append(" and store_id=" + _outlet_id); } _keywords = _keywords.Replace("'", ""); if (!string.IsNullOrEmpty(_keywords)) { strTemp.Append(" and (user_name='" + _keywords + "' or remark like '%" + _keywords + "%')"); } return(strTemp.ToString()); }
/// <summary> /// 获取订单总金额 /// </summary> /// <param name="total_amount"></param> protected void getTotalAmount() { total_amount = 0M; coupon_amount = 0M; refund_amount = 0M; if (datetime == null) { BLL.orders bll = new BLL.orders(); DataTable dt; if (this.outlet_id > 0) { dt = bll.GetOrderAmount(0, " status!=1 and status!=99 and store_id=" + this.outlet_id, " add_time desc,id desc").Tables[0]; } else if (this.city_id > 0) { BLL.openarea open = new BLL.openarea(); Model.openarea openm = open.GetModel(this.city_id); StringBuilder strTemp = new StringBuilder(); if (openm != null) { BLL.outlet outlet = new BLL.outlet(); DataTable dts = outlet.GetList(0, " city='" + openm.city + "'", " id").Tables[0]; if (dts.Rows.Count > 0) { StringBuilder st = new StringBuilder(); string ss = string.Empty; st.Append("("); foreach (DataRow item in dts.Rows) { st.Append(item["id"] + ","); } if (st.ToString().Trim() != "(") { ss = DelLastComma(st.ToString().Trim()); st.Append(")"); } strTemp.Append(" and store_id in" + ss + ")"); } else { strTemp.Append(" and store_id in(null)"); } } dt = bll.GetOrderAmount(0, " status!=1 and status!=99" + strTemp, " add_time desc,id desc").Tables[0]; } else { dt = bll.GetOrderAmount(0, " status!=1 and status!=99", " add_time desc,id desc").Tables[0]; } foreach (DataRow row in dt.Rows) { total_amount += decimal.Parse(row["order_amount"].ToString()); if (row["refund_status"].ToString() != "" && int.Parse(row["refund_status"].ToString()) == 3) //统计退款 { refund_amount += decimal.Parse(row["order_amount"].ToString()); } BLL.user_coupon_log couponbll = new BLL.user_coupon_log();//统计优惠券 if (row["str_code"].ToString() != "") { Model.user_coupon_log couponmodel = couponbll.GetModel(row["str_code"].ToString()); if (couponmodel != null && couponmodel.status == 2) { BLL.user_coupon copbl = new BLL.user_coupon(); Model.user_coupon copmo = copbl.GetModel(couponmodel.coupon_id); if (copmo != null) { if (copmo.amount > decimal.Parse(row["order_amount"].ToString())) { coupon_amount += decimal.Parse(row["order_amount"].ToString()); } else { coupon_amount += copmo.amount; } } } } } } else { BLL.orders bll = new BLL.orders(); DataTable dt; if (this.outlet_id > 0) { dt = bll.GetOrderAmount(0, " status!=1 and status!=99 and store_id=" + this.outlet_id, " add_time desc,id desc").Tables[0]; } else { dt = bll.GetOrderAmount(0, " status!=1 and status!=99", " add_time desc,id desc").Tables[0]; } //DataTable dt = bll.GetOrderAmount(0, " status!=1 and status!=99 and datediff(dd,add_time,'" + datetime + "')=0", " add_time desc,id desc").Tables[0]; foreach (DataRow row in dt.Rows) { total_amount += decimal.Parse(row["order_amount"].ToString()); if (row["refund_status"].ToString() != "" && int.Parse(row["refund_status"].ToString()) == 3) { refund_amount += decimal.Parse(row["order_amount"].ToString()); } BLL.user_coupon_log couponbll = new BLL.user_coupon_log();//统计优惠券 if (row["str_code"].ToString() != "") { Model.user_coupon_log couponmodel = couponbll.GetModel(row["str_code"].ToString()); if (couponmodel != null && couponmodel.status == 2) { BLL.user_coupon copbl = new BLL.user_coupon(); Model.user_coupon copmo = copbl.GetModel(couponmodel.coupon_id); if (copmo != null) { if (copmo.amount > decimal.Parse(row["order_amount"].ToString())) { coupon_amount += decimal.Parse(row["order_amount"].ToString()); } else { coupon_amount += copmo.amount; } } } } } } }