/// <summary> /// 获取管理员列表 /// </summary> /// <param name="model">The model.</param> /// <returns>ResultPageModel.</returns> /// <exception cref="System.NotImplementedException"></exception> public ResultPageModel GetManagerList(SearchModel model) { ResultPageModel result = new ResultPageModel(); if (model == null) { return(result); } string strSql = SELECT_SQL; if (!string.IsNullOrEmpty(model.key)) { strSql += string.Format(" and LoginName like '%{0}%' ", model.key); } if (!string.IsNullOrEmpty(model.startTime)) { strSql += " and CONVERT(nvarchar(10),CreateTime,121)>=@startTime "; } if (!string.IsNullOrEmpty(model.endTime)) { strSql += " and CONVERT(nvarchar(10),CreateTime,121)<=@endTime "; } var param = new[] { new SqlParameter("@startTime", model.startTime), new SqlParameter("@endTime", model.endTime) }; return(getPageData <AdminLoginModel>(model.PageSize, model.PageIndex, strSql, "CreateTime", false, param)); }
/// <summary> /// 获取分页数据集合 /// </summary> /// <typeparam name="T"></typeparam> ///<param name="PageSize"></param> ///<param name="PageIndex"></param> /// <param name="strSql"></param> ///<param name="orderbyField">排序字段</param> /// <param name="commandParameters"></param> /// <param name="callback">回调处理函数</param> /// <returns></returns> public ResultPageModel getPageData <T>(int PageSize, int PageIndex, string strSql, string orderbyField, SqlParameter[] commandParameters, Action <List <T> > callback, bool orderby = false) where T : new() { string querySql = DbHelperSQLP.buildPageSql(PageIndex, PageSize, strSql, orderbyField, orderby); string recordCountSql = DbHelperSQLP.buildRecordCountSql(strSql); ResultPageModel result = new ResultPageModel(); int recordCount = Convert.ToInt32(DbHelperSQLP.ExecuteScalar(WebConfig.getConnectionString(), CommandType.Text, recordCountSql, commandParameters)); List <T> lst = new List <T>(); using (SqlDataReader dr = DbHelperSQLP.ExecuteReader(WebConfig.getConnectionString(), CommandType.Text, querySql, commandParameters)) { lst = DbHelperSQLP.GetEntityList <T>(dr); callback?.Invoke(lst); } int pageCount = recordCount / PageSize; if (recordCount % PageSize != 0) { ++pageCount; } result.PageIndex = PageIndex; result.PageSize = PageSize; result.Total = recordCount; result.PageCount = pageCount; result.Rows = lst; return(result); }
public static decimal Calculate(UserAnswer answer, string path) { int count = 0; decimal mark = 0; var correctAnswer = answer.CorrectAnswer.Replace("\r", "").Replace("\n", ""); var userAnswer = answer.UAnswer; string[] correctString = correctAnswer.Split('.'); string[] userString = userAnswer.Split('.'); // var ResultPageInfo = new ResultPageModel(); List <int> wrongStr = new List <int>(); List <string> wrongAns = new List <string>(); List <string> trueAns = new List <string>(); // calculate mark var i = 0; for (i = 0; i < correctString.Length; i++) { if (userString[i] == correctString[i]) { count++; } else // save user wrong choices for display in result page { wrongStr.Add(i + 1); string t = correctString[i].Remove(0, correctString[i].Length - 1); // remove first char (1A -> A) string w = userString[i].Remove(0, userString[i].Length - 1);; wrongAns.Add(w); trueAns.Add(t); } System.Diagnostics.Debug.WriteLine(userString[i] + "--->" + correctString[i]); } ResultPageInfo.ExamObj = answer.Object; ResultPageInfo.WrongNumber = wrongStr.ToArray(); ResultPageInfo.TrueAns = trueAns.ToArray(); ResultPageInfo.WrongAns = wrongAns.ToArray(); // call create result page action CreateResultFile.Action(ResultPageInfo, path); mark = (decimal)count * 10 / correctString.Length; //end calculate // test System.Diagnostics.Debug.WriteLine("------Begin------"); System.Diagnostics.Debug.WriteLine("correctAnswer: " + correctAnswer); System.Diagnostics.Debug.WriteLine("userAnswer: " + userAnswer); System.Diagnostics.Debug.WriteLine("mark: " + mark); System.Diagnostics.Debug.WriteLine("------End------"); // end test return(mark); }
/// <summary> /// 获取门店列表 /// </summary> /// <param name="ShopType">门店类型1 总店 0分店</param> /// <param name="ShopBelongId">门店所属总店ID,门店类型为总店时,此值0</param> /// <param name="model"></param> /// <returns></returns> public ResultPageModel GetShopList(int ShopType, int ShopBelongId, SearchModel model) { ResultPageModel result = new ResultPageModel(); if (model == null) { return(result); } string strSql = @"select ShopID,ShopName,ShopType,ShopBelongId,ShopProv,ShopCity,ShopArea,ShopAddress,Contacts,ContactWay,LoginName,LoginPassword,IsActive,CreateTime from BM_ShopManage where 1=1 and IsDel<>1 "; strSql += " and ShopType=@ShopType"; if (ShopType == 0) { strSql += " and ShopBelongId=@ShopBelongId"; } if (!string.IsNullOrEmpty(model.key)) { strSql += string.Format(" and ShopName like '%{0}%' ", model.key); } if (!string.IsNullOrEmpty(model.province)) { strSql += " and ShopProv=@ShopProv"; } if (!string.IsNullOrEmpty(model.city)) { strSql += " and ShopCity=@ShopCity"; } if (!string.IsNullOrEmpty(model.startTime)) { strSql += " and CONVERT(nvarchar(10),CreateTime,121)>=@startTime "; } if (!string.IsNullOrEmpty(model.endTime)) { strSql += " and CONVERT(nvarchar(10),CreateTime,121)<=@endTime "; } var param = new[] { new SqlParameter("@ShopType", ShopType), new SqlParameter("@ShopBelongId", ShopBelongId), new SqlParameter("@ShopProv", model.province), new SqlParameter("@ShopCity", model.city), new SqlParameter("@startTime", model.startTime), new SqlParameter("@endTime", model.endTime), }; //生成sql语句 return(getPageData <ShopModel>(model.PageSize, model.PageIndex, strSql, "CreateTime", false, param)); }
public ActionResult ResultPage(ResultPageModel model) { if (string.IsNullOrEmpty(model.queue_no)) { return(View("Main")); } else { ViewBag.QueueNo = model.queue_no; return(View(model)); } }
public ActionResult list(int identity, int pageIndex, int pageSize) { ResultPageModel data = ArticleLogic.GetAppArticleList(identity, pageIndex, pageSize, GetAuthUserId()); Dictionary <string, object> dict = new Dictionary <string, object>(); dict["list"] = data; if (pageIndex == 1 && (identity == 0 || identity == 1 || identity == 2)) { dict["top"] = ArticleLogic.GetAppTopArticleList(identity); } return(Json(new ResultModel(ApiStatusCode.OK, dict))); }
/// <summary> /// 获取资讯列表--APP /// </summary> /// <param name="AuthorIdentity">作者身份类型,0集团,1总店,2分店 3盟主 4盟友</param> /// <param name="pageindex">The pageindex.</param> /// <param name="pageSize">Size of the page.</param> /// <param name="userId">The user identifier.</param> /// <param name="shopId">The shop identifier.</param> /// <param name="userIdentity">用户身份,1盟主.0盟友</param> /// <returns>ResultPageModel.</returns> public ResultPageModel GetAppArticleList(int AuthorIdentity, int pageindex, int pageSize, int userId, int shopId, int userIdentity) { ResultPageModel result = new ResultPageModel(); string strSql = @"select A.ArticleId,a.ArticleTitle,a.ArticleIntro,a.ArticleCover,a.BrowseAmount,a.PublishTime {1} from BM_ArticleList A with(nolock) {0} where a.IsDel=0 and a.EnableTop=0 and a.EnablePublish=1 and A.ArticleStatus=1"; string whereSql = string.Empty, wherefield = string.Empty; string orderbyField = "A.PublishTime"; if (AuthorIdentity == 3 || AuthorIdentity == 4) { wherefield = ",ISNULL(R.IsRead,0) as IsRead"; whereSql = " left join BM_ReadLog R with(nolock) on R.ArticleId=A.ArticleId "; strSql += " and R.UserId=@UserId "; } else { strSql += " and (A.SendTargetId=0 or A.SendTargetId=@SendTargetId) "; if (shopId > 0) { strSql += " and A.AuthorId=@AuthorId"; } } strSql += " and A.AuthorIdentity=@AuthorIdentity"; strSql = string.Format(strSql, whereSql, wherefield); var param = new[] { new SqlParameter("@AuthorIdentity", AuthorIdentity), new SqlParameter("@UserId", userId), new SqlParameter("@SendTargetId", userIdentity == 1?1:2), new SqlParameter("@AuthorId", shopId), }; //生成sql语句 return(getPageData <ArticleBaseModel>(pageSize, pageindex, strSql, orderbyField, param, (items) => { items.ForEach((item) => { item.ArticleUrl = string.Format("{0}/app/details.html?articleId={1}&idt={2}", WebConfig.articleDetailsDomain(), item.ArticleId, AuthorIdentity); item.ArticleCover = WebConfig.reswebsite() + item.ArticleCover; item.PublishTimeText = StringHelper.GetConvertFriendlyTime(item.PublishTime.ToString(), 7); }); })); }
/// <summary> /// 获取他的客户列表 /// </summary> /// <param name="model"></param> /// <param name="isvalid">客户是否有效</param> /// <returns></returns> public ResultPageModel GetCustomerList(SearchModel model, bool isvalid = true) { ResultPageModel result = new ResultPageModel(); string strSql = APP_SELECT; if (isvalid) { strSql += " and C.Status= 1"; } else { strSql += " and C.Status<>1"; } if (model.UserId > 0) { strSql += " and C.BelongTwo= @BelongOne"; } if (!string.IsNullOrEmpty(model.key)) { switch (model.searchType) { case (int)SearchType.姓名: strSql += string.Format(" and C.Name like '%{0}%' ", model.key); break; case (int)SearchType.手机: strSql += " and C.Mobile=@Mobile"; break; default: break; } } var param = new[] { new SqlParameter("@BelongOne", model.UserId), new SqlParameter("@Mobile", model.key) }; //生成sql语句 return(getPageData <CustomerModel>(model.PageSize, model.PageIndex, strSql, "C.CreateTime", false, param)); }
public ActionResult list(int identity, int pageIndex, int pageSize) { try { pageIndex = pageIndex > 0 ? pageIndex : 1; var userInfo = GetUserData(); //当前用户所属门店ID int shopId = userInfo.ShopId; //如果当前用户所属分店,且当前其他类型为总店,那么shopid=当前用户门店所属的总店ID if (userInfo.ShopType == 2 && identity == 1) { shopId = userInfo.ShopBelongId; } if (identity == 0) { shopId = 0; } ResultPageModel data = null;// ArticleLogic.GetAppArticleList(identity, pageIndex, pageSize, userInfo.UserId, shopId, userInfo.UserIdentity); if (identity != 3 && identity != 4) { data = ArticleLogic.GetAppArticleList(identity, pageIndex, pageSize, userInfo.UserId, shopId, userInfo.UserIdentity); } else { data = ArticleLogic.GetAppMailList(1, pageIndex, pageSize, userInfo.UserId, true, true); } Dictionary <string, object> dict = new Dictionary <string, object>(); dict["list"] = data; if (pageIndex == 1 && (identity == 0 || identity == 1 || identity == 2)) { dict["top"] = ArticleLogic.GetAppTopArticleList(identity, userInfo.UserIdentity, shopId); } return(Json(new ResultModel(ApiStatusCode.OK, dict))); } catch (Exception ex) { LogHelper.Log(string.Format("list:message:{0},StackTrace:{1}", ex.Message, ex.StackTrace), LogHelperTag.ERROR); return(Json(new ResultModel(ApiStatusCode.SERVICEERROR))); } }
/// <summary> /// 获取现金券领取记录列表 /// </summary> /// <param name="couponId">The coupon identifier.</param> /// <param name="model">The model.</param> /// <returns>ResultPageModel.</returns> public ResultPageModel GetUserCashCouponLogList(int couponId, SearchModel model) { ResultPageModel result = new ResultPageModel(); if (model == null) { return(result); } string strSql = "select L.ID,L.UserId,L.CouponNo,L.CouponId,L.Name,L.Mobile,L.IsGet,L.GetTime,L.IsUse,L.UseTime,L.CreateTime,StartTime,EndTime,L.BelongOneUserId,L.BelongOneShopId from BM_GetCashCouponLog L with(nolock) where IsDel=0 and IsGet=1 and CouponId=@CouponId"; if (model.Status != -1) { strSql += " and IsUse=@IsUse "; } if (!string.IsNullOrEmpty(model.key)) { strSql += " and Mobile=@Mobile "; } if (!string.IsNullOrEmpty(model.startTime)) { strSql += " and CONVERT(nvarchar(10),GetTime,121)>=@startTime "; } if (!string.IsNullOrEmpty(model.endTime)) { strSql += " and CONVERT(nvarchar(10),GetTime,121)<=@endTime "; } var param = new[] { new SqlParameter("@startTime", model.startTime), new SqlParameter("@endTime", model.endTime), new SqlParameter("@CouponId", couponId), new SqlParameter("@IsUse", model.Status), new SqlParameter("@Mobile", model.key) }; //生成sql语句 return(getPageData <CashCouponLogModel>(model.PageSize, model.PageIndex, strSql, "GetTime", param, (items => { items.ForEach(item => { item.time = item.StartTime.ToString("yyyy.MM.dd") + " 至 " + item.EndTime.ToString("yyyy.MM.dd"); }); }))); }
public ActionResult maillist(int pageIndex, int pageSize, int type, int isSend = 1) { try { pageIndex = pageIndex > 0 ? pageIndex : 1; var userInfo = GetUserData(); ResultPageModel data = null; bool isPush = isSend == 1; data = ArticleLogic.GetAppMailList(type, pageIndex, pageSize, userInfo.UserId, isPush); return(Json(new ResultModel(ApiStatusCode.OK, data))); } catch (Exception ex) { LogHelper.Log(string.Format("list:message:{0},StackTrace:{1}", ex.Message, ex.StackTrace), LogHelperTag.ERROR); return(Json(new ResultModel(ApiStatusCode.SERVICEERROR))); } }
/// <summary> /// 获取分页数据集合 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="PageSize"></param> /// <param name="PageIndex"></param> /// <param name="strSql"></param> /// <param name="orderbyField">排序字段</param> /// <param name="callback"></param> /// <returns></returns> public ResultPageModel getPageData <T>(int PageSize, int PageIndex, string strSql, string orderbyField, Action <List <T> > callback, bool orderby = false) where T : new() { PageSize = PageSize > 0 ? PageSize : 20; string querySql = string.Empty; var fields = orderbyField.Split(','); if (fields.Length > 1) { querySql = DbHelperSQLP.buildPageOrderBySql(PageIndex, PageSize, strSql, orderbyField); } else { querySql = DbHelperSQLP.buildPageSql(PageIndex, PageSize, strSql, orderbyField, orderby); } string recordCountSql = DbHelperSQLP.buildRecordCountSql(strSql); ResultPageModel result = new ResultPageModel(); int recordCount = Convert.ToInt32(DbHelperSQLP.ExecuteScalar(WebConfig.getConnectionString(), CommandType.Text, recordCountSql)); List <T> lst = new List <T>(); using (SqlDataReader dr = DbHelperSQLP.ExecuteReader(WebConfig.getConnectionString(), CommandType.Text, querySql)) { lst = DbHelperSQLP.GetEntityList <T>(dr); callback?.Invoke(lst); //callback.Invoke(lst); } int pageCount = recordCount / PageSize; if (recordCount % PageSize != 0) { ++pageCount; } result.PageIndex = PageIndex; result.PageSize = PageSize; result.Total = recordCount; result.PageCount = pageCount; result.Rows = lst; return(result); }
/// <summary> /// 获取焦点广告图列表 /// </summary> /// <param name="model">The model.</param> /// <returns>ResultPageModel.</returns> /// <exception cref="System.NotImplementedException"></exception> public ResultPageModel GetList(SearchModel model) { ResultPageModel result = new ResultPageModel(); string strSql = APP_SELECT; //0 资讯轮播图 1首页轮播图 if (model.type == 0) { strSql += " and Type=0 "; } else { strSql += " and Type=2 "; } if (!string.IsNullOrEmpty(model.key)) { strSql += string.Format(" and Title like '%{0}%' ", model.key); } return(getPageData <FocusPicModel>(model.PageSize, model.PageIndex, strSql, "Sort")); }
/// <summary> /// 获取他的盟友列表 /// </summary> /// <param name="model"></param> /// <returns></returns> public ResultPageModel GetAllyList(SearchModel model) { ResultPageModel result = new ResultPageModel(); string strSql = APP_USER_SELECT; strSql += " and ue.UserIdentity=0 and U.UB_BelongOne=@UB_BelongOne"; var param = new[] { new SqlParameter("@UB_BelongOne", model.UserId), }; //生成sql语句 return(getPageData <UserModel>(model.PageSize, model.PageIndex, strSql, "ue.CreateTime", param, (items) => { //TODO:暂时写死 items.ForEach((item) => { item.CustomerAmount = 100; item.OrderSuccessAmount = 10; }); })); }
/// <summary> /// 获取资讯列表--APP /// </summary> /// <param name="AuthorIdentity">作者身份类型,0集团,1总店,2分店 3盟主 4盟友</param> /// <param name="pageindex">The pageindex.</param> /// <param name="pageSize">Size of the page.</param> /// <param name="userId">The user identifier.</param> /// <returns>ResultPageModel.</returns> public ResultPageModel GetAppArticleList(int AuthorIdentity, int pageindex, int pageSize, int userId) { ResultPageModel result = new ResultPageModel(); string strSql = @"select A.ArticleId,a.ArticleTitle,a.ArticleIntro,a.ArticleCover,a.BrowseAmount,a.PublishTime {1} from BM_ArticleList A with(nolock) {0} where a.IsDel=0 and a.EnableTop=0 and A.ArticleStatus=1"; string whereSql = string.Empty, wherefield = string.Empty; if (AuthorIdentity == 3) { //TODO: strSql += " and A.SendTargetId=@SendTargetId"; } else if (AuthorIdentity == 4) { wherefield = ",ISNULL(R.IsRead,0) as IsRead"; whereSql = " left join BM_ReadLog R with(nolock) on R.ArticleId=A.ArticleId and R.UserId=@SendTargetId "; } strSql += " and A.AuthorIdentity=@AuthorIdentity"; strSql = string.Format(strSql, whereSql, wherefield); var param = new[] { new SqlParameter("@AuthorIdentity", AuthorIdentity), new SqlParameter("@SendTargetId", userId), }; //生成sql语句 return(getPageData <ArticleBaseModel>(pageSize, pageindex, strSql, "A.ArticleSort", param, (items) => { items.ForEach((item) => { item.ArticleUrl = string.Format("{0}/article/details.html?articleId={1}&idt={2}", WebConfig.articleDetailsDomain(), item.ArticleId, AuthorIdentity); item.ArticleCover = WebConfig.reswebsite() + item.ArticleCover; }); })); }
/// <summary> /// 获取订单列表 /// </summary> /// <param name="shopId">门店ID</param> /// <param name="shopType">门店类型1 总店 0分店</param> /// <param name="model">The model.</param> /// <returns>ResultPageModel.</returns> public ResultPageModel GetOrderList(int shopId, int shopType, SearchModel model) { ResultPageModel result = new ResultPageModel(); if (model == null) { return(result); } string strSql = string.Empty; if (shopType == 0)//如果是分店情况下,查询 { strSql = @"select O.*,S.ShopName from BM_Orders O left join BM_ShopManage S on S.ShopID=O.ShopId where 1=1 "; strSql += " and O.ShopId=@ShopId"; } else { strSql = @"select O.*,S.ShopName from BM_Orders O left join BM_ShopManage S on S.ShopID=O.ShopId where 1=1 "; strSql += " and (O.ShopId=@ShopId or O.BelongOneShopId=@ShopId) "; } if (!string.IsNullOrEmpty(model.key)) { strSql += string.Format(" and O.Ct_Name like '%{0}%' ", model.key); } if (model.type != -1) { strSql += " and OrderStatus=@OrderStatus"; } if (!string.IsNullOrEmpty(model.startTime)) { strSql += " and CONVERT(nvarchar(10),O.CreateTime,121)>=CONVERT(nvarchar(10),@startTime,121) "; } if (!string.IsNullOrEmpty(model.endTime)) { strSql += " and CONVERT(nvarchar(10),O.CreateTime,121)<=CONVERT(nvarchar(10),@endTime,121) "; } var param = new[] { new SqlParameter("@ShopId", shopId), new SqlParameter("@OrderStatus", model.type), new SqlParameter("@startTime", model.startTime), new SqlParameter("@endTime", model.endTime) }; //生成sql语句 return(getPageData <OrderModel>(model.PageSize, model.PageIndex, strSql, "O.CreateTime", param, (items => { items.ForEach(item => { if (item.OrderStatus == 0) { item.OrderStatusName = "未成交"; } else if (item.OrderStatus == 1) { item.OrderStatusName = "已成交"; } else { item.OrderStatusName = "已退单"; } }); }))); }
public static void Action(ResultPageModel model, string path) { var userInfo = SessionHelper.GetInfo(); string Sourcepath = path + "/" + model.ExamObj + ".cshtml"; string ResultPath = path.Replace("Views", "Views\\Result"); string SavePath = ResultPath + "\\" + userInfo.ID + "_" + model.ExamObj + ".cshtml"; string CopyContent = File.ReadAllText(Sourcepath); // init file string beginFile = "@{\nLayout = \"~/Views/Shared/_ResultLayout.cshtml\";\n} \n" + "@model MvcWEB.Models.ShowResultModel \n" + "<div class=\"info\">" + "<h1>" + userInfo.UserName + "</h1>\n" + "<h3>Điểm: </h3> \n" + "<h2>@Model.mark</h2>" + "<h3>Xếp loại: </h3> \n" + "<h2>@Model.quality</h2>" + "</div>\n" + "<div class=\"wrongAns\">\n" + "<h1>Các câu trả lời sai:</h1>\n"; string finalStr = beginFile; try { if (File.Exists(SavePath)) { File.Delete(SavePath); } // check result folder exist if (Directory.Exists(ResultPath)) { //File.Delete(SavePath); } else { Directory.CreateDirectory(ResultPath); } //end check using (FileStream fs = File.Create(SavePath)) { } using (StreamWriter file = new StreamWriter(SavePath, false, Encoding.UTF8)) { string[] seperate = CopyContent.Split(new string[] { "<div class=\"question\">" }, StringSplitOptions.None); //the number of array is from 0-100 (0 is the content before the first <div>, the needed contents is from 1 to 100) var i = 1; int[] wrong = model.WrongNumber; string[] dapan = model.TrueAns; string[] user_choose = model.WrongAns; int falseNumber = wrong.Length; for (i = 0; i < falseNumber; i++) { // get the wrong answer number var j = wrong[i]; string oldStr = "<div id=\"DapAn" + j + "\">"; string trueAns = oldStr + "<h2 class='false'><span>Chọn: " + user_choose[i] + ", </span>" + "<b> Đáp án : " + dapan[i] + "</b></h2>"; string oldClass = "checkBox"; string newClass = "checkBox invisible"; seperate[j] = seperate[j].Replace(oldStr, trueAns); seperate[j] = seperate[j].Replace(oldClass, newClass); finalStr += ("<div class=\"question\">" + seperate[j]); } finalStr += "</div>"; file.WriteLine(finalStr); } } catch (Exception ex) { Console.WriteLine(ex.ToString()); //Console.ReadKey(); } }
/// <summary> /// 获取用户列表 /// </summary> /// <param name="ShopId"></param> /// <param name="UserIdentity"></param> /// <param name="model"></param> /// <returns></returns> public ResultPageModel GetUserList(int ShopId, int UserIdentity, SearchModel model) { ResultPageModel result = new ResultPageModel(); if (model == null) { return(result); } string strSql = APP_USER_SELECT; if (!string.IsNullOrEmpty(model.key)) { switch (model.searchType) { case (int)SearchType.姓名: strSql += string.Format(" and U.UB_UserRealName like '%{0}%' ", model.key); break; case (int)SearchType.昵称: strSql += string.Format(" and U.UB_UserNickName like '%{0}%' ", model.key); break; case (int)SearchType.手机: strSql += " and U.UB_UserMobile=@UserMobile "; break; case (int)SearchType.门店: strSql += string.Format(" and S.ShopName like '%{0}%' ", model.key); break; default: break; } } strSql += " and ue.UserIdentity=@UserIdentity "; if (ShopId > 0) { strSql += " and ue.ShopId=@ShopId "; } if (!string.IsNullOrEmpty(model.startTime)) { strSql += " and CONVERT(nvarchar(10),ue.CreateTime,121)>=@startTime "; } if (!string.IsNullOrEmpty(model.endTime)) { strSql += " and CONVERT(nvarchar(10),ue.CreateTime,121)<=@endTime "; } var param = new[] { new SqlParameter("@startTime", model.startTime), new SqlParameter("@endTime", model.endTime), new SqlParameter("@UserMobile", model.key), new SqlParameter("@UserIdentity", UserIdentity), new SqlParameter("@ShopId", ShopId) }; //生成sql语句 return(getPageData <UserModel>(model.PageSize, model.PageIndex, strSql, "ue.CreateTime", param, (items) => { //TODO:暂时写死 items.ForEach((item) => { item.CustomerAmount = 100; item.OrderSuccessAmount = 10; }); })); }
/// <summary> /// 获取现金券列表 /// </summary> /// <param name="shopId">门店ID</param> /// <param name="model">The model.</param> /// <returns>ResultPageModel.</returns> /// <exception cref="System.NotImplementedException"></exception> public ResultPageModel GetCashCouponList(int shopId, SearchModel model) { ResultPageModel result = new ResultPageModel(); if (model == null) { return(result); } string strSql = SELECT_SQL; if (!string.IsNullOrEmpty(model.key)) { strSql += string.Format(" and Title like '%{0}%' ", model.key); } strSql += " and ShopId=@ShopId "; if (model.Status != -100) { strSql += " and IsEnable=@IsEnable"; } if (!string.IsNullOrEmpty(model.startTime)) { strSql += " and CONVERT(nvarchar(10),CreateTime,121)>=@startTime "; } if (!string.IsNullOrEmpty(model.endTime)) { strSql += " and CONVERT(nvarchar(10),CreateTime,121)<=@endTime "; } var param = new[] { new SqlParameter("@startTime", model.startTime), new SqlParameter("@endTime", model.endTime), new SqlParameter("@ShopId", shopId), new SqlParameter("@IsEnable", model.Status) }; //生成sql语句 return(getPageData <CashCouponModel>(model.PageSize, model.PageIndex, strSql, "CreateTime", param, ((items) => { items.ForEach((item) => { if (DateTime.Compare(item.EndTime.AddHours(24), DateTime.Now) >= 0) { if (item.IsEnable == 1) { item.StatusName = "启用"; } else { item.StatusName = "未启用"; } } else { item.StatusName = "已过期"; } item.time = item.StartTime.ToString("yyyy.MM.dd") + " 至 " + item.EndTime.ToString("yyyy.MM.dd"); }); }))); }
/// <summary> /// 获取消息列表 /// </summary> /// <param name="shopId">门店ID 0总后台,</param> /// <param name="AuthorIdentity">作者身份 0总后台,1总店,2分店</param> /// <param name="model">The model.</param> /// <returns>ResultPageModel.</returns> /// <exception cref="NotImplementedException"></exception> public ResultPageModel GetMessageList(int shopId, int AuthorIdentity, SearchModel model) { ResultPageModel result = new ResultPageModel(); if (model == null) { return(result); } string strSql = string.Empty; if (model.type == 1) { strSql = SELECT_SQL + " and AuthorIdentity=@AuthorIdentity"; if (!string.IsNullOrEmpty(model.key)) { strSql += string.Format(" and Title like '%{0}%' ", model.key); } if (!string.IsNullOrEmpty(model.startTime)) { strSql += " and CONVERT(nvarchar(10),CreateTime,121)>=@startTime "; } if (!string.IsNullOrEmpty(model.endTime)) { strSql += " and CONVERT(nvarchar(10),CreateTime,121)<=@endTime "; } if (AuthorIdentity != 0) { strSql += " and AuthorId=@AuthorId"; } var param = new[] { new SqlParameter("@startTime", model.startTime), new SqlParameter("@endTime", model.endTime), new SqlParameter("@AuthorIdentity", AuthorIdentity), new SqlParameter("@AuthorId", shopId) }; //生成sql语句 return(getPageData <MessageModel>(model.PageSize, model.PageIndex, strSql, "CreateTime", param, ((items) => { items.ForEach((item) => { if (item.AuthorIdentity == 2) { item.SendTargetName = GetMessageShopName(item.AuthorId); } else { if (!string.IsNullOrEmpty(item.SendTargetIds)) { item.SendTargetName = GetMessageShopName(item.SendTargetIds); if (item.IsSendBelongShopId == 1) { item.SendTargetName += " /总站"; } } else { item.SendTargetName += "总站"; } } }); }))); } else { if (AuthorIdentity != 0) { strSql = @"select M.ID,M.Title,M.AuthorName,M.SendTargetIds,M.MessageBody,M.IsSend,T.IsRead,M.CreateTime from BM_MessageManage M inner join BM_MessageSendTarget T on T.MessageId = M.ID where M.IsDel = 0 and M.IsSend=1 and T.SendTargetShopId=@ShopId "; } else { strSql = @"select M.ID,M.Title,M.AuthorName,M.SendTargetIds,M.MessageBody,M.IsSend,M.IsRead,M.CreateTime from BM_MessageManage M where M.IsDel = 0 and M.IsSend=1 and M.IsSendBelongShopId=1 "; } if (!string.IsNullOrEmpty(model.startTime)) { strSql += " and CONVERT(nvarchar(10),M.CreateTime,121)>=@startTime "; } if (!string.IsNullOrEmpty(model.endTime)) { strSql += " and CONVERT(nvarchar(10),M.CreateTime,121)<=@endTime "; } var param = new[] { new SqlParameter("@startTime", model.startTime), new SqlParameter("@endTime", model.endTime), new SqlParameter("@ShopId", shopId) }; //生成sql语句 return(getPageData <MessageModel>(model.PageSize, model.PageIndex, strSql, "M.CreateTime", param, ((items) => { items.ForEach((item) => { item.SendTargetName = item.AuthorName; }); }))); } }
public ActionResult ResultPage(ResultPageModel model) { return(View("Main")); }
public ResultPageViewModel() { ResultPage = new ResultPageModel(); CalculateResult(); }
/// <summary> /// 获取资讯列表 /// </summary> /// <param name="AuthorId"></param> /// <param name="AuthorIdentity">作者身份类型,0集团,1总店,2分店 3盟主 4盟友</param> /// <param name="model"></param> /// <returns></returns> public ResultPageModel GetArticleList(int AuthorId, int AuthorIdentity, SearchModel model) { ResultPageModel result = new ResultPageModel(); if (model == null) { return(result); } string strSql = APP_SELECT; if (!string.IsNullOrEmpty(model.key)) { switch (model.searchType) { case (int)SearchType.标题: strSql += string.Format(" and A.ArticleTitle like '%{0}%' ", model.key); break; default: break; } } if (model.Status != -100) { /* 总后台下 * 资讯列表只获取总后台发布的资讯 * Status=1标题当前在资讯列表,否则在审核列表 * 审核列表的数据,一般只有总店和分店提交的资讯数据,没有总店添加的资讯数据 * 门店后台下 * 资讯列表只获取当前门店发布的资讯,包含审核通过、申请中、审核失败的资讯 * */ //AuthorIdentity 0集团,1总店,2分店 3盟主 4盟友 if (model.Status == 1) { //如果不是总后台身份 if (AuthorIdentity != 0) { strSql += " and A.AuthorIdentity=@AuthorIdentity and A.AuthorId=@AuthorId "; } else { strSql += " and A.ArticleStatus=1 and A.AuthorIdentity=0 "; } } else if (model.Status == 0) { //这里只有总后台才有入口进来 if (AuthorIdentity == 0) { //TODO:过滤总后台发布的资讯数据,只获取总店和分店的数据 strSql += " and A.AuthorIdentity in (1,2) "; } else { strSql += " and A.AuthorIdentity=@AuthorIdentity and A.AuthorId=@AuthorId "; } } } if (!string.IsNullOrEmpty(model.startTime)) { strSql += " and CONVERT(nvarchar(10),A.CreateTime,121)>=CONVERT(nvarchar(10),@startTime,121) "; } if (!string.IsNullOrEmpty(model.endTime)) { strSql += " and CONVERT(nvarchar(10),A.CreateTime,121)<=CONVERT(nvarchar(10),@endTime,121) "; } var param = new[] { new SqlParameter("@startTime", model.startTime), new SqlParameter("@endTime", model.endTime), new SqlParameter("@AuthorIdentity", AuthorIdentity), new SqlParameter("@AuthorId", AuthorId) }; //生成sql语句 return(getPageData <ArticleModel>(model.PageSize, model.PageIndex, strSql, "A.CreateTime", false, param)); }
/// <summary> /// 获取门店列表 /// </summary> /// <param name="ShopType">门店类型1 总店 0分店</param> /// <param name="ShopBelongId">门店所属总店ID,门店类型为总店时,此值0</param> /// <param name="model"></param> /// <returns></returns> public ResultPageModel GetShopList(int ShopType, int ShopBelongId, SearchModel model) { ResultPageModel result = new ResultPageModel(); if (model == null) { return(result); } string strSql = @"select S.ShopID,S.ShopName,S.ShopType,S.ShopBelongId,S.ShopProv,S.ShopCity,S.ShopArea,S.ShopAddress,S.Contacts,S.ContactWay,S.LoginName,S.LoginPassword,S.IsActive,S.CreateTime {0} from BM_ShopManage S "; if (model.type == 2) { strSql = string.Format(strSql, ",S2.ShopName as BelongOneShopName "); strSql += " left join BM_ShopManage S2 on S2.ShopID=S.ShopBelongId "; } else { strSql = string.Format(strSql, ""); } strSql += " where 1=1 and S.IsDel<>1 and S.ShopType=@ShopType"; if (ShopType == 2 && ShopBelongId > 0) { strSql += " and S.ShopBelongId=@ShopBelongId"; } if (!string.IsNullOrEmpty(model.key)) { if (model.type == 2) { strSql += string.Format(" and (S.ShopName like '%{0}%' or S2.ShopName like '%{0}%') ", model.key); } else { strSql += string.Format(" and S.ShopName like '%{0}%' ", model.key); } } if (!string.IsNullOrEmpty(model.province)) { strSql += " and S.ShopProv=@ShopProv"; } if (!string.IsNullOrEmpty(model.city)) { strSql += " and S.ShopCity=@ShopCity"; } if (!string.IsNullOrEmpty(model.startTime)) { strSql += " and CONVERT(nvarchar(10),S.CreateTime,121)>=CONVERT(nvarchar(10),@startTime,121) "; } if (!string.IsNullOrEmpty(model.endTime)) { strSql += " and CONVERT(nvarchar(10),S.CreateTime,121)<=CONVERT(nvarchar(10),@endTime,121) "; } var param = new[] { new SqlParameter("@ShopType", ShopType), new SqlParameter("@ShopBelongId", ShopBelongId), new SqlParameter("@ShopProv", model.province), new SqlParameter("@ShopCity", model.city), new SqlParameter("@startTime", model.startTime), new SqlParameter("@endTime", model.endTime), }; //生成sql语句 return(getPageData <ShopModel>(model.PageSize, model.PageIndex, strSql, "S.CreateTime", false, param)); }