Exemple #1
0
        public async Task <OldPostParam_Out> OldPost_SetUserSetting(SetUserSetting_IN pIn)
        {
            OldPostParam_Out pOut = new OldPostParam_Out();

            pOut.errStr = no_err;
            try
            {
                if (string.IsNullOrWhiteSpace(pIn.strUserCode)) // pIn.strUserCode == null || pIn.strUserCode == "" || pIn.strUserCode == string.Empty)
                {
                    pOut.errStr = "The usercode is null.";
                    pOut.bRet   = false;
                    return(pOut);
                }

                if (string.IsNullOrWhiteSpace(pIn.strSettingtype))// == null || pIn.strSettingtype == "" || pIn.strSettingtype == string.Empty)
                {
                    pOut.errStr = "The setting type is null.";
                    pOut.bRet   = false;
                    return(pOut);
                }

                await _GlobalManager.UpdateUserSettingAsync(pIn.strUserCode, pIn.strSettingtype, pIn.strSettingText);

                pOut.bRet = true;
            }
            catch (Exception ex)//其他未知的异常,写异常日志
            {
                pOut.errStr = ex.Message;
                Logger.Error("Post_SetUserSetting : " + ex.ToString());
                pOut.bRet = false;
            }
            return(pOut);
        }
Exemple #2
0
        public async Task <ResponseMessage> Post_SetUserSetting([FromBody] SetUserSetting_IN pIn)
        {
            ResponseMessage Response = new ResponseMessage();

            try
            {
                if (string.IsNullOrWhiteSpace(pIn.strUserCode))
                {
                    Response.Msg  = "The usercode is null.";
                    Response.Code = ResponseCodeDefines.ArgumentNullError;
                    return(Response);
                }
                if (string.IsNullOrWhiteSpace(pIn.strSettingtype))
                {
                    Response.Msg  = "The setting type is null.";
                    Response.Code = ResponseCodeDefines.ArgumentNullError;
                    return(Response);
                }

                await _GlobalManager.UpdateUserSettingAsync(pIn.strUserCode, pIn.strSettingtype, pIn.strSettingText);

                Response.Code = ResponseCodeDefines.SuccessCode;
            }
            catch (Exception e)                               //其他未知的异常,写异常日志
            {
                if (e.GetType() == typeof(SobeyRecException)) //sobeyexcep会自动打印错误
                {
                    SobeyRecException se = e as SobeyRecException;
                    Response.Code = se.ErrorCode.ToString();
                    Response.Msg  = se.Message;
                }
                else
                {
                    Response.Code = ResponseCodeDefines.ServiceError;
                    Response.Msg  = "error info:" + e.ToString();
                    Logger.Error(Response.Msg);
                }
            }
            return(Response);
        }