Beispiel #1
0
        public object getMember(Dictionary <string, object> dicParas)
        {
            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);

            string icCardId = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
            string storeId  = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(icCardId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员卡号无效"));
            }
            if (string.IsNullOrEmpty(storeId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号无效"));
            }

            string storedProcedure = "GetMember";

            SqlParameter[] parameters = new SqlParameter[4];
            parameters[0]           = new SqlParameter("@ICCardID", icCardId);
            parameters[1]           = new SqlParameter("@StoreID", storeId);
            parameters[2]           = new SqlParameter("@Result", SqlDbType.Int);
            parameters[2].Direction = System.Data.ParameterDirection.Output;
            parameters[3]           = new SqlParameter("@ErrMsg", SqlDbType.VarChar, 200);
            parameters[3].Direction = System.Data.ParameterDirection.Output;
            System.Data.DataSet ds = XCCloudBLL.GetStoredProcedureSentence(storedProcedure, parameters);
            if (parameters[2].Value.ToString() == "1")
            {
                var baseMemberModel = Utils.GetModelList <BaseMemberModel>(ds.Tables[0]).ToList()[0];
                return(ResponseModelFactory <BaseMemberModel> .CreateModel(isSignKeyReturn, baseMemberModel));
            }
            return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员信息不存在"));
        }
Beispiel #2
0
        private bool genNo(out string merchId, out string errMsg)
        {
            errMsg  = string.Empty;
            merchId = string.Empty;

            string sql         = "select max(MerchID) from Base_MerchantInfo where MerchID >= '100010'";
            string lastMerchID = XCCloudBLL.ExecuteScalar(sql);
            var    bNo         = 0;

            int.TryParse(lastMerchID, out bNo);
            if (bNo >= 899989)
            {
                errMsg = "商户数量已满额,系统最多支持899989个用户";
                return(false);
            }

            if (bNo == 0)
            {
                bNo = 100010;
            }
            else
            {
                bNo = bNo + 1;
            }

            merchId = bNo.ToString();
            return(true);
        }
Beispiel #3
0
        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, "工作组列表为空"));
            }
        }
Beispiel #4
0
        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, "无数据"));
            }
        }
Beispiel #5
0
        public object getOrderContain(Dictionary <string, object> dicParas)
        {
            string errMsg     = string.Empty;
            string orderFlwId = dicParas.ContainsKey("orderFlwId") ? dicParas["orderFlwId"].ToString() : string.Empty;
            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);

            if (string.IsNullOrEmpty(orderFlwId))
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, "订单Id参数无效"));
            }

            string storedProcedure = "GetOrderContainById";

            SqlParameter[] sqlParameter = new SqlParameter[2];
            sqlParameter[0]       = new SqlParameter("@StoreId", SqlDbType.VarChar);
            sqlParameter[0].Value = userTokenDataModel.StoreId;
            sqlParameter[1]       = new SqlParameter("@OrderFlwId", SqlDbType.Int);
            sqlParameter[1].Value = orderFlwId;

            System.Data.DataSet ds = XCCloudBLL.GetStoredProcedureSentence(storedProcedure, sqlParameter);
            if (ds != null && ds.Tables.Count == 2 && ds.Tables[0].Rows.Count > 0)
            {
                OrderMainModel          main   = Utils.GetModelList <OrderMainModel>(ds.Tables[0]).ToList()[0];
                List <OrderDetailModel> detail = Utils.GetModelList <OrderDetailModel>(ds.Tables[1]).ToList();
                OrderInfoModel          model  = new OrderInfoModel(main, detail);
                return(ResponseModelFactory.CreateSuccessModel <OrderInfoModel>(isSignKeyReturn, model));
            }
            else
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, "订单信息不存在"));
            }
        }
