예제 #1
0
        /// <summary>
        /// InfoUpdate
        /// </summary>
        /// <param name="sex"></param>
        /// <param name="age"></param>
        /// <param name="nickname"></param>
        /// <param name="homePageUrl"></param>
        /// <param name="note"></param>
        /// <param name="contryId"></param>
        /// <param name="privenceId"></param>
        /// <param name="cityId"></param>
        /// <param name="districtId"></param>
        /// <param name="streetId"></param>
        /// <param name="photo"></param>
        /// <param name="homeTel"></param>
        /// <param name="workTel"></param>
        /// <param name="otherTel"></param>
        /// <param name="fax"></param>
        /// <param name="otherEmail"></param>
        /// <param name="homeArea"></param>
        /// <param name="workArea"></param>
        /// <param name="otherArea"></param>
        /// <param name="qq"></param>
        /// <param name="msn"></param>
        /// <param name="otherIm"></param>
        /// <param name="brithday"></param>
        /// <param name="org"></param>
        /// <param name="title"></param>
        /// <param name="ring"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool InfoUpdate(string sex, int age, string nickname, string homePageUrl, string note, string contryId, string privenceId, string cityId, string districtId, string streetId, string photo, string homeTel, string workTel, string otherTel, string fax, string otherEmail, string homeArea, string workArea, string otherArea, string qq, string msn, string otherIm, string brithday, string org, string title, string ring, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();

            tokenInfoUpdate = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}InfoUpdate?sex={1}&age={2}&nickname={3}&homePageUrl={4}&note={5}&contryId={6}&privenceId={7}&cityId={8}&districtId={9}&streetId={10}&photo={11}&homeTel={13}&workTel={14}&otherTel={15}&fax={16}&otherEmail={17}&&homeArea={18}&workArea={19}&otherArea={20}&qq={21}&msn={22}&otherIm={23}&brithday={24}&org={25}&title={26}&ring={27}", this.RequestAddress, sex, age, nickname, homePageUrl, note, contryId, privenceId, cityId, districtId, streetId, photo, homeTel, workTel, otherTel, fax, otherEmail, homeArea, workArea, otherArea, qq, msn, otherIm, brithday, org, title, ring);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenInfoUpdate, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenInfoUpdate.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #2
0
        /// <summary>
        /// Add
        /// </summary>
        /// <param name="albumName"></param>
        /// <param name="description"></param>
        /// <param name="passport"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool Add(string albumName, string description, string passport, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();

            tokenAdd = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}addUserAlbumInfo?passport={1}&albumName={2}&description={3}", this.RequestAddress, passport, albumName, description);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenAdd, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenAdd.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #3
0
        /// <summary>
        /// Login
        /// </summary>
        /// <param name="email"></param>
        /// <param name="pwd"></param>
        /// <param name="expires"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool Login(string email, string pwd, int expires, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();

            tokenLogin = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}Login?email={1}&pwd={2}&expires={3}", this.RequestAddress, email, pwd, expires);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenLogin, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenLogin.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #4
0
        /// <summary>
        /// ImeiUpdate
        /// </summary>
        /// <param name="email"></param>
        /// <param name="oldImei"></param>
        /// <param name="imei"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool ImeiUpdate(string email, string oldImei, string imei, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();

            tokenImeiUpdate = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}ImeiUpdate?email={1}&oldImei={2}&imei={3}", this.RequestAddress, email, oldImei, imei);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenImeiUpdate, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenImeiUpdate.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #5
0
        /// <summary>
        /// Register
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="imei"></param>
        /// <param name="email"></param>
        /// <param name="pwd"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool Register(string mobile, string imei, string email, string pwd, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();

            tokenRegister = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}Register?mobile={1}&imei={2}&email={3}&pwd={4}", this.RequestAddress, mobile, imei, email, pwd);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenRegister, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenRegister.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #6
0
        /// <summary>
        /// InnerMsgPictureSend
        /// </summary>
        /// <param name="innermsgPictures"></param>
        /// <param name="innermsgNo"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool InnerMsgPictureSend(string innermsgPictures, string innermsgNo, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();

            tokenInnerMsgPictureSend = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}InnerMsgPictureSend?innermsgPictures={1}&innermsgNo={2}", this.RequestAddress, innermsgPictures, innermsgNo);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenInnerMsgPictureSend, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenInnerMsgPictureSend.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #7
