Example #1
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()));
            }
        }
Example #2
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, "会员卡无效"));
            }
        }
Example #3
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);
            }
        }
Example #4
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()));
            }
        }
Example #5
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()));
            }
        }