public object getFoodDetail(Dictionary <string, object> dicParas) { XCCloudUserTokenModel userTokenModel = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]); StoreIDDataModel userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel); string foodId = dicParas.ContainsKey("foodId") ? dicParas["foodId"].ToString() : string.Empty; if (string.IsNullOrEmpty(foodId)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "套餐名不能为空")); } string sql = "exec GetFoodDetail @StoreId,@FoodId "; SqlParameter[] parameters = new SqlParameter[2]; parameters[0] = new SqlParameter("@StoreId", userTokenDataModel.StoreId); parameters[1] = new SqlParameter("@FoodId", foodId); System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { List <FoodDetailModel> list1 = Utils.GetModelList <FoodDetailModel>(ds.Tables[0]).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, list1)); } else { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "无数据")); } }
public object GetUserGroup(Dictionary <string, object> dicParas) { string errMsg = string.Empty; int userId, authorId; string workId = dicParas.ContainsKey("workId") ? dicParas["workId"].ToString() : string.Empty; if (!checkParas(dicParas, out userId, out authorId, out errMsg)) { LogHelper.SaveLog("错误:" + errMsg); return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } string sql = " exec SelectUserGroup @UserID"; SqlParameter[] parameters = new SqlParameter[1]; parameters[0] = new SqlParameter("@UserID", userId); System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters); System.Data.DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { var list = Utils.GetModelList <Base_UserGroup>(ds.Tables[0]).ToList(); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, list)); } else { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, "工作组列表为空")); } }
public object getFoodList(Dictionary <string, object> dicParas) { XCCloudUserTokenModel userTokenModel = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]); StoreIDDataModel userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel); string customerType = dicParas.ContainsKey("customerType") ? dicParas["customerType"].ToString() : string.Empty; string memberLevelId = dicParas.ContainsKey("memberLevelId") ? dicParas["memberLevelId"].ToString() : string.Empty; string foodTypeStr = dicParas.ContainsKey("foodTypeStr") ? dicParas["foodTypeStr"].ToString() : string.Empty; if (string.IsNullOrEmpty(memberLevelId)) { return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员等级无效")); } string sql = "exec GetFoodListInfo @StoreId,@CustomerType,@MemberLevelId,@FoodTypeStr "; SqlParameter[] parameters = new SqlParameter[4]; parameters[0] = new SqlParameter("@StoreId", userTokenDataModel.StoreId); parameters[1] = new SqlParameter("@CustomerType", customerType); parameters[2] = new SqlParameter("@MemberLevelId", memberLevelId); parameters[3] = new SqlParameter("@FoodTypeStr", foodTypeStr); System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { List <FoodInfoModel> list1 = Utils.GetModelList <FoodInfoModel>(ds.Tables[0]).ToList(); for (int i = 0; i < list1.Count; i++) { List <FoodInfoPriceModel> listFoodInfoPriceModel = new List <FoodInfoPriceModel>(); FoodInfoPriceModel foodInfoModel = new FoodInfoPriceModel(0, list1[i].FoodPrice); listFoodInfoPriceModel.Add(foodInfoModel); if (list1[i].AllowCoin == 1) { foodInfoModel = new FoodInfoPriceModel(1, list1[i].Coins); listFoodInfoPriceModel.Add(foodInfoModel); } if (list1[i].AllowPoint == 1) { foodInfoModel = new FoodInfoPriceModel(2, list1[i].Points); listFoodInfoPriceModel.Add(foodInfoModel); } if (list1[i].AllowLottery == 1) { foodInfoModel = new FoodInfoPriceModel(3, list1[i].Lottery); listFoodInfoPriceModel.Add(foodInfoModel); } list1[i].priceListModel = listFoodInfoPriceModel; } return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, list1)); } return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "无数据")); }
public object GetUserGroup(Dictionary <string, object> dicParas) { try { XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string errMsg = string.Empty; string groupId = dicParas.ContainsKey("groupId") ? dicParas["groupId"].ToString() : string.Empty; if (string.IsNullOrEmpty(groupId)) { errMsg = "groupId参数不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } string sql = string.Empty; SqlParameter[] parameters = new SqlParameter[0]; if (userTokenKeyModel.LogType == (int)RoleType.MerchUser) { string merchId = userTokenKeyModel.DataModel.MerchID; sql = " exec SelectUserGroupGrant @GroupID,@MerchID"; Array.Resize(ref parameters, parameters.Length + 1); parameters[parameters.Length - 1] = new SqlParameter("@GroupID", groupId); Array.Resize(ref parameters, parameters.Length + 1); parameters[parameters.Length - 1] = new SqlParameter("@MerchID", merchId); } else if (userTokenKeyModel.LogType == (int)RoleType.XcAdmin) { sql = " exec SelectFunctionForXA @GroupID"; Array.Resize(ref parameters, parameters.Length + 1); parameters[parameters.Length - 1] = new SqlParameter("@GroupID", groupId); } //返回商户信息和功能菜单信息 System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters); if (ds.Tables.Count != 2) { errMsg = "获取数据异常"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } //实例化一个根节点 var userGroupModel = Utils.GetModelList <UserGroupModel>(ds.Tables[0]).FirstOrDefault() ?? new UserGroupModel(); UserGroupGrantModel rootRoot = new UserGroupGrantModel(); rootRoot.ParentID = 0; TreeHelper.LoopToAppendChildren(Utils.GetModelList <UserGroupGrantModel>(ds.Tables[1]), rootRoot); userGroupModel.UserGroupGrants = rootRoot.Children; return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, userGroupModel)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object getMemberOpenCardFoodInfo(Dictionary <string, object> dicParas) { XCCloudUserTokenModel userTokenModel = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]); StoreIDDataModel userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel); string MemberLevelId = dicParas.ContainsKey("memberLevelId") ? dicParas["memberLevelId"].ToString() : string.Empty; string sql = "exec GetMemberOpenCardFoodInfo @StoreId,@MemberLevelId"; SqlParameter[] parameters = new SqlParameter[2]; parameters[0] = new SqlParameter("@StoreId", userTokenDataModel.StoreId); parameters[1] = new SqlParameter("@MemberLevelId", MemberLevelId); System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters); DataTable dt = ds.Tables[0]; if (dt.Rows.Count > 0) { List <OpenCardFoodInfoModel> list1 = Utils.GetModelList <OpenCardFoodInfoModel>(ds.Tables[0]).ToList(); //for (int i = 0; i < list1.Count; i++) //{ // List<FoodInfoPriceModel> listFoodInfoPriceModel = new List<FoodInfoPriceModel>(); // FoodInfoPriceModel foodInfoModel = new FoodInfoPriceModel(0, list1[i].FoodPrice); // listFoodInfoPriceModel.Add(foodInfoModel); // if (list1[i].AllowCoin == 1) // { // foodInfoModel = new FoodInfoPriceModel(1, list1[i].Coins); // listFoodInfoPriceModel.Add(foodInfoModel); // } // if (list1[i].AllowPoint == 1) // { // foodInfoModel = new FoodInfoPriceModel(2, list1[i].Points); // listFoodInfoPriceModel.Add(foodInfoModel); // } // if (list1[i].AllowLottery == 1) // { // foodInfoModel = new FoodInfoPriceModel(3, list1[i].Lottery); // listFoodInfoPriceModel.Add(foodInfoModel); // } // list1[i].priceListModel = listFoodInfoPriceModel; //} return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, list1)); } return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "无数据")); }
public object GetNodes(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string merchId = dicParas.ContainsKey("merchId") ? dicParas["merchId"].ToString() : string.Empty; string dictKey = dicParas.ContainsKey("dictKey") ? dicParas["dictKey"].ToString() : string.Empty; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; if (userTokenKeyModel.LogType == (int)RoleType.MerchUser) { merchId = userTokenKeyModel.DataModel.MerchID; } string sql = " exec SP_DictionaryNodes @MerchID,@DictKey,@RootID output "; SqlParameter[] parameters = new SqlParameter[3]; parameters[0] = new SqlParameter("@MerchID", merchId); parameters[1] = new SqlParameter("@DictKey", dictKey); parameters[2] = new SqlParameter("@RootID", 0); parameters[2].Direction = System.Data.ParameterDirection.Output; System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters); if (ds.Tables.Count == 0) { errMsg = "没有找到节点信息"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } var dictionaryResponse = Utils.GetModelList <DictionaryResponseModel>(ds.Tables[0]).ToList(); int rootId = 0; int.TryParse(parameters[2].Value.ToString(), out rootId); //实例化一个根节点 DictionaryResponseModel rootRoot = new DictionaryResponseModel(); rootRoot.ID = rootId; TreeHelper.LoopToAppendChildren(dictionaryResponse, rootRoot); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, rootRoot.Children)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object CheckOrders(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; int id = (dicParas.ContainsKey("id") && Utils.isNumber(dicParas["id"])) ? Convert.ToInt32(dicParas["id"]) : 0; string checkDate = dicParas.ContainsKey("checkDate") ? dicParas["checkDate"].ToString() : string.Empty; string merchId = string.Empty; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; merchId = userTokenKeyModel.DataModel.MerchID; if (string.IsNullOrEmpty(checkDate)) { errMsg = "营业日期不能为空"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } string sql = " exec CheckOrders @CheckDate,@MerchId,@ID,@Return output "; var parameters = new SqlParameter[4]; parameters[0] = new SqlParameter("@CheckDate", checkDate); parameters[1] = new SqlParameter("@MerchId", merchId); parameters[2] = new SqlParameter("@ID", id); parameters[3] = new SqlParameter("@Return", 0); parameters[3].Direction = System.Data.ParameterDirection.Output; XCCloudBLL.ExecuteQuerySentence(sql, parameters); if (parameters[3].Value.ToString() == "1") { return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn)); } else { return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, "账目审核失败")); } } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
public object GetMenus(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string logId = userTokenKeyModel.LogId; int logType = (int)userTokenKeyModel.LogType; string merchId = (userTokenKeyModel.DataModel != null) ? userTokenKeyModel.DataModel.MerchID : string.Empty; //返回商户信息和功能菜单信息 string sql = " exec SP_GetMenus @LogType,@LogID,@MerchID"; SqlParameter[] parameters = new SqlParameter[3]; parameters[0] = new SqlParameter("@LogType", logType); parameters[1] = new SqlParameter("@LogID", Convert.ToInt32(logId)); parameters[1] = new SqlParameter("@MerchID", merchId); System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters); if (ds.Tables.Count != 1) { errMsg = "获取数据异常"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } var list = Utils.GetModelList <MenuInfoModel>(ds.Tables[0]); //实例化一个根节点 MenuInfoModel rootRoot = new MenuInfoModel(); rootRoot.ParentID = 0; TreeHelper.LoopToAppendChildren(list, rootRoot); return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, rootRoot.Children)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }
protected void Page_Load(object sender, EventArgs e) { try { string openId = string.Empty; string errMsg = string.Empty; string storeId = string.Empty; string merchId = string.Empty; string revOpenId = string.Empty; int userType = (int)UserType.Store; string code = Request["code"] != null ? Request["code"].ToString() : string.Empty; string state = Request["state"] != null ? Request["state"].ToString() : string.Empty; string mobile = Request["mobile"] != null ? Request["mobile"].ToString() : string.Empty; string username = Request["username"] != null ? Request["username"].ToString() : string.Empty; string realname = Request["realname"] != null ? Request["realname"].ToString() : string.Empty; string password = Request["password"] != null ? Request["password"].ToString() : string.Empty; string message = Request["message"] != null ? Request["message"].ToString() : string.Empty; //获取用户openid if (!TokenMana.GetOpenId(code, state, out openId)) { errMsg = "获取openId失败"; LogHelper.SaveLog("错误:" + errMsg); Response.Redirect(WeiXinConfig.RedirectErrorPage + "?title=" + HttpUtility.UrlEncode("注册失败") + "&message=" + HttpUtility.UrlEncode(errMsg), false); return; } LogHelper.SaveLog("openId:" + openId); //获取用户基本信息 string unionId = string.Empty; if (!TokenMana.GetUnionId(openId, out unionId, out errMsg)) { LogHelper.SaveLog("错误:" + errMsg); Response.Redirect(WeiXinConfig.RedirectErrorPage + "?title=" + HttpUtility.UrlEncode("注册失败") + "&message=" + HttpUtility.UrlEncode(errMsg), false); return; } if (!checkRegisterParas(openId, out storeId, out merchId, out userType, out revOpenId, out errMsg)) { Response.Redirect(WeiXinConfig.RedirectErrorPage + "?title=" + HttpUtility.UrlEncode("注册失败") + "&message=" + HttpUtility.UrlEncode(errMsg), false); return; } LogHelper.SaveLog("unionId:" + unionId); LogHelper.SaveLog("storeId:" + storeId); //注册成功后,给商户管理员发送审核消息模板 string sql = " exec SP_RegisterUserFromWx @StoreId,@MerchId,@UserType,@Mobile,@Username,@Realname,@UserPassword,@Message,@WXOpenID,@UnionID,@WorkID output,@Return output "; SqlParameter[] parameters = new SqlParameter[12]; parameters[0] = new SqlParameter("@StoreId", storeId); parameters[1] = new SqlParameter("@MerchId", merchId); parameters[2] = new SqlParameter("@UserType", userType); parameters[3] = new SqlParameter("@Mobile", mobile); parameters[4] = new SqlParameter("@Username", username); parameters[5] = new SqlParameter("@Realname", realname); parameters[6] = new SqlParameter("@UserPassword", Utils.MD5(password)); parameters[7] = new SqlParameter("@Message", message); parameters[8] = new SqlParameter("@WXOpenID", openId); parameters[9] = new SqlParameter("@UnionID", unionId); parameters[10] = new SqlParameter("@WorkID", 0); parameters[10].Direction = ParameterDirection.Output; parameters[11] = new SqlParameter("@Return", 0); parameters[11].Direction = ParameterDirection.Output; System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters); var workId = parameters[10].Value + ""; var ret = parameters[11].Value + ""; if (ret == "1") { IBase_UserInfoService userInfoService = BLLContainer.Resolve <IBase_UserInfoService>(); var userList = userInfoService.GetModels(p => p.OpenID.ToString().Equals(openId, StringComparison.OrdinalIgnoreCase)); var userInfo = userList.FirstOrDefault <Base_UserInfo>(); MessagePush(revOpenId, username, userInfo.CreateTime.Value.ToString("f"), workId, userType, message); var succMsg = "已递交工单,等待管理员审核"; LogHelper.SaveLog("成功:" + succMsg); Response.Redirect(WeiXinConfig.RedirectSuccessPage + "?realname=" + HttpUtility.UrlEncode(realname) + "&openid=" + openId + "&title=" + HttpUtility.UrlEncode("注册成功") + "&message=" + HttpUtility.UrlEncode(succMsg), false); } else { errMsg = "注册失败"; LogHelper.SaveLog("错误:" + errMsg); Response.Redirect(WeiXinConfig.RedirectErrorPage + "?title=" + HttpUtility.UrlEncode("注册失败") + "&message=" + HttpUtility.UrlEncode(errMsg), false); } } catch (Exception ex) { LogHelper.SaveLog("错误:" + ex.Message); Response.Redirect(WeiXinConfig.RedirectErrorPage + "?title=" + HttpUtility.UrlEncode("注册失败") + "&message=" + HttpUtility.UrlEncode(ex.Message), false); } }
public object GetMerchInfo(Dictionary <string, object> dicParas) { try { string errMsg = string.Empty; string merchId = dicParas.ContainsKey("merchId") ? dicParas["merchId"].ToString() : string.Empty; XCCloudUserTokenModel userTokenKeyModel = (XCCloudUserTokenModel)dicParas[Constant.XCCloudUserTokenModel]; string currentMerchId = userTokenKeyModel.DataModel.MerchID; #region 商户信息和功能菜单 //返回商户信息 string sql = "select * from Base_MerchantInfo where MerchID=@MerchID"; SqlParameter[] parameters = new SqlParameter[1]; if (string.IsNullOrEmpty(merchId)) { parameters[0] = new SqlParameter("@MerchID", currentMerchId); } else { parameters[0] = new SqlParameter("@MerchID", merchId); } System.Data.DataSet ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters); if (ds.Tables.Count != 1) { errMsg = "获取数据异常"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } //返回功能菜单信息 var base_MerchInfoModel = Utils.GetModelList <Base_MerchInfoModel>(ds.Tables[0]).FirstOrDefault() ?? new Base_MerchInfoModel(); sql = " exec SelectMerchFunction @MerchID"; parameters = new SqlParameter[1]; if (string.IsNullOrEmpty(merchId)) { parameters[0] = new SqlParameter("@MerchID", currentMerchId); } else { parameters[0] = new SqlParameter("@MerchID", merchId); } ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters); if (ds.Tables.Count != 1) { errMsg = "获取数据异常"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } //实例化一个根节点 Base_MerchFunctionModel rootRoot = new Base_MerchFunctionModel(); rootRoot.ParentID = 0; TreeHelper.LoopToAppendChildren(Utils.GetModelList <Base_MerchFunctionModel>(ds.Tables[0]), rootRoot); base_MerchInfoModel.MerchFunction = rootRoot.Children; #endregion if (string.IsNullOrEmpty(merchId)) { #region 商户类型列表 sql = " exec SP_DictionaryNodes @MerchID,@DictKey,@RootID output "; parameters = new SqlParameter[3]; parameters[0] = new SqlParameter("@MerchID", string.Empty); parameters[1] = new SqlParameter("@DictKey", "商户类别"); parameters[2] = new SqlParameter("@RootID", 0); parameters[2].Direction = System.Data.ParameterDirection.Output; ds = XCCloudBLL.ExecuteQuerySentence(sql, parameters); if (ds.Tables.Count == 0) { errMsg = "没有找到节点信息"; return(ResponseModelFactory.CreateFailModel(isSignKeyReturn, errMsg)); } var dictionaryResponse = Utils.GetModelList <DictionaryResponseModel>(ds.Tables[0]); //代理商不能创建代理商 if (base_MerchInfoModel.MerchType == (int)MerchType.Agent) { dictionaryResponse = dictionaryResponse.Where(p => !p.DictValue.Equals(Convert.ToString(MerchType.Agent), StringComparison.OrdinalIgnoreCase)).ToList(); } //实例化一个根节点 int rootId = 0; int.TryParse(parameters[2].Value.ToString(), out rootId); var rootRoot2 = new DictionaryResponseModel(); rootRoot2.ID = rootId; TreeHelper.LoopToAppendChildren(dictionaryResponse, rootRoot2); base_MerchInfoModel.MerchTypes = rootRoot2.Children; #endregion } return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, base_MerchInfoModel)); } catch (Exception e) { return(ResponseModelFactory.CreateReturnModel(isSignKeyReturn, Return_Code.F, e.Message)); } }