0
        /// <summary>
        /// SysAlertsDel
        /// </summary>
        /// <param name="sysAlertIds"></param>
        /// <param name="email"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool SysAlertsDel(string sysAlertIds, string email, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();

            tokenSysAlertsDel = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}SysAlertsDel?sysAlertIds={1}&email={2}", this.RequestAddress, sysAlertIds, email);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenSysAlertsDel, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenSysAlertsDel.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #8
0
        /// <summary>
        /// PhotoAdd
        /// </summary>
        /// <param name="photoDescription"></param>
        /// <param name="photoName"></param>
        /// <param name="mime"></param>
        /// <param name="oriFileName"></param>
        /// <param name="photoData"></param>
        /// <param name="passport"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool PhotoAdd(string photoDescription, string photoName, string mime, string oriFileName, string photoData, string passport, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();

            tokenPhotoAdd = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}addUserPhotoInfo?photoDescription={1}photoName&={2}mime&={3}oriFileName&={4}photoData&={5}passport={6}", this.RequestAddress, photoDescription, photoName, mime, oriFileName, photoData, passport);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenPhotoAdd, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenPhotoAdd.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #9
0
        /// <summary>
        /// PhotosDel
        /// </summary>
        /// <param name="photoIds"></param>
        /// <param name="albumId"></param>
        /// <param name="passport"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool PhotosDel(string photoIds, string albumId, string passport, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();

            tokenPhotosDel = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}deleteUserPhotoInfo?passport={1}&photoIds={2}&albumId={3}", this.RequestAddress, passport, photoIds, albumId);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenPhotosDel, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenPhotosDel.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #10
0
        /// <summary>
        /// CommentAdd
        /// </summary>
        /// <param name="photoId"></param>
        /// <param name="commentContent"></param>
        /// <param name="commentTime"></param>
        /// <param name="passport"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool CommentAdd(string photoId, string commentContent, string commentTime, string passport, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();

            tokenCommentAdd = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}addUserPhotoComment?passport={1}&photoId={2}&commentContent={3}&commentTime={4}", this.RequestAddress, passport, photoId, commentContent, commentTime);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenCommentAdd, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenCommentAdd.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #11
0
        /// <summary>
        /// UserMsgsAdd
        /// </summary>
        /// <param name="usermsg"></param>
        /// <param name="srcEmail"></param>
        /// <param name="distEmail"></param>
        /// <param name="email"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool UserMsgsAdd(string usermsg, string srcEmail, string distEmail, out Result result)
        {
            BeefWrapNet net = new BeefWrapNet();

            tokenUserMsgsAdd = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}UserMsgsAdd?usermsg={1}&srcEmail={2}&distEmail={3}", this.RequestAddress, usermsg, srcEmail, distEmail);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenUserMsgsAdd, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenUserMsgsAdd.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #12
0
파일: FrmMain.cs 프로젝트: windygu/haina
        string tokenRWAsync = "";// 标识请求的唯一令牌

        private void btnTestASync_Click(object sender, EventArgs e)
        {
            try
            {
                BeefWrapNet net = new BeefWrapNet();
                this.tokenRWAsync = NetUtility.GetNextToken();
                // 异步请求
                net.HttpPostRequestAsync(url + @"/app", this.tokenRWAsync, new RequestPreCallBack(RequestPreRWAsync), new RequestWriteCallBack(RequestWriteRWAsync), new ResponseReadCallBack(ResponseReadRWAsync), new MessageCallBack(MessageRWAsync));
            }
            catch { }
        }
예제 #13
0
파일: FrmMain.cs 프로젝트: windygu/haina
        string tokenRW = "";// 标识请求的唯一令牌

        private void btnTestSync_Click(object sender, EventArgs e)
        {
            this.btnTestSync.Enabled = false;
            try
            {
                BeefWrapNet net = new BeefWrapNet();
                this.tokenRW = NetUtility.GetNextToken();
                // 同步请求
                net.HttpPostRequest(url + @"/app", this.tokenRW, new RequestPreCallBack(RequestPreRW), new RequestWriteCallBack(RequestWriteRW), new ResponseReadCallBack(ResponseReadRW), new MessageCallBack(MessageRW));
            }
            catch { }
            this.btnTestSync.Enabled = true;
        }
