Пример #1
0
    public List <CourseVO> RemoveCourses(CourseVO[] pCourses)
    {
        List <CourseVO> result = null;

        try
        {
            AuthenticationService.CheckIfUSerIsAuthenticated();
            CourseTableAdapter adapter   = new CourseTableAdapter();
            string             logParams = "";

            foreach (CourseVO vo in pCourses)
            {
                if (logParams.Length > 0)
                {
                    logParams += ",\n";
                }

                adapter.Delete(vo.ID);
                result.Add(vo);

                // TODO: Fill properties here
                logParams += String.Format("ID:\"{1}\", Name:\"{1}\"", vo.ID, vo.Name);
            }

            adapter.Dispose();

            LogService.Log("CourseService", "RemoveCourses", logParams);
        }
        catch (ONyRException e)
        {
            LogService.LogError(e.ErrorCode, e.StackTrace);
            throw new FaultException <ONyRFaultException>(new ONyRFaultException((int)e.ErrorCode));
        }
        catch (SqlException ex)
        {
            string s = "Class: " + ex.Class + "\n";
            for (int i = 0; i < ex.Errors.Count; i++)
            {
                s += "Index #" + i + "\n" +
                     "Message: " + ex.Errors[i].Message + "\n" +
                     "LineNumber: " + ex.Errors[i].LineNumber + "\n" +
                     "Source: " + ex.Errors[i].Source + "\n" +
                     "Procedure: " + ex.Errors[i].Procedure + "\n" +
                     "Class: " + ex.Errors[i].Class + "\n";
            }
            LogService.LogError(ErrorCode.UnknownError, null, s);
            throw new FaultException <ONyRFaultException>(new ONyRFaultException((int)ErrorCode.DatabaseError));
        }
        catch (Exception e)
        {
            LogService.LogError(ErrorCode.UnknownError, e.StackTrace, e.Message);
            throw new FaultException <ONyRFaultException>(new ONyRFaultException((int)ErrorCode.UnknownError));
        }

        return(result);
    }