Example #1
0
        public static bool UserUpdate(string username, string userpass, string newname, string newpass)
        {
            var input = new UserUpdateInput()
            {
                UserName = username,
                UserPass = userpass,
                NewName  = newname,
                NewPass  = newpass,
            };
            var json = JsonConvert.SerializeObject(input);

            string output = null;

            try
            {
                output = HttpReader.HttpPost(ApiDef.UserUpdate, json);
            }
            catch (System.AggregateException)
            {
                return(false);
            }

            var result = JsonConvert.DeserializeObject <UserUpdateOutput>(output);

            return(ResultStatus.IsSuccess(result.ResultStatus));
        }
Example #2
0
        public static bool UserCreate(string username, string pass, ref int userid)
        {
            var input = new UserCreateInput()
            {
                UserName = username,
                UserPass = pass,
            };
            var json = JsonConvert.SerializeObject(input);

            string output = null;

            try
            {
                output = HttpReader.HttpPost(ApiDef.UserCreate, json);
            }
            catch (AggregateException)
            {
                return(false);
            }

            var result    = JsonConvert.DeserializeObject <UserCreateOutput>(output);
            var issuccess = ResultStatus.IsSuccess(result.ResultStatus);

            if (issuccess)
            {
                userid = result.UserId;
            }
            return(issuccess);
        }
Example #3
0
        public static bool  UserNotebook(string username, string userpass, ref List <int> notebooklist)
        {
            var input = new UserNotebookInput()
            {
                UserName = username,
                UserPass = userpass,
            };
            var json = JsonConvert.SerializeObject(input);

            string output = null;

            try
            {
                output = HttpReader.HttpPost(ApiDef.UserNotebook, json);
            }
            catch (System.AggregateException)
            {
                return(false);
            }

            var result    = JsonConvert.DeserializeObject <UserNotebookOutput>(output);
            var issuccess = ResultStatus.IsSuccess(result.ResultStatus);

            if (issuccess)
            {
                notebooklist = result.NotebookList;
            }
            return(issuccess);
        }
Example #4
0
        public static bool NotebookList(int notebookid, string notebookpass, ref List <int> notelist)
        {
            var input = new NotebookListInput()
            {
                NotebookId   = notebookid,
                NotebookPass = notebookpass,
            };
            var json = JsonConvert.SerializeObject(input);


            string output = null;

            try
            {
                output = HttpReader.HttpPost(ApiDef.NotebookList, json);
            }
            catch (AggregateException)
            {
                return(false);
            }

            var result    = JsonConvert.DeserializeObject <NotebookListOutput>(output);
            var issuccess = ResultStatus.IsSuccess(result.ResultStatus);

            if (issuccess)
            {
                notelist = result.NoteList;
            }
            return(issuccess);
        }
Example #5
0
        public static bool NoteGet(int notebookid, string notebookpass, int noteid, ref Tuple <int, string, string> note)
        {
            var input = new NoteGetInput()
            {
                NotebookId   = notebookid,
                NotebookPass = notebookpass,
                NoteId       = noteid,
            };
            var json = JsonConvert.SerializeObject(input);

            string output = null;

            try
            {
                output = HttpReader.HttpPost(ApiDef.NoteGet, json);
            }
            catch (AggregateException)
            {
                return(false);
            }

            var result    = JsonConvert.DeserializeObject <NoteGetOutput>(output);
            var issuccess = ResultStatus.IsSuccess(result.ResultStatus);

            if (issuccess)
            {
                note = Tuple.Create(result.Result.type, result.Result.name, result.Result.data);
            }
            return(issuccess);
        }
Example #6
0
        public static bool NotebookGet(int notebookid, ref Tuple <string, int> info)
        {
            var input = new NotebookGetInput()
            {
                NotebookId = notebookid,
            };
            var json = JsonConvert.SerializeObject(input);

            string output = null;

            try
            {
                output = HttpReader.HttpPost(ApiDef.NotebookGet, json);
            }
            catch (AggregateException)
            {
                return(false);
            }

            var result    = JsonConvert.DeserializeObject <NotebookGetOutput>(output);
            var issuccess = ResultStatus.IsSuccess(result.ResultStatus);

            if (issuccess)
            {
                info = Tuple.Create(result.NotebookName, result.NoteSum);
            }
            return(issuccess);
        }
Example #7
0
        public static bool NoteCreate(int notebookid, string notebookpass, string notename, int type, string notedate, ref int noteid)
        {
            var input = new NoteCreateInput()
            {
                NotebookId   = notebookid,
                NotebookPass = notebookpass,
                NoteName     = notename,
                NoteType     = type,
                NoteData     = notedate,
            };
            var json = JsonConvert.SerializeObject(input);

            string output = null;

            try
            {
                output = HttpReader.HttpPost(ApiDef.NoteCreate, json);
            }
            catch (AggregateException)
            {
                return(false);
            }

            var result    = JsonConvert.DeserializeObject <NoteCreateOutput>(output);
            var issuccess = ResultStatus.IsSuccess(result.ResultStatus);

            if (issuccess)
            {
                noteid = result.NoteId;
            }
            return(issuccess);
        }
Example #8
0
        public static bool NoteMove(int fromid, string frompass, int toid, string topass, int noteid)
        {
            var input = new NoteMoveInput()
            {
                FromId   = fromid,
                FromPass = frompass,
                ToId     = toid,
                ToPass   = topass,
                NoteId   = noteid,
            };
            var json = JsonConvert.SerializeObject(input);

            string output = null;

            try
            {
                output = HttpReader.HttpPost(ApiDef.NoteMove, json);
            }
            catch (AggregateException)
            {
                return(false);
            }

            var result = JsonConvert.DeserializeObject <NoteMoveOutput>(output);

            return(ResultStatus.IsSuccess(result.ResultStatus));
        }