예제 #14
0
        /// <summary>
        /// PhotoView
        /// </summary>
        /// <param name="photoId"></param>
        /// <param name="albumId"></param>
        /// <param name="curPage"></param>
        /// <param name="pageSize"></param>
        /// <param name="passport"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool PhotoView(string photoId, string albumId, int curPage, int pageSize, string passport, out Result result)
        {
            string nameBase = string.Format("{0}_PhotoView_{1}_{2}_{3}", Command.C_ALBUM_PHOTO_VIEW_REQUEST, passport, photoId, albumId);
            string name     = string.Format("{0}_{1}_{2}", nameBase, curPage, pageSize);

            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return(true);
            }

            BeefWrapNet net = new BeefWrapNet();

            tokenPhotoView = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}getUserPhotoInfo?passport={1}photoId={2}&albumId={3}&curPage={4}&pageSize={5}", this.RequestAddress, passport, photoId, albumId, curPage, pageSize);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenPhotoView, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenPhotoView.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (curPage == 1)
                    {
                        DeleteCacheLike(nameBase);
                    }
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #15
0
        /// <summary>
        /// AppHotList
        /// </summary>
        /// <param name="curPage"></param>
        /// <param name="pageSize"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool AppHotList(int curPage, int pageSize, out Result result)
        {
            string nameBase = string.Format("{0}_AppHotList", Command.C_APP_HOT_LIST_REQUEST);
            string name     = string.Format("{0}_{1}_{2}", nameBase, curPage, pageSize);

            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return(true);
            }

            BeefWrapNet net = new BeefWrapNet();

            tokenAppHotList = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}AppHotList?curPage={1}&pageSize={2}", this.RequestAddress, curPage, pageSize);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenAppHotList, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenAppHotList.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (curPage == 1)
                    {
                        DeleteCacheLike(nameBase);
                    }
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #16
0
파일: FrmMain.cs 프로젝트: windygu/haina
        string tokenUp = "";// 标识下载的唯一令牌

        private void btnUpFile_Click(object sender, EventArgs e)
        {
            this.btnUpFile.Enabled  = false;
            this.progressBar1.Value = 0;
            try
            {
                BeefWrapNet net = new BeefWrapNet();
                this.tokenUp = NetUtility.GetNextToken();
                // 异步上传
                net.HttpPostRequestAsync(upUrl, this.tokenUp, new RequestPreCallBack(RequestPreUp), new RequestWriteCallBack(RequestWriteUp), null, new MessageCallBack(MessageUp));
            }
            catch { }
            this.btnUpFile.Enabled = true;
        }
예제 #17
0
파일: FrmMain.cs 프로젝트: windygu/haina
        string tokenDownLoad = "";// 标识下载的唯一令牌

        private void btnDownLoad_Click(object sender, EventArgs e)
        {
            this.btnDownLoad.Enabled = false;
            this.progressBar1.Value  = 0;
            try
            {
                BeefWrapNet net = new BeefWrapNet();
                this.tokenDownLoad = NetUtility.GetNextToken();
                // 异步下载
                net.HttpGetRequestAsync(picUrl, this.tokenDownLoad, null, null, new ResponseReadCallBack(ResponseReadDownLoad), new MessageCallBack(MessageDownLoad));
            }
            catch { }
            this.btnDownLoad.Enabled = true;
        }
예제 #18
0
        /// <summary>
        /// WeekWeather
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool WeekWeather(string mobile, out Result result)
        {
            string name = string.Format("{0}_WeekWeather_{1}", Command.C_USER_WEEK_WEATHER_REQUEST, mobile);

            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return(true);
            }

            BeefWrapNet net = new BeefWrapNet();

            tokenWeekWeather = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}WeekWeather?mobile={1}", this.RequestAddress, mobile);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenWeekWeather, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenWeekWeather.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #19
0
        /// <summary>
        /// Sync
        /// </summary>
        /// <param name="email"></param>
        /// <param name="contacts"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool Sync(string email, string contacts, out Result result)
        {
            string name = string.Format("{0}_Sync_{1}_{2}", Command.C_CONTACT_SYNC_REQUEST, email, contacts);

            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return(true);
            }

            BeefWrapNet net = new BeefWrapNet();

            tokenSync = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}Sync?email={1}&contacts={2}", this.RequestAddress, email, contacts);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenSync, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenSync.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #20
0
        /// <summary>
        /// InnerMsgsReceive
        /// </summary>
        /// <param name="srcEmail"></param>
        /// <param name="distEmail"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool InnerMsgsReceive(string srcEmail, string distEmail, out Result result)
        {
            string name = string.Format("{0}_InnerMsgsReceive_{1}_{2}", Command.C_INNERMSGS_RECEIVE_REQUEST, srcEmail, distEmail);

            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return(true);
            }

            BeefWrapNet net = new BeefWrapNet();

            tokenInnerMsgsReceive = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}InnerMsgsReceive?srcEmail={1}&distEmail={2}", this.RequestAddress, srcEmail, distEmail);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenInnerMsgsReceive, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenInnerMsgsReceive.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #21
