Пример #1
0
        public Helper.MethodResponse GetBooksByIdForWCF(int _id)
        {
            MethodResponse methodResponse = new MethodResponse();

            try
            {


                BookDB bookdb = new BookDB();
                methodResponse = bookdb.GetBookByIdForWCF(_id);
                
            }
            catch (Exception exc)
            {
                CustomException customException = new CustomException()
                {
                    Exception = exc,
                    ExceptionTime = DateTime.Now,
                    Parameters = _id.ToString(),
                    HelpLink = "",
                    User = "",
                    MethodName = "GetBooksByIdForWCF"
                };

                //bool IsSaved = customException.SaveException(customException);

                //if (!IsSaved)
                //{
                //    // Mail At
                //}

                methodResponse.Object = null;
                methodResponse.Type = MethodResponse.ResponseType.Error;
                methodResponse.ResultText = "An Error Occurred While Searhing From Service Side";
            }
            return methodResponse;
        }
Пример #2
0
        public Helper.MethodResponse AddBookForWCF(Data.Model.Book _book)
        {
            MethodResponse methodResponse = new MethodResponse();

            try
            {

                BookDB bookdb = new BookDB();
                methodResponse = bookdb.AddBookForWCF(_book);
                
            }
            catch (Exception exc)
            {
                string serilazedObject = "";
                _book.Serialize(ref serilazedObject);

                CustomException customException = new CustomException()
                {
                    Exception = exc,
                    ExceptionTime = DateTime.Now,
                    Parameters = serilazedObject,
                    HelpLink = "",
                    User = "",
                    MethodName = "AddBookForWCF"
                };

                //bool IsSaved = customException.SaveException(customException);

                //if (!IsSaved)
                //{
                //    // Mail At
                //}

                methodResponse.Object = null;
                methodResponse.Type = MethodResponse.ResponseType.Error;
                methodResponse.ResultText = "An Error Occurred While Adding  From Service Side";
            }
            return methodResponse;
        }