Esempio n. 1
0
        public MethodResponse GetUsersForWCF()
        {
            MethodResponse methodresponse = new MethodResponse();
            try
            {
                List<User> users = GetUsers();
                methodresponse.Type = MethodResponse.ResponseType.Succeed;
                methodresponse.ResultText = users.Count + "User Listed";
                methodresponse.Object = users;
            }
            catch (Exception ex)
            {
                CustomException custom_exception = new CustomException()
                {
                    Exception = ex,
                    ExceptionTime = DateTime.Now,
                    Parameters = "",
                    HelpLink = "",
                    User = "",
                    MethodName = "GetUsersForWCF"
                };
                CustomExceptionDB custom_exceptionDB = new CustomExceptionDB();
                bool isSaved = custom_exceptionDB.SaveException(custom_exception);
                if (isSaved == true)
                {
                    //..
                }
                methodresponse.Object = null;
                methodresponse.Type = MethodResponse.ResponseType.Error;
                methodresponse.ResultText = "An Error Occurred While Getting User List";

            }
            return methodresponse;
        }
Esempio n. 2
0
        public MethodResponse GetPublisherByIdForWCF(int _id)
        {
            MethodResponse methodresponse = new MethodResponse();
            try
            {
                Publisher getpublisheridbyid = GetPublisherById(_id);
                methodresponse.Type = MethodResponse.ResponseType.Succeed;
                methodresponse.ResultText = "Publisher  Found That Id Number is" + getpublisheridbyid.PublisherId;
                methodresponse.Object = getpublisheridbyid;
            }
            catch (Exception ex)
            {
                CustomException custom_exception = new CustomException()
                {
                    Exception = ex,
                    ExceptionTime = DateTime.Now,
                    Parameters = "",
                    HelpLink = "",
                    User = "",
                    MethodName = "GetPublisherByIdForWCF"
                };
                CustomExceptionDB custom_exceptionDB = new CustomExceptionDB();
                bool isSaved = custom_exceptionDB.SaveException(custom_exception);
                if (isSaved == true)
                {
                    //..
                }
                methodresponse.Object = null;
                methodresponse.Type = MethodResponse.ResponseType.Error;
                methodresponse.ResultText = "An Error Occurred While Getting Publisher  By Id";



            }
            return methodresponse;
        }
Esempio n. 3
0
        public MethodResponse DeletePublisherForWCF(int _publisherId)
        {
            MethodResponse methodresponse = new MethodResponse();
            try
            {
                Publisher deletepublisher = DeletePublisher(_publisherId);
                methodresponse.Type = MethodResponse.ResponseType.Succeed;
                methodresponse.ResultText = "Publisher  Deleted";
                methodresponse.Object = deletepublisher;
            }
            catch (Exception ex)
            {
                CustomException custom_exception = new CustomException()
                {
                    Exception = ex,
                    ExceptionTime = DateTime.Now,
                    Parameters = "",
                    HelpLink = "",
                    User = "",
                    MethodName = "DeletePublisherForWCF"
                };
                CustomExceptionDB custom_exceptionDB = new CustomExceptionDB();
                bool isSaved = custom_exceptionDB.SaveException(custom_exception);
                if (isSaved == true)
                {
                    //..
                }
                methodresponse.Object = null;
                methodresponse.Type = MethodResponse.ResponseType.Error;
                methodresponse.ResultText = "An Error Occurred While Removing Publisher ";



            }
            return methodresponse;
        }
Esempio n. 4
0
        public MethodResponse UpdateUserForWCF(User _user)
        {
            MethodResponse methodresponse = new MethodResponse();
            try
            {
                User user = UpdateUser(_user);
                methodresponse.Type = MethodResponse.ResponseType.Succeed;
                methodresponse.ResultText = "User Updated";
                methodresponse.Object = user;
            }
            catch (Exception ex)
            {
                CustomException custom_exception = new CustomException()
                {
                    Exception = ex,
                    ExceptionTime = DateTime.Now,
                    Parameters = "",
                    HelpLink = "",
                    User = "",
                    MethodName = "UpdateUserForWCF"
                };
                CustomExceptionDB custom_exceptionDB = new CustomExceptionDB();
                bool isSaved = custom_exceptionDB.SaveException(custom_exception);
                if (isSaved == true)
                {
                    //..
                }
                methodresponse.Object = null;
                methodresponse.Type = MethodResponse.ResponseType.Error;
                methodresponse.ResultText = "An Error Occurred While Updating User";



            }
            return methodresponse;
        }
Esempio n. 5
0
        public MethodResponse AddBookForWCF(Book _book)
        {
            MethodResponse methodresponse = new MethodResponse();
            try
            {
                Book lastbook = AddBook(_book);
                methodresponse.Type = MethodResponse.ResponseType.Succeed;
                methodresponse.ResultText = "Book Added";
                methodresponse.Object =lastbook;
            }
            catch (Exception ex)
            {
                CustomException custom_exception = new CustomException()
                {
                    Exception = ex,
                    ExceptionTime = DateTime.Now,
                    Parameters = "",
                    HelpLink = "",
                    User = "",
                    MethodName = "GetBookByIdForWCF"
                };
                CustomExceptionDB custom_exceptionDB = new CustomExceptionDB();
                bool isSaved = custom_exceptionDB.SaveException(custom_exception);
                if (isSaved == true)
                {
                    //..
                }
                methodresponse.Object = null;
                methodresponse.Type = MethodResponse.ResponseType.Error;
                methodresponse.ResultText = "An Error Occurred While Adding Book";



            }
            return methodresponse;
        }