0
        /// <summary>
        /// UserIdCheck
        /// </summary>
        /// <param name="contactMobile"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool UserIdCheck(string contactMobile, out Result result)
        {
            string name = string.Format("{0}_UserIdCheck_{1}", Command.C_CONTACT_USERID_CHECK_REQUEST, contactMobile);

            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return(true);
            }

            BeefWrapNet net = new BeefWrapNet();

            tokenUserIdCheck = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}UserIdCheck?contactMobile={1}", this.RequestAddress, contactMobile);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenUserIdCheck, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenUserIdCheck.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #22
0
        /// <summary>
        /// UserMsgsReply
        /// </summary>
        /// <param name="usermsgId"></param>
        /// <param name="usermsgReplying"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool UserMsgsReply(string usermsgId, string usermsgReplying, out Result result)
        {
            string name = string.Format("{0}_UserMsgsReply_{1}_{2}", Command.C_USERMSG_REPLY_REQUEST, usermsgId, usermsgReplying);

            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return(true);
            }

            BeefWrapNet net = new BeefWrapNet();

            tokenUserMsgsReply = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}UserMsgsReply?usermsgId={1}&usermsgReplying={2}", this.RequestAddress, usermsgId, usermsgReplying);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenUserMsgsReply, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenUserMsgsReply.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp, false);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #23
0
        /// <summary>
        /// AppCatalog
        /// </summary>
        /// <param name="appCatalogParentId"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool AppCatalog(string appCatalogParentId, out Result result)
        {
            string name = string.Format("{0}_AppCatalog_{1}", Command.C_APP_CATALOG_REQUEST, appCatalogParentId);

            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return(true);
            }

            BeefWrapNet net = new BeefWrapNet();

            tokenAppCatalog = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}AppCatalog?appCatalogParentId={1}", this.RequestAddress, appCatalogParentId);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenAppCatalog, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenAppCatalog.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #24
0
        /// <summary>
        /// Locate
        /// </summary>
        /// <param name="mobile"></param>
        /// <param name="mcc"></param>
        /// <param name="mnc"></param>
        /// <param name="lac"></param>
        /// <param name="cid"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool Locate(string mobile, string mcc, string mnc, string lac, string cid, out Result result)
        {
            string name = string.Format("{0}_Locate_{1}_{2}_{3}_{4}_{5}", Command.C_USER_LOCATE_SYNC_REQUEST, mobile, mcc, mnc, lac, cid);

            // 读取缓存
            if (ReadCache(name, out result))
            {
                result = new Result();
                return(true);
            }

            BeefWrapNet net = new BeefWrapNet();

            tokenLocate = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}Locate?mobile={1}&mcc={2}&mnc={3}&lac={4}&cid={5}", this.RequestAddress, mobile, mcc, mnc, lac, cid);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenLocate, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenLocate.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            if (null == resultTmp)
            {
                resultTmp = new Result();
            }
            result = resultTmp;
            return(boolRtn);
        }
예제 #25
0
        /// <summary>
        /// Exist
        /// </summary>
        /// <param name="email"></param>
        /// <param name="mobile"></param>
        /// <param name="result"></param>
        /// <returns></returns>
        public bool Exist(string email, string mobile, out Result result)
        {
            // 读缓存
            string name = string.Format("{0}_Exist_{1}_{2}", Command.C_USER_EXIST_CHECK_REQUEST, email, mobile);

            if (ReadCache(name, out result))
            {
                return(true);
            }

            BeefWrapNet net = new BeefWrapNet();

            tokenExist = NetUtility.GetNextToken();

            // 同步请求
            string url       = string.Format("{0}Exist?email={1}&mobile={2}", this.RequestAddress, email, mobile);
            Result resultTmp = null;

            bool boolRtn = net.HttpGetRequest(url, tokenExist, null, null, new ResponseReadCallBack(delegate(string token, ref Stream stream, HttpWebResponse response)
            {
                if (!tokenExist.Equals(token))
                {
                    throw new Exception("令牌过期,取消操作");
                }

                // 读基本类型
                this.ReadResult(ref stream, out resultTmp);

                // 写缓存
                if (HttpStatusCode.OK.Equals(resultTmp.StatusCode))
                {
                    if (!WriteCache(name, ExpireSeconds, resultTmp))
                    {
                        DeleteCache(name);
                    }
                }
            }), null);

            result = resultTmp;
            if (null == result)
            {
                result = new Result();
            }
            return(boolRtn);
        }