Example #9
0
        public static bool NotebookUpdate(int notebookid, string notebookpass, string newname, string newpass)
        {
            var input = new NotebookUpdateInput()
            {
                NotebookId   = notebookid,
                NotebookPass = notebookpass,
                NewName      = newname,
                NewPass      = newpass,
            };
            var json = JsonConvert.SerializeObject(input);

            string output = null;

            try
            {
                output = HttpReader.HttpPost(ApiDef.NotebookUpdate, json);
            }
            catch (AggregateException)
            {
                return(false);
            }

            var result = JsonConvert.DeserializeObject <NotebookUpdateOutput>(output);

            return(ResultStatus.IsSuccess(result.ResultStatus));
        }
Example #10
0
        public IHttpActionResult ForgotPassword([FromBody] string Email)
        {
            ResultStatus rs            = new ResultStatus();
            string       generatedCode = string.Empty;

            generatedCode = forgotFacade.getGeneratedCode(Email);
            if (repo.User.GetData().Any(x => x.Email.Equals(Email)))
            {
                rs = repo.ForgotPassword.InsertGeneratedCode(Email, generatedCode);
                if (rs.IsSuccess())
                {
                    rs = forgotFacade.SendEmail(repo.User.GetData().Where(x => x.Email.Equals(Email)).FirstOrDefault(), generatedCode);
                }
            }
            if (!rs.IsSuccess())
            {
                return(NotFound());
            }
            return(Ok());
        }
Example #11
0
        // POST: api/Test;
        public IHttpActionResult UserLogin([FromBody] LoginRequest param)
        {
            ResultStatus rs       = new ResultStatus();
            Identity     identity = new Identity();

            rs = identity.Login(param);
            if (!rs.IsSuccess())
            {
                return(Ok(rs));
            }
            return(Ok());
        }
Example #12
0
        public static bool NotebookDelete(int notebookid, string notebookpass)
        {
            var input = new NotebookDeleteInput()
            {
                NotebookId   = notebookid,
                NotebookPass = notebookpass,
            };
            var json   = JsonConvert.SerializeObject(input);
            var output = HttpReader.HttpPost(ApiDef.NotebookDelete, json);

            var result = JsonConvert.DeserializeObject <NotebookDeleteOutput>(output);

            return(ResultStatus.IsSuccess(result.ResultStatus));
        }
Example #13
0
        public static bool UserUpdate(string username, string userpass, string newname, string newpass)
        {
            var input = new UserUpdateInput()
            {
                UserName = username,
                UserPass = userpass,
                NewName  = newname,
                NewPass  = newpass,
            };
            var json   = JsonConvert.SerializeObject(input);
            var output = HttpReader.HttpPost(ApiDef.UserUpdate, json);

            var result = JsonConvert.DeserializeObject <UserUpdateOutput>(output);

            return(ResultStatus.IsSuccess(result.ResultStatus));
        }
Example #14
0
        public static bool NoteUpdate(int notebookid, string notebookpass, int noteid, string newname, int newtype, string newdate)
        {
            var input = new NoteUpdateInput()
            {
                NotebookId   = notebookid,
                NotebookPass = notebookpass,
                NoteId       = noteid,
                NewName      = newname,
                NewType      = newtype,
                NewData      = newdate,
            };
            var json   = JsonConvert.SerializeObject(input);
            var output = HttpReader.HttpPost(ApiDef.NoteUpdate, json);

            var result = JsonConvert.DeserializeObject <NoteUpdateOutput>(output);

            return(ResultStatus.IsSuccess(result.ResultStatus));
        }
Example #15
0
        public static bool NotebookGet(int notebookid, string notebookpass, ref Tuple <string, int> info)
        {
            var input = new NotebookGetInput()
            {
                NotebookId   = notebookid,
                NotebookPass = notebookpass,
            };
            var json   = JsonConvert.SerializeObject(input);
            var output = HttpReader.HttpPost(ApiDef.NotebookGet, json);

            var result    = JsonConvert.DeserializeObject <NotebookGetOutput>(output);
            var issuccess = ResultStatus.IsSuccess(result.ResultStatus);

            if (issuccess)
            {
                info = Tuple.Create(result.NotebookName, result.NoteSum);
            }
            return(issuccess);
        }
Example #16
0
        public static bool NoteGet(int notebookid, string notebookpass, int noteid, ref Note note)
        {
            var input = new NoteGetInput()
            {
                NotebookId   = notebookid,
                NotebookPass = notebookpass,
                NoteId       = noteid,
            };
            var json   = JsonConvert.SerializeObject(input);
            var output = HttpReader.HttpPost(ApiDef.NoteGet, json);

            var result    = JsonConvert.DeserializeObject <NoteGetOutput>(output);
            var issuccess = ResultStatus.IsSuccess(result.ResultStatus);

            if (issuccess)
            {
                note = result.Result;
            }
            return(issuccess);
        }
Example #17
0
        public static bool NotebookCreate(string username, string userpass, string notebookname, string notebookpass, ref int id)
        {
            var input = new NotebookCreateInput()
            {
                UserName     = username,
                UserPass     = userpass,
                NotebookName = notebookname,
                NotebookPass = notebookpass,
            };
            var json   = JsonConvert.SerializeObject(input);
            var output = HttpReader.HttpPost(ApiDef.NotebookCreate, json);

            var result    = JsonConvert.DeserializeObject <NotebookCreateOutput>(output);
            var issuccess = ResultStatus.IsSuccess(result.ResultStatus);

            if (issuccess)
            {
                id = result.NotebookId;
            }
            return(issuccess);
        }