Пример #1
0
        public static bool OpenSchedule(string dbName, int userId, string macAddress, string diskId, string workStation, out int currentSchedule, out string errMsg)
        {
            errMsg = string.Empty;
            string checkDate = System.DateTime.Now.ToString("yyyy-MM-dd");
            string sql       = "OpenSchedule";

            SqlParameter[] parameters = new SqlParameter[8];
            parameters[0]           = new SqlParameter("@CheckDate", checkDate);
            parameters[1]           = new SqlParameter("@UserId", userId);
            parameters[2]           = new SqlParameter("@macAddress", macAddress);
            parameters[3]           = new SqlParameter("@diskId", diskId);
            parameters[4]           = new SqlParameter("@workStation", workStation);
            parameters[5]           = new SqlParameter("@CurrentSchedule", 0);
            parameters[5].Direction = System.Data.ParameterDirection.Output;
            parameters[6]           = new SqlParameter("@OffLineUserId", 0);
            parameters[6].Direction = System.Data.ParameterDirection.Output;
            parameters[7]           = new SqlParameter("@ReturnValue", 0);
            parameters[7].Direction = System.Data.ParameterDirection.ReturnValue;
            XCGameBLL.ExecuteStoredProcedureSentence(sql, dbName, parameters);

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

            if (result >= 1)
            {
                currentSchedule = Convert.ToInt32(parameters[5].Value);
                return(true);
            }
            else
            {
                errMsg          = "开班出现错误";
                currentSchedule = 0;
                return(false);
            }
        }
Пример #2
0
        public object transICCardCoins(Dictionary <string, object> dicParas)
        {
            XCCloudManaUserTokenModel userTokenModel = (XCCloudManaUserTokenModel)(dicParas[Constant.XCGameManaUserToken]);

            string cardIdOut         = dicParas.ContainsKey("cardIdOut") ? dicParas["cardIdOut"].ToString() : string.Empty;
            string cardIdOutPassword = dicParas.ContainsKey("cardIdOutPassword") ? dicParas["cardIdOutPassword"].ToString() : string.Empty;
            string cardIdIn          = dicParas.ContainsKey("cardIdIn") ? dicParas["cardIdIn"].ToString() : string.Empty;
            string coins             = dicParas.ContainsKey("coins") ? dicParas["coins"].ToString() : string.Empty;
            string mobileName        = dicParas.ContainsKey("mobileName") ? dicParas["mobileName"].ToString() : string.Empty;

            StoreBusiness   store         = new StoreBusiness();
            string          errMsg        = string.Empty;
            StoreCacheModel storeModel    = null;
            StoreBusiness   storeBusiness = new StoreBusiness();

            if (!storeBusiness.IsEffectiveStore(userTokenModel.StoreId, ref storeModel, out errMsg))
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
            }

            if (storeModel.StoreDBDeployType == 0)
            {
                string         storeProc  = "TransICCardCoins";
                SqlParameter[] parameters = new SqlParameter[8];
                parameters[0]           = new SqlParameter("@CardIdOut", cardIdOut);
                parameters[1]           = new SqlParameter("@CardIdOutPassword", cardIdOutPassword);
                parameters[2]           = new SqlParameter("@CardIdIn", cardIdIn);
                parameters[3]           = new SqlParameter("@Coins", coins);
                parameters[4]           = new SqlParameter("@UserId", userTokenModel.XCGameUserId);
                parameters[5]           = new SqlParameter("@Mobile", userTokenModel.Mobile);
                parameters[6]           = new SqlParameter("@ErrMsg", System.Data.SqlDbType.VarChar, 200);
                parameters[6].Direction = System.Data.ParameterDirection.Output;
                parameters[7]           = new SqlParameter("@Return", 0);
                parameters[7].Direction = System.Data.ParameterDirection.ReturnValue;

                XCGameBLL.ExecuteStoredProcedureSentence(storeProc, storeModel.StoreDBName, parameters);
                if (Convert.ToInt32(parameters[7].Value) == 1)
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, parameters[6].Value.ToString()));
                }
            }
            else if (storeModel.StoreDBDeployType == 1)
            {
                string sn = System.Guid.NewGuid().ToString().Replace("-", "");
                UDPSocketCommonQueryAnswerModel answerModel = null;
                string radarToken = string.Empty;
                if (DataFactory.SendMemberTransOperate(sn, storeModel.StoreID.ToString(), storeModel.StorePassword, mobileName, userTokenModel.Mobile, cardIdIn, cardIdOut, int.Parse(coins), out radarToken, out errMsg))
                {
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, errMsg));
                }

                answerModel = null;
                int whileCount = 0;
                while (answerModel == null && whileCount <= 25)
                {
                    //获取应答缓存数据
                    whileCount++;
                    System.Threading.Thread.Sleep(1000);
                    answerModel = UDPSocketCommonQueryAnswerBusiness.GetAnswerModel(sn, 1);
                }

                if (answerModel != null)
                {
                    MemberTransOperateResultNotifyRequestModel model = (MemberTransOperateResultNotifyRequestModel)(answerModel.Result);
                    //移除应答缓存数据
                    UDPSocketCommonQueryAnswerBusiness.Remove(sn);

                    if (model.Result_Code == "1")
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.T, ""));
                    }
                    else
                    {
                        return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, model.Result_Msg));
                    }
                }
                else
                {
                    return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "系统没有响应"));
                }
            }
            else
            {
                return(ResponseModelFactory.CreateModel(isSignKeyReturn, Return_Code.T, "", Result_Code.F, "门店设置错误"));
            }
        }