/// <summary> /// 查询昨日与今日销量 /// </summary> public static ReturnTableClass SelectIndexXiaoLiang() { int intTime1 = Convert.ToInt32(DateTime.Now.ToString("yyyyMMdd00")); //当日开始时间 int intTime2 = intTime1 + 24; //当日结束时间 int intTime3 = Convert.ToInt32(DateTime.Now.AddDays(-1).ToString("yyyyMMdd00")); //昨天的开始时间 int intTime4 = intTime3 + 24; //昨天的结束时间 ReturnTableClass err = new ReturnTableClass(); try { err.result = DBConnection.OrderInfo.SelectXiaoLiangByIntDate(intTime1, intTime2); err.result2 = DBConnection.OrderInfo.SelectXiaoLiangByIntDate(intTime3, intTime4); if (err.result != null || err.result2 != null) { err.Code = ErrorCode.SUSCCED; } else { err.Code = ErrorCode.FAIL; } } catch (Exception ex) { err.Code = ErrorCode.SystemError; DBConnection.LogHelper.insertLogError("SelectIndexXiaoLiang", ex.ToString(), DateTime.Now); } return(err); }
/// <summary> /// 查询销量 /// </summary> /// <param name="BgTime">开始时间</param> /// <param name="EndTime">结束时间</param> /// <param name="ShopID">店铺ID</param> public static ReturnTableClass SelectXiaoLiang(DateTime BgTime, DateTime EndTime, int ShopID) { ReturnTableClass err = new ReturnTableClass(); if (StaticInfo.hasNoZhuRu("ShopID")) { try { err.result = DBConnection.OrderInfo.SelectXiaoLiang(Convert.ToInt32(BgTime.ToString("yyyyMMdd00")), Convert.ToInt32(EndTime.ToString("yyyyMMdd24")), ShopID); if (err.result != null) { err.Code = ErrorCode.SUSCCED; } else { err.Code = ErrorCode.FAIL; } } catch (Exception ex) { DBConnection.LogHelper.insertLogError("SelectXiaoLiang", ex.ToString(), DateTime.Now); } } else { err.result = 0; err.Code = ErrorCode.ERR_ZHURU; err.Msg = "sql注入!"; } return(err); }
/// <summary> /// 查询送餐员绩效 /// </summary> /// <param name="intOrderTime">0上月 1本月</param> /// <param name="ShopID">店铺ID</param> public static ReturnTableClass SelectSongCanRen(int intOrderTime, int ShopID) { ReturnTableClass err = new ReturnTableClass(); int bgTime = 0; //开始时间 int endTime = 0; //结束时间 if (intOrderTime == 0) { bgTime = Convert.ToInt32(DateTime.Now.AddMonths(-1).ToString("yyyyMM0000")); endTime = Convert.ToInt32(DateTime.Now.ToString("yyyyMM0000")); } else if (intOrderTime == 1) { bgTime = Convert.ToInt32(DateTime.Now.ToString("yyyyMM0000")); endTime = Convert.ToInt32(DateTime.Now.AddMonths(1).ToString("yyyyMM0000")); } if (StaticInfo.hasNoZhuRu("ShopID")) { try { err.result = DBConnection.OrderData.SelectSongCanRen(bgTime, endTime, ShopID); if (err.result != null) { err.Code = ErrorCode.SUSCCED; } else { err.Code = ErrorCode.FAIL; } } catch (Exception ex) { DBConnection.LogHelper.insertLogError("SelectSongCanRen", ex.ToString(), DateTime.Now); } } else { err.result = 0; err.Code = ErrorCode.ERR_ZHURU; err.Msg = "sql注入!"; } return(err); }
/// <summary> /// 查询餐品列表分页 /// </summary> /// <param name="intPageIndex">页码,从0开始</param> /// <param name="intPageIndex">每页多少条数据</param> public static ReturnTableClass SelectFoodByPageIndex(int intPageIndex, int eachPageNum, int Category, string FoodName, int IsShow) { ReturnTableClass err = new ReturnTableClass(); try { string sqlWhere = ""; if (Category != -1) { sqlWhere += " and f.Category=" + Category; } if (FoodName != "-1") { sqlWhere += " and f.FoodName like '%" + FoodName + "%'"; } if (IsShow != -1) { sqlWhere += " and f.IsShow=" + IsShow; } err.result = DBConnection.FoodInfo.SelectTotalFoodInfoByPageIndex(intPageIndex, eachPageNum, sqlWhere, out err.RowCount); if (err.result != null) { err.Code = ErrorCode.SUSCCED; } else { err.Code = ErrorCode.FAIL; } } catch (Exception ex) { DBConnection.LogHelper.insertLogError("SelectFoodByPageIndex", ex.ToString(), DateTime.Now); } return(err); }
/// <summary> /// Order_查询当日所有订单分页 /// </summary> /// <param name="intPageIndex">第几页</param> /// <param name="eachPageNum">每页显示几条</param> /// <param name="intTime">哪个时间段的订餐 0:全天 1:早餐 2:午餐 3:晚餐</param> /// <param name="State">订单的状态 0:未结束 1:已结束</param> /// <param name="ShopID">店铺ID</param> public static ReturnTableClass SelectOrderByPageIndex(int intPageIndex, int eachPageNum, int intTime, int State, DateTime OrderTime, int ShopID, string Name) { ReturnTableClass err = new ReturnTableClass(); DataTable dtRow = null; string sqlWhere = "where 1=1 and d.ShopID=" + Convert.ToString(ShopID) + " "; int thisTime = Convert.ToInt32(OrderTime.ToString("yyyyMMdd00")); if (StaticInfo.hasNoZhuRu("aa")) { try { if (intTime == 0) { int Btime = Convert.ToInt32(OrderTime.ToString("yyyyMMdd00")); //开始的时间 2016082500 int Etime = Convert.ToInt32(OrderTime.AddDays(1).ToString("yyyyMMdd00")); //结束的时间 2016082600 sqlWhere += " and d.OrderTime between " + Btime + " and " + Etime + " "; } else if (intTime == 1) //早餐 { thisTime = thisTime + Convert.ToInt32(DBConnection.SystemConfig.SelectSystemConfig(1).Rows[0]["Value"]); //早晨6:00 sqlWhere += " and d.OrderTime =" + Convert.ToString(thisTime) + " "; } else if (intTime == 2) //午餐 { thisTime = thisTime + Convert.ToInt32(DBConnection.SystemConfig.SelectSystemConfig(2).Rows[0]["Value"]); //中午12:00 sqlWhere += " and d.OrderTime =" + Convert.ToString(thisTime) + " "; } else if (intTime == 3) //晚餐 { thisTime = thisTime + Convert.ToInt32(DBConnection.SystemConfig.SelectSystemConfig(3).Rows[0]["Value"]); //下午18:00 sqlWhere += " and d.OrderTime =" + Convert.ToString(thisTime) + " "; } if (State != -1) { sqlWhere += " and d.State=" + Convert.ToString(State) + " "; } if (Name != "-1") { sqlWhere += " and d.Name like '%" + Name + "%'"; } err.result = DBConnection.OrderData.SelectTotalOrderDataByPageIndex(intPageIndex, eachPageNum, sqlWhere, out dtRow); err.RowCount = dtRow; if (err.result != null) { err.Code = ErrorCode.SUSCCED; } else { err.Code = ErrorCode.FAIL; } } catch (Exception ex) { DBConnection.LogHelper.insertLogError("SelectOrderInfo", ex.ToString(), DateTime.Now); } } else { err.result = 0; err.Code = ErrorCode.ERR_ZHURU; err.Msg = "sql注入!"; } return(err); }