/// <summary> /// 用于前后台|店铺筛选订单(支持快速搜索) /// </summary> public PageSetting SelPage(int cpage, int psize, out double total, int storeid, string orderType, string orderStatus, string payStatus) { string where = "1=1 "; if (storeid != -100) { where += " AND StoreID=" + storeid; } if (!string.IsNullOrEmpty(orderType)) { SafeSC.CheckIDSEx(orderType); where += " AND OrderType IN (" + orderType + ")"; } if (!string.IsNullOrEmpty(orderStatus)) { where += " AND OrderStatus=" + DataConvert.CLng(orderStatus); } if (!string.IsNullOrEmpty(payStatus)) { where += " AND Paymentstatus=" + DataConvert.CLng(payStatus); } PageSetting setting = PageSetting.Single(cpage, psize, TbName, PK, where, "", null); DBCenter.SelPage(setting); total = DataConvert.CDouble(DBCenter.ExecuteScala(TbName, "SUM(ordersamount)", where)); return(setting); }
/// <summary> ///获取前一或后一商品数据,用于前端和后端商品排序, ///0:下移(前一商品),1:上移(后一商品) /// </summary> public M_Product GetNearID(int NodeID, int CurrentID, int UporDown, int uid = 0) { string where = " 1=1 "; string order = ""; if (NodeID > 0) { where += " AND NodeID=" + NodeID; } if (uid > 0) { where += " AND UserID=" + uid; } if (UporDown == 0) { where += " AND OrderId<" + CurrentID; order = "OrderId DESC"; } else// if (UporDown == 1) { where += " AND OrderId>" + CurrentID; order = "OrderId ASC"; } int id = DataConvert.CLng(DBCenter.ExecuteScala(TbName, "ID", where, order)); return(GetproductByid(id)); }
public void Del(int sid) { int itemID = DataConvert.CLng(DBCenter.ExecuteScala(initMod.TbName, "ItemID", "GeneralID=" + sid)); DBCenter.Del(initMod.TbName, "GeneralID", sid); DBCenter.Del(initMod.STbName, "ID", itemID); }
//店铺销售汇总 public static double Sale_Total(Sale_Filter filter) { //查询该店铺订单的销售金额 List <SqlParameter> sp = new List <SqlParameter>(); string where = "OrderStatus=99 AND Receivablesamount>0 " + Sale_GetWhere(filter, sp); return(DataConvert.CDouble(DBCenter.ExecuteScala("ZL_Order_PayedView", "SUM(Receivablesamount)", where, "", sp))); }
public int Insert(M_Design_Question model) { if (model.OrderID == 0) { model.OrderID = DataConvert.CLng(DBCenter.ExecuteScala(TbName, "MAX(OrderID)", "AskID=" + model.AskID)) + 1; } return(DBCenter.Insert(model)); }
public int Insert(M_User_Level model) { if (model.OrderID < 1) { model.OrderID = DataConvert.CLng(DBCenter.ExecuteScala(TbName, "MAX(OrderID)", "")); model.OrderID++; } return(DBCenter.Insert(model)); }
//订单数,客单价,消费总额 public static Sale_Result Sale_Order_Count(Sale_Filter filter) { Sale_Result result = new Sale_Result(); List <SqlParameter> sp = new List <SqlParameter>(); string where = "1=1 " + Sale_GetWhere(filter, sp); result.count = DBCenter.Count("ZL_Order_PayedView", where, sp); result.sales = DataConvert.CDouble(DBCenter.ExecuteScala("ZL_Order_PayedView", "SUM(Receivablesamount)", where, "", sp)); return(result); }
/// <summary> /// 默认会员组ID /// </summary> /// <returns></returns> public int DefaultGroupID() { int gid = DataConvert.CLng(DBCenter.ExecuteScala(strTableName, "GroupID", "IsDefault=1")); if (gid < 1) { gid = DataConvert.CLng(DBCenter.ExecuteScala(strTableName, "GroupID", "", PK + " ASC")); } return(gid); }
/// <summary> /// 根据flow领取对应的优惠券 /// (暂不限定用户领取数量,但领取页面会筛除掉) /// </summary> public int U_GetArrive(int uid, string flow) { List <SqlParameter> sp = new List <SqlParameter>(); sp.Add(new SqlParameter("@flow", flow)); int arrid = DataConvert.CLng(DBCenter.ExecuteScala(TbName, "ID", "Flow=@flow AND UserID=0", "", sp)); DBCenter.UpdateSQL(TbName, "UserID=" + uid, "ID=" + arrid); return(arrid); }
private bool DelTableInfo(int id) { string tbname = DataConvert.CStr(DBCenter.ExecuteScala(strTableName, "PubTableName", "PubID=" + id)); if (string.IsNullOrEmpty(tbname)) { return(false); } DBHelper.Table_Del(tbname); return(true); }
private int GetTlpIDByProID(int proid) { int tlp = 0; M_Product proMod = proBll.GetproductByid(ProID); if (proMod == null) { function.WriteErrMsg("Goods do not exist_"); } tlp = DataConvert.CLng(DBCenter.ExecuteScala(proMod.TableName, "TlpID", "ID=" + proMod.ItemID)); return(tlp); }
public bool Move(int from, int target) { if (from == 0 || target == 0) { return(false); } int fromOrder = Convert.ToInt32(DBCenter.ExecuteScala(TbName, "OrderID", "ID=" + from)); int targetOrder = Convert.ToInt32(DBCenter.ExecuteScala(TbName, "OrderID", "ID=" + target)); DBCenter.UpdateSQL(TbName, "OrderID=" + targetOrder, "ID=" + from); DBCenter.UpdateSQL(TbName, "OrderID=" + fromOrder, "ID=" + target); return(true); }
public static M_WX_APPID WX_SelMyModel() { B_WX_APPID appBll = new B_WX_APPID(); M_UserInfo mu = new B_User().GetLogin(); int appid = DataConvert.CLng(DBCenter.ExecuteScala("ZL_CommonModel", "SpecialID", "GeneralID=" + mu.SiteID)); if (appid < 1) { return(null); } M_WX_APPID appMod = appBll.SelReturnModel(appid); return(appMod); }
/// <summary> /// 增加,移除ColledIDS中的该用户ID /// </summary> /// <action>1:增加,2移除</action> public bool UpdateColled(int uid, int id, int action) { string ids = DBCenter.ExecuteScala(TbName, "ColledIDS", "ID=" + id).ToString(); switch (action) { case 1: //增加 ids = StrHelper.AddToIDS(ids, uid.ToString()); break; case 2: //移除 ids = StrHelper.RemoveToIDS(ids, uid.ToString()); break; } return(DBCenter.UpdateSQL(TbName, "ColledIDS='" + ids + "'", "ID=" + id)); }
/// <summary> /// 校验当前登录用户的角色权限 /// </summary> /// <param name="name"></param> public static CommonReturn CheckUserAuth(string auth) { M_UserInfo mu = new B_User().GetLogin(); if (mu.SiteID < 1) { function.WriteErrMsg("禁止访问,用户未绑定店铺"); } //如果是店铺的所有者,则不需要检测 bool flag = DBCenter.IsExist("ZL_CommonModel", "GeneralID=" + mu.SiteID + " AND SuccessfulUserID=" + mu.UserID); if (flag) { return(CommonReturn.Success()); } //只有店长可访问该页面 if (auth.Equals("manage")) { function.WriteErrMsg("你没有足够的访问权限"); } //-----------------------检测角色权限 if (mu.PageID < 1) { function.WriteErrMsg("操作员未绑定角色"); } if (string.IsNullOrEmpty(auth)) { function.WriteErrMsg("未指定需要校验的权限"); } string auths = DataConvert.CStr(DBCenter.ExecuteScala("ZL_Ex_ERole", "RoleAuth", "ID=" + mu.PageID)); if (!auths.Contains(auth)) { function.WriteErrMsg("你无权访问该页面"); } return(CommonReturn.Success()); }
private void SYSProCheck(M_Product model) { if (string.IsNullOrEmpty(model.ShortProName)) { model.ShortProName = model.Proname.Substring(0, model.Proname.Length > 5 ? 5 : model.Proname.Length); } if (model.OrderID == 0) { model.OrderID = (DataConvert.CLng(DBCenter.ExecuteScala(TbName, "MAX(OrderID)", "1=1")) + 1); } if (model.Recommend < 1) { model.Recommend = 0; } if (string.IsNullOrEmpty(model.ProCode)) { model.ProCode = GetProCode(); } if (model.LinPrice < 0) { throw new Exception("商品的价格不能为负数"); } }
//支持名称或ID public static string SelTopCSS(string name) { if (string.IsNullOrEmpty(name)) { return(""); } string css = ""; string where = "(ZStatus IS NULL OR ZStatus=0) "; if (DataConvert.CLng(name) > 0) { css = DataConvert.CStr(DBCenter.ExecuteScala("ZL_Sys_CSSManage", "CSS", where + " AND id=" + Convert.ToInt32(name) + "")); } else { css = DataConvert.CStr(DBCenter.ExecuteScala("ZL_Sys_CSSManage", "CSS", where + " AND name=@name", "", new List <SqlParameter>() { new SqlParameter("name", name.Trim()) })); } return(css); }
//-------------Tools //需处理,多人同时添加问题,是否改为从内存中取 public static string GetProCode() { string regular = SiteConfig.ShopConfig.ItemRegular; string stime = DateTime.Now.ToString("yyyy/MM/dd 00:00"); string etime = DateTime.Now.ToString("yyyy/MM/dd 23:59:59"); string itemCode = DateTime.Now.ToString(regular); //"SELECT Count(ID) From ZL_Commodities WHERE AddTime BETWEEN '" + stime + "' AND '" + etime + "'" int count = Convert.ToInt32(DBCenter.ExecuteScala("ZL_Commodities", "Count(ID)", "AddTime BETWEEN '" + stime + "' AND '" + etime + "'")); count++; if (count < 10) { itemCode += "0000" + count; } else if (count >= 10) { itemCode += "000" + count; } else if (count >= 100) { itemCode += "00" + count; } else if (count >= 1000) { itemCode += "0" + count; } else if (count >= 10000) { itemCode += count; } else { itemCode += count; } return(itemCode); }
protected void RPT_ItemDataBound(object sender, RepeaterItemEventArgs e) { if (e.Item.ItemType == ListItemType.Item || e.Item.ItemType == ListItemType.AlternatingItem) { DataRowView dr = e.Item.DataItem as DataRowView; Label ptLabel = e.Item.FindControl("Present_HTML") as Label; try { string addition = DataConvert.CStr(dr["Additional"]); //M_Cart_Addition addMod = JsonConvert.DeserializeObject<M_Cart_Addition>(addition); JObject jobj = JsonConvert.DeserializeObject <JObject>(addition); string itemTlp = "<div style='color:#999;'>{0}:{1}</div>"; foreach (var item in jobj) { if (string.IsNullOrEmpty(item.Value.ToString())) { continue; } if (DataConvert.CLng(item.Value) < 1) { continue; } if (item.Key == "flash" || item.Key == "outdoor" || item.Key == "backing") { string value = DataConvert.CStr(DBCenter.ExecuteScala("ZL_Commodities", "Proname", "ID=" + DataConvert.CLng(item.Value))); ptLabel.Text += string.Format(itemTlp, item.Key, item.Value); } else { ptLabel.Text += string.Format(itemTlp, item.Key, item.Value); } } } catch (Exception) { } } }
public int GetMaxID() { return(DataConvert.CLng(DBCenter.ExecuteScala(TbName, "Max(FieldID)", ""))); }
//----------Tools private int MaxOrderID(int uid) { string where = "UserID=" + uid; return(DataConvert.CLng(DBCenter.ExecuteScala(TbName, "MAX(OrderID)", where)) + 1); }
//--------------------------------------------------------------Order /// <summary> /// 获取父类下最大MaxID /// </summary> private int Order_GetMax(int pid) { string where = "Pid=" + pid; return(DataConvert.CLng(DBCenter.ExecuteScala(TbName, "MAX(OrderID)", where)) + 1); }
private string GetBk(int id, string def = "black") { string bk = DataConvert.CStr(DBCenter.ExecuteScala("ZL_Logo_Design", "BackGround", "ID=" + id)); return(string.IsNullOrEmpty(bk) ? def : bk); }
/// <summary> /// 根据公司ID,获取该公司的网络管理员角色ID /// </summary> public static int SelSuperByCid(int cid) { return(DataConvert.CLng(DBCenter.ExecuteScala("ZL_Plat_UserRole", "ID", "CompID=" + cid + " And IsSuper=1"))); }
public string GetModelTemplate(int NodeID, int ModelID) { return(DBCenter.ExecuteScala("ZL_Node_ModelTemplate", "Template", "NodeID=" + NodeID + " and ModelID=" + ModelID).ToString()); }
private int dal_GetPreNode(int ParentID, int CurrentID) { return(DataConvert.CLng(DBCenter.ExecuteScala(TbName, "NodeID", "ParentID=" + ParentID + " and OrderID<" + CurrentID, defOrder))); }
public int GetMinOrder(int ParentID) { return(DataConvert.CLng(DBCenter.ExecuteScala(TbName, "MIN(OrderID)", "ParentID=" + ParentID))); }
public int GetPreID(int CurrentID) { return(DataConverter.CLng(DBCenter.ExecuteScala(TbName, "FieldID", "OrderId<" + CurrentID, "OrderId DESC"))); }
public int GetNextID(int CurrentID) { return(DataConverter.CLng(DataConvert.CLng(DBCenter.ExecuteScala("ZL_UserBaseField", "FieldID", "OrderId>" + CurrentID, "OrderId Asc")))); }
/// <summary> /// 获取父节点下的第一个节点的ID /// </summary> public int GetFirstNode(int ParentID) { return(DataConvert.CLng(DBCenter.ExecuteScala(TbName, "NodeID", "ParentID=" + ParentID + " AND NodeType=1", defOrder))); }