Beispiel #6
0
        public object checkOpenCard(Dictionary <string, object> dicParas)
        {
            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);
            string storeId = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string mobile  = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString() : string.Empty;

            if (!userTokenDataModel.StoreId.Equals(storeId))
            {
                ResponseModel responseModel = new ResponseModel(Return_Code.T, "", Result_Code.F, "门店信息不正确");
                return(responseModel);
            }

            string storedProcedure = "CheckStoreCanOpenCard";

            SqlParameter[] sqlParameter = new SqlParameter[4];
            sqlParameter[0]           = new SqlParameter("@StoreId", SqlDbType.VarChar, 15);
            sqlParameter[0].Value     = storeId;
            sqlParameter[1]           = new SqlParameter("@Mobile", SqlDbType.VarChar, 11);
            sqlParameter[1].Value     = mobile;
            sqlParameter[2]           = new SqlParameter("@ErrMsg", SqlDbType.VarChar, 200);
            sqlParameter[2].Direction = ParameterDirection.Output;
            sqlParameter[3]           = new SqlParameter("@Return", SqlDbType.Int);
            sqlParameter[3].Direction = ParameterDirection.ReturnValue;
            XCCloudBLL.ExecuteStoredProcedureSentence(storedProcedure, sqlParameter);
            if (sqlParameter[3].Value.ToString() == "1")
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.T, ""));
            }
            else
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, sqlParameter[2].Value.ToString()));
            }
        }
Beispiel #7
0
        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, "无数据"));
        }
Beispiel #8
0
        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));
            }
        }
Beispiel #9
0
        public object getMemberLevel(Dictionary <string, object> dicParas)
        {
            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);

            string storedProcedure = "GetMemberLevel";

            SqlParameter[] parameters = new SqlParameter[1];
            parameters[0] = new SqlParameter("@StoreId", userTokenDataModel.StoreId);
            System.Data.DataSet          ds   = XCCloudBLL.GetStoredProcedureSentence(storedProcedure, parameters);
            List <Data_MemberLevelModel> list = Utils.GetModelList <Data_MemberLevelModel>(ds.Tables[0]);

            return(ResponseModelFactory.CreateSuccessModel(isSignKeyReturn, list));
        }
Beispiel #10
0
        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, "无数据"));
        }
Beispiel #11
0
        public object getMemberRepeatCode(Dictionary <string, object> dicParas)
        {
            XCCloudUserTokenModel userTokenModel = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            string storeId  = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string icCardId = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;

            if (string.IsNullOrEmpty(storeId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号不能为空"));
            }

            StoreInfoCacheModel storeInfo = null;

            if (!XCCloudStoreBusiness.IsEffectiveStore(storeId, ref storeInfo))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店号无效"));
            }

            if (string.IsNullOrEmpty(icCardId))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员卡号无效"));
            }
            //获取会员信息
            string storedProcedure = "GetMemberRepeatCode";

            SqlParameter[] parameters = new SqlParameter[5];
            parameters[0]           = new SqlParameter("@ICCardID", icCardId);
            parameters[1]           = new SqlParameter("@StoreID", storeId);
            parameters[2]           = new SqlParameter("@RepeatCode", SqlDbType.Int);
            parameters[2].Direction = System.Data.ParameterDirection.Output;
            parameters[3]           = new SqlParameter("@ErrMsg", SqlDbType.VarChar, 200);
            parameters[3].Direction = System.Data.ParameterDirection.Output;
            parameters[4]           = new SqlParameter("@Return", SqlDbType.Int);
            parameters[4].Direction = System.Data.ParameterDirection.ReturnValue;
            XCCloudBLL.ExecuteStoredProcedureSentence(storedProcedure, parameters);
            if (parameters[4].Value.ToString() == "1")
            {
                var obj = new {
                    repeatCode = parameters[2].Value.ToString()
                };
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
            }
            else
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "会员卡无效"));
            }
        }
Beispiel #12
0
        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));
            }
        }
Beispiel #13
0
        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));
            }
        }
Beispiel #14
0
        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));
            }
        }
Beispiel #15
0
        //开通班次
        public static bool OpenSchedule(string storeId, int userId, string scheduleName, string workStation, out int currentSchedule, out string openTime, out string errMsg)
        {
            errMsg = string.Empty;
            string checkDate = System.DateTime.Now.ToString("yyyy-MM-dd");
            string sql       = "OpenSchedule";

            SqlParameter[] parameters = new SqlParameter[9];
            parameters[0]           = new SqlParameter("@CheckDate", checkDate);
            parameters[1]           = new SqlParameter("@StoreId", storeId);
            parameters[2]           = new SqlParameter("@UserId", userId);
            parameters[3]           = new SqlParameter("@scheduleName", scheduleName);
            parameters[4]           = new SqlParameter("@workStation", workStation);
            parameters[5]           = new SqlParameter("@CurrentSchedule", 0);
            parameters[5].Direction = System.Data.ParameterDirection.Output;
            parameters[6]           = new SqlParameter("@OpenTime", System.Data.SqlDbType.VarChar, 20);
            parameters[6].Direction = System.Data.ParameterDirection.Output;
            parameters[7]           = new SqlParameter("@ErrMsg", System.Data.SqlDbType.VarChar, 50);
            parameters[7].Direction = System.Data.ParameterDirection.Output;
            parameters[8]           = new SqlParameter("@ReturnValue", 0);
            parameters[8].Direction = System.Data.ParameterDirection.ReturnValue;
            XCCloudBLL.ExecuteStoredProcedureSentence(sql, parameters);

            int result = Convert.ToInt32(parameters[8].Value);

            if (result >= 1)
            {
                currentSchedule = Convert.ToInt32(parameters[5].Value);
                openTime        = parameters[6].Value.ToString();
                return(true);
            }
            else
            {
                errMsg          = parameters[7].Value.ToString();
                currentSchedule = 0;
                openTime        = string.Empty;
                return(false);
            }
        }
Beispiel #16
0
        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));
            }
        }
Beispiel #17
0
        public object payOrder(Dictionary <string, object> dicParas)
        {
            string errMsg       = string.Empty;
            string orderFlwId   = dicParas.ContainsKey("orderFlwId") ? dicParas["orderFlwId"].ToString() : string.Empty;
            string openICCardId = dicParas.ContainsKey("openICCardId") ? dicParas["openICCardId"].ToString() : string.Empty;
            string workStation  = dicParas.ContainsKey("workStation") ? dicParas["workStation"].ToString() : string.Empty;
            string authorId     = dicParas.ContainsKey("authorId") ? dicParas["authorId"].ToString() : string.Empty;
            string realPay      = dicParas.ContainsKey("realPay") ? dicParas["realPay"].ToString() : string.Empty;

            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);

            if (string.IsNullOrEmpty(orderFlwId))
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, "订单Id参数无效"));
            }

            if (!Utils.IsNumeric(openICCardId) || int.Parse(openICCardId) < 0)
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, "开通卡号参数无效"));
            }

            if (!Utils.IsNumeric(authorId) || int.Parse(authorId) < 0)
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, "授权Id无效"));
            }

            if (string.IsNullOrEmpty(workStation))
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, "工作站参数无效"));
            }

            if (!Utils.IsNumeric(realPay) && decimal.Parse(realPay) <= 0)
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, "实付金额无效"));
            }

            string storedProcedure = "FinishOrderPayment";

            SqlParameter[] sqlParameter = new SqlParameter[9];
            sqlParameter[0]       = new SqlParameter("@StoreID", SqlDbType.VarChar);
            sqlParameter[0].Value = userTokenDataModel.StoreId;

            sqlParameter[1]       = new SqlParameter("@OrderFlwId", SqlDbType.Int);
            sqlParameter[1].Value = orderFlwId;

            sqlParameter[2]       = new SqlParameter("@OpenICCardId", SqlDbType.Int);
            sqlParameter[2].Value = openICCardId;

            sqlParameter[3]       = new SqlParameter("@RealPay", SqlDbType.Decimal);
            sqlParameter[3].Value = realPay;

            sqlParameter[4]       = new SqlParameter("@UserID", SqlDbType.Int);
            sqlParameter[4].Value = userTokenModel.LogId;

            sqlParameter[5]       = new SqlParameter("@WorkStation", SqlDbType.VarChar);
            sqlParameter[5].Value = workStation;

            sqlParameter[6]       = new SqlParameter("@AuthorID", SqlDbType.Int);
            sqlParameter[6].Value = authorId;

            sqlParameter[7]           = new SqlParameter("@ErrMsg", SqlDbType.VarChar, 200);
            sqlParameter[7].Direction = ParameterDirection.Output;

            sqlParameter[8]           = new SqlParameter("@Return", SqlDbType.Int);
            sqlParameter[8].Direction = ParameterDirection.ReturnValue;

            XCCloudBLL.ExecuteStoredProcedureSentence(storedProcedure, sqlParameter);
            if (sqlParameter[8].Value.ToString() == "1")
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.T, ""));
            }
            else
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, sqlParameter[7].Value.ToString()));
            }
        }
Beispiel #18
0
        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);
            }
        }
Beispiel #19
0
        public object addOrder(Dictionary <string, object> dicParas)
        {
            string errMsg = string.Empty;
            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);

            if (!CheckAddOrderParams(dicParas, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }

            string buyDetailsJson = dicParas.ContainsKey("buyDetails") ? dicParas["buyDetails"].ToString() : string.Empty;
            List <OrderBuyDetailModel> buyDetailList = Utils.DataContractJsonDeserializer <List <OrderBuyDetailModel> >(buyDetailsJson);
            string customerType  = dicParas.ContainsKey("customerType") ? dicParas["customerType"].ToString() : string.Empty;
            string memberLevelId = dicParas.ContainsKey("memberLevelId") ? dicParas["memberLevelId"].ToString() : string.Empty;
            //string foodCount = dicParas.ContainsKey("foodCount") ? dicParas["foodCount"].ToString() : string.Empty;
            //string goodCount = dicParas.ContainsKey("goodCount") ? dicParas["goodCount"].ToString() : string.Empty;
            string icCardId     = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
            string payCount     = dicParas.ContainsKey("payCount") ? dicParas["payCount"].ToString() : string.Empty;
            string freePay      = dicParas.ContainsKey("freePay") ? dicParas["freePay"].ToString() : string.Empty;
            string realPay      = dicParas.ContainsKey("realPay") ? dicParas["realPay"].ToString() : string.Empty;
            string scheduleId   = dicParas.ContainsKey("scheduleId") ? dicParas["scheduleId"].ToString() : string.Empty;
            string workStation  = dicParas.ContainsKey("workStation") ? dicParas["workStation"].ToString() : string.Empty;
            string authorId     = dicParas.ContainsKey("authorId") ? dicParas["authorId"].ToString() : string.Empty;
            string note         = dicParas.ContainsKey("note") ? dicParas["note"].ToString() : string.Empty;
            string orderSource  = dicParas.ContainsKey("orderSource") ? dicParas["orderSource"].ToString() : string.Empty;
            string saleCoinType = dicParas.ContainsKey("saleCoinType") ? dicParas["saleCoinType"].ToString() : string.Empty;
            string mobile       = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString() : string.Empty;

            string storedProcedure = "CreateOrder";

            String[] Ary = new String[] { "数据0", "数据1", "数据2", "数据3" };

            List <SqlDataRecord> listSqlDataRecord = new List <SqlDataRecord>();

            SqlMetaData[] MetaDataArr = new SqlMetaData[] {
                new SqlMetaData("foodId", SqlDbType.Int),
                new SqlMetaData("foodCount", SqlDbType.Int),
                new SqlMetaData("payType", SqlDbType.Int),
                new SqlMetaData("payNum", SqlDbType.Decimal)
            };


            for (int i = 0; i < buyDetailList.Count; i++)
            {
                List <object> listParas = new List <object>();
                listParas.Add(buyDetailList[i].FoodId);
                listParas.Add(buyDetailList[i].FoodCount);
                listParas.Add(buyDetailList[i].PayType);
                listParas.Add(buyDetailList[i].PayNum);

                var record = new SqlDataRecord(MetaDataArr);
                for (int j = 0; j < Ary.Length; j++)
                {
                    record.SetValue(j, listParas[j]);
                }
                listSqlDataRecord.Add(record);
            }



            SqlParameter[] sqlParameter = new SqlParameter[18];
            sqlParameter[0]       = new SqlParameter("@FoodDetail", SqlDbType.Structured);
            sqlParameter[0].Value = listSqlDataRecord;

            sqlParameter[1]       = new SqlParameter("@StoreID", SqlDbType.VarChar);
            sqlParameter[1].Value = userTokenDataModel.StoreId;

            sqlParameter[2]       = new SqlParameter("@ICCardID", SqlDbType.Int);
            sqlParameter[2].Value = icCardId;

            sqlParameter[3]       = new SqlParameter("@PayCount", SqlDbType.Decimal);
            sqlParameter[3].Value = payCount;

            sqlParameter[4]       = new SqlParameter("@FreePay", SqlDbType.Decimal);
            sqlParameter[4].Value = freePay;

            sqlParameter[5]       = new SqlParameter("@RealPay", SqlDbType.Decimal);
            sqlParameter[5].Value = realPay;

            sqlParameter[6]       = new SqlParameter("@UserID", SqlDbType.Int);
            sqlParameter[6].Value = userTokenModel.LogId;

            sqlParameter[7]       = new SqlParameter("@MemberLevelId", SqlDbType.Int);
            sqlParameter[7].Value = memberLevelId;

            sqlParameter[8]       = new SqlParameter("@WorkStation", SqlDbType.VarChar);
            sqlParameter[8].Value = workStation;

            sqlParameter[9]       = new SqlParameter("@AuthorID", SqlDbType.Int);
            sqlParameter[9].Value = authorId;

            sqlParameter[10]       = new SqlParameter("@Note", SqlDbType.VarChar);
            sqlParameter[10].Value = note;

            sqlParameter[11]       = new SqlParameter("@OrderSource", SqlDbType.Int);
            sqlParameter[11].Value = orderSource;

            sqlParameter[12]       = new SqlParameter("@SaleCoinType", SqlDbType.Int);
            sqlParameter[12].Value = saleCoinType;

            sqlParameter[13]       = new SqlParameter("@CustomerType", SqlDbType.Int);
            sqlParameter[13].Value = customerType;

            sqlParameter[14]       = new SqlParameter("@Mobile", SqlDbType.VarChar);
            sqlParameter[14].Value = mobile;

            sqlParameter[15]           = new SqlParameter("@ErrMsg", SqlDbType.VarChar, 200);
            sqlParameter[15].Direction = ParameterDirection.Output;

            sqlParameter[16]           = new SqlParameter("@OrderFlwID", SqlDbType.Int);
            sqlParameter[16].Direction = ParameterDirection.Output;

            sqlParameter[17]           = new SqlParameter("@Return", SqlDbType.Int);
            sqlParameter[17].Direction = ParameterDirection.ReturnValue;

            XCCloudBLL.ExecuteStoredProcedureSentence(storedProcedure, sqlParameter);
            if (sqlParameter[17].Value.ToString() == "1")
            {
                var obj = new {
                    orderFlwId = Convert.ToInt32(sqlParameter[16].Value)
                };
                return(ResponseModelFactory.CreateAnonymousSuccessModel(isSignKeyReturn, obj));
            }
            else
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, sqlParameter[15].Value.ToString()));
            }
        }
Beispiel #20
0
        /// <summary>
        /// 订单支付成功处理
        /// </summary>
        /// <param name="orderId">订单号</param>
        /// <param name="amount">实际支付金额</param>
        /// <param name="selttleType">支付方式</param>
        /// <returns></returns>
        public static BarcodePayModel OrderPay(string orderId, decimal amount, SelttleType selttleType)
        {
            BarcodePayModel model = null;

            try
            {
                Flw_Order order = Flw_OrderBusiness.GetOrderModel(orderId);
                if (order != null)
                {
                    model           = new BarcodePayModel();
                    model.OrderId   = orderId;
                    model.PayAmount = amount.ToString("0.00");

                    string payTime = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss");

                    string  StoreID   = order.StoreID;
                    decimal PayCount  = order.PayCount != null ? (decimal)order.PayCount : 0; //应付金额
                    decimal FreePay   = order.FreePay != null ? (decimal)order.FreePay : 0;   //减免金额
                    decimal payAmount = PayCount - FreePay;                                   //实际应支付金额

                    if (payAmount == amount)
                    {
                        string sql = string.Format("update Flw_Order set OrderStatus={3}, RealPay='{0}', PayTime='{1}' where OrderID='{2}'", payAmount.ToString("0.00"), payTime, orderId, OrderState.AlreadyPaid);
                        XCCloudBLL.ExecuteSql(sql);

                        model.OrderStatus = OrderState.AlreadyPaid;

                        if (selttleType == SelttleType.StarPos)
                        {
                            sql = @"SELECT a.StoreID, SettleFee FROM Base_StoreInfo a
                                INNER JOIN Flw_Order b ON b.StoreID = a.StoreID
                                INNER JOIN Base_SettlePPOS c ON c.ID = a.SettleID
                                WHERE b.OrderID = '" + orderId + "'";
                        }
                        else if (selttleType == SelttleType.LcswPay)
                        {
                            sql = @"SELECT a.StoreID, SettleFee FROM Base_StoreInfo a
                                INNER JOIN Flw_Order b ON b.StoreID = a.StoreID
                                INNER JOIN Base_SettleLCPay c ON c.ID = a.SettleID
                                WHERE b.OrderID = '" + orderId + "'";
                        }
                        else
                        {
                            sql = "SELECT SettleFee FROM Base_StoreInfo a, Base_SettleOrg b WHERE a.SettleID = b.ID AND a.StoreID = '" + StoreID + "'";
                        }

                        DataTable dt = XCCloudBLL.ExecuterSqlToTable(sql);
                        if (dt.Rows.Count > 0)
                        {
                            //获取当前结算费率,计算手续费
                            double fee = Convert.ToDouble(dt.Rows[0]["SettleFee"]);
                            double d   = Math.Round(Convert.ToDouble(payAmount) * fee, 2, MidpointRounding.AwayFromZero); //最小单位为0.01元
                            if (d < 0.01)
                            {
                                d = 0.01;
                            }
                            sql = "update Flw_Order set PayFee='" + d + "' where OrderID='" + orderId + "'";
                            XCCloudBLL.ExecuteSql(sql);
                        }
                    }
                    else
                    {
                        //支付异常
                        //PayList.AddNewItem(out_trade_no, amount);
                        string sql = string.Format("update Flw_Order set OrderStatus={3}, RealPay='{0}', PayTime='{1}' where OrderID='{2}'", amount.ToString("0.00"), payTime, orderId, OrderState.Alarm);
                        XCCloudBLL.ExecuteSql(sql);

                        model.OrderStatus = OrderState.Alarm;
                    }

                    AddOrderPayCache(orderId, amount, payTime, model.OrderStatus, selttleType);
                }
            }
            catch
            {
                return(model);
            }
            return(model);
        }
Beispiel #21
0
        public object register(Dictionary <string, object> dicParas)
        {
            XCCloudUserTokenModel userTokenModel     = (XCCloudUserTokenModel)(dicParas[Constant.XCCloudUserTokenModel]);
            StoreIDDataModel      userTokenDataModel = (StoreIDDataModel)(userTokenModel.DataModel);
            string errMsg        = string.Empty;
            string storeId       = dicParas.ContainsKey("storeId") ? dicParas["storeId"].ToString() : string.Empty;
            string mobile        = dicParas.ContainsKey("mobile") ? dicParas["mobile"].ToString() : string.Empty;
            string wechat        = dicParas.ContainsKey("wechat") ? dicParas["wechat"].ToString() : string.Empty;
            string qq            = dicParas.ContainsKey("qq") ? dicParas["qq"].ToString() : string.Empty;
            string imme          = dicParas.ContainsKey("imme") ? dicParas["imme"].ToString() : string.Empty;
            string cardShape     = dicParas.ContainsKey("cardShape") ? dicParas["cardShape"].ToString() : string.Empty;
            string memberName    = dicParas.ContainsKey("memberName") ? dicParas["memberName"].ToString() : string.Empty;
            string birthday      = dicParas.ContainsKey("birthday") ? dicParas["birthday"].ToString() : string.Empty;
            string gender        = dicParas.ContainsKey("gender") ? dicParas["gender"].ToString() : string.Empty;
            string identityCard  = dicParas.ContainsKey("identityCard") ? dicParas["identityCard"].ToString() : string.Empty;
            string email         = dicParas.ContainsKey("email") ? dicParas["email"].ToString() : string.Empty;
            string leftHandCode  = dicParas.ContainsKey("leftHandCode") ? dicParas["leftHandCode"].ToString() : string.Empty;
            string rightHandCode = dicParas.ContainsKey("rightHandCode") ? dicParas["rightHandCode"].ToString() : string.Empty;
            string photo         = dicParas.ContainsKey("photo") ? dicParas["photo"].ToString() : string.Empty;
            string memberLevelId = dicParas.ContainsKey("memberLevelId") ? dicParas["memberLevelId"].ToString() : string.Empty;
            string foodId        = dicParas.ContainsKey("foodId") ? dicParas["foodId"].ToString() : string.Empty;
            string payCount      = dicParas.ContainsKey("payCount") ? dicParas["payCount"].ToString() : string.Empty;
            string realPay       = dicParas.ContainsKey("realPay") ? dicParas["realPay"].ToString() : string.Empty;
            string freePay       = dicParas.ContainsKey("freePay") ? dicParas["freePay"].ToString() : string.Empty;
            string repeatCode    = dicParas.ContainsKey("repeatCode") ? dicParas["repeatCode"].ToString() : string.Empty;
            string icCardId      = dicParas.ContainsKey("icCardId") ? dicParas["icCardId"].ToString() : string.Empty;
            string workStation   = dicParas.ContainsKey("workStation") ? dicParas["workStation"].ToString() : string.Empty;
            string note          = dicParas.ContainsKey("note") ? dicParas["note"].ToString() : string.Empty;
            string deposit       = dicParas.ContainsKey("deposit") ? dicParas["deposit"].ToString() : string.Empty;
            string payType       = dicParas.ContainsKey("payType") ? dicParas["payType"].ToString() : string.Empty;
            string saleCoinType  = dicParas.ContainsKey("saleCoinType") ? dicParas["saleCoinType"].ToString() : string.Empty;


            if (!checkRegisterParas(dicParas, out errMsg))
            {
                ResponseModel responseModel = new ResponseModel(Return_Code.T, "", Result_Code.F, errMsg);
                return(responseModel);
            }

            string storedProcedure = "RegisterMember";

            String[] Ary = new String[] {
                "数据0", "数据1", "数据2", "数据3", "数据4",
                "数据5", "数据6", "数据7", "数据8", "数据9",
                "数据10", "数据11", "数据12", "数据13", "数据14",
                "数据15", "数据16", "数据17", "数据18", "数据19",
                "数据20", "数据21", "数据22", "数据23", "数据24",
                "数据25", "数据26", "数据27"
            };

            List <object> listParas = new List <object>();

            listParas.Add(storeId);                         //StoreId
            listParas.Add(mobile);                          //Mobile
            listParas.Add(wechat);                          //WeChat
            listParas.Add(qq);                              //QQ
            listParas.Add(imme);                            //IMME

            listParas.Add(int.Parse(cardShape));            //CardShape
            listParas.Add(memberName);                      //MemberName
            listParas.Add("888888");                        //MemberPassword
            listParas.Add(birthday);                        //Birthday
            listParas.Add(gender);                          //Gender

            listParas.Add(identityCard);                    //IdentityCard
            listParas.Add(email);                           //EMail
            listParas.Add(leftHandCode);                    //LeftHandCode
            listParas.Add(rightHandCode);                   //RightHandCode
            listParas.Add(photo);                           //Photo

            listParas.Add(int.Parse(memberLevelId));        //MemberLevelId
            listParas.Add(int.Parse(foodId));               //FoodId
            listParas.Add(decimal.Parse(payCount));         //payCount
            listParas.Add(decimal.Parse(realPay));          //realPay
            listParas.Add(decimal.Parse(freePay));          //freePay

            listParas.Add(int.Parse(repeatCode));           //repeatCode
            listParas.Add(int.Parse(icCardId));             //icCardId
            listParas.Add(workStation);                     //workStation
            listParas.Add(int.Parse(userTokenModel.LogId)); //UserId
            listParas.Add(decimal.Parse(deposit));          //deposit

            listParas.Add((long)0);                         //icCardUID
            listParas.Add(int.Parse(payType));              //payType
            listParas.Add(int.Parse(saleCoinType));         //saleCoinType


            List <SqlDataRecord> listSqlDataRecord = new List <SqlDataRecord>();

            SqlMetaData[] MetaDataArr = new SqlMetaData[] {
                new SqlMetaData("StoreId", SqlDbType.VarChar, 15),
                new SqlMetaData("Mobile", SqlDbType.VarChar, 20),
                new SqlMetaData("WeChat", SqlDbType.VarChar, 64),
                new SqlMetaData("QQ", SqlDbType.VarChar, 64),
                new SqlMetaData("IMME", SqlDbType.VarChar, 64),

                new SqlMetaData("CardShape", SqlDbType.Int),
                new SqlMetaData("MemberName", SqlDbType.VarChar, 50),
                new SqlMetaData("MemberPassword", SqlDbType.VarChar, 20),
                new SqlMetaData("Birthday", SqlDbType.VarChar, 16),
                new SqlMetaData("Gender", SqlDbType.VarChar, 1),

                new SqlMetaData("IdentityCard", SqlDbType.VarChar, 50),
                new SqlMetaData("EMail", SqlDbType.VarChar, 50),
                new SqlMetaData("LeftHandCode", SqlDbType.VarChar, 5000),
                new SqlMetaData("RightHandCode", SqlDbType.VarChar, 5000),
                new SqlMetaData("Photo", SqlDbType.VarChar, 100),

                new SqlMetaData("MemberLevelId", SqlDbType.Int),
                new SqlMetaData("FoodId", SqlDbType.Int),
                new SqlMetaData("PayCount", SqlDbType.Decimal),
                new SqlMetaData("RealPay", SqlDbType.Decimal),
                new SqlMetaData("FreePay", SqlDbType.Decimal),

                new SqlMetaData("RepeatCode", SqlDbType.Int),
                new SqlMetaData("ICCardId", SqlDbType.Int),
                new SqlMetaData("WorkStation", SqlDbType.VarChar, 50),
                new SqlMetaData("UserId", SqlDbType.Int),
                new SqlMetaData("Deposit", SqlDbType.Decimal),

                new SqlMetaData("ICCardUID", SqlDbType.BigInt),
                new SqlMetaData("PayType", SqlDbType.Int),
                new SqlMetaData("SaleCoinType", SqlDbType.Int)
            };

            var record = new SqlDataRecord(MetaDataArr);

            for (int i = 0; i < Ary.Length; i++)
            {
                record.SetValue(i, listParas[i]);
            }
            listSqlDataRecord.Add(record);

            SqlParameter[] sqlParameter = new SqlParameter[4];
            sqlParameter[0]           = new SqlParameter("@RegisterMember", SqlDbType.Structured);
            sqlParameter[0].Value     = listSqlDataRecord;
            sqlParameter[1]           = new SqlParameter("@Note", SqlDbType.Text);
            sqlParameter[1].Value     = note;
            sqlParameter[2]           = new SqlParameter("@ErrMsg", SqlDbType.VarChar, 200);
            sqlParameter[2].Direction = ParameterDirection.Output;
            sqlParameter[3]           = new SqlParameter("@Result", SqlDbType.Int);
            sqlParameter[3].Direction = ParameterDirection.Output;
            System.Data.DataSet ds = XCCloudBLL.GetStoredProcedureSentence(storedProcedure, sqlParameter);
            if (sqlParameter[3].Value.ToString() == "1")
            {
                var baseMemberModel = Utils.GetModelList <BaseMemberModel>(ds.Tables[0]).ToList()[0];
                return(ResponseModelFactory <BaseMemberModel> .CreateModel(isSignKeyReturn, baseMemberModel));
            }
            else
            {
                return(new ResponseModel(Return_Code.T, "", Result_Code.F, sqlParameter[2].Value.ToString()));
            }
        }