Example #1
0
        public void RemovePerson(string token, int id)
        {
            bool ok;

            try
            {
                ok = Identification(token);
            }
            catch (DatabaseConnectionException e)
            {
                ServiceData sd = new ServiceData();
                sd.ErrorMessage = e.Message;
                throw new FaultException <ServiceData>(sd, new FaultReason(sd.ErrorMessage));
            }
            catch (DatabaseCommandTextException e)
            {
                ServiceData sd = new ServiceData();
                sd.ErrorMessage = e.Message;
                throw new FaultException <ServiceData>(sd, new FaultReason(sd.ErrorMessage));
            }
            catch (DatabaseParameterException e)
            {
                ServiceData sd = new ServiceData();
                sd.ErrorMessage = e.Message;
                throw new FaultException <ServiceData>(sd, new FaultReason(sd.ErrorMessage));
            }

            if (ok)
            {
                try { personsManager.Delete(id); }
                catch (DatabaseConnectionException e)
                {
                    ServiceData sd = new ServiceData();
                    sd.ErrorMessage = e.Message;
                    throw new FaultException <ServiceData>(sd, new FaultReason(sd.ErrorMessage));
                }
                catch (DatabaseParameterException e)
                {
                    ServiceData sd = new ServiceData();
                    sd.ErrorMessage = e.Message;
                    throw new FaultException <ServiceData>(sd, new FaultReason(sd.ErrorMessage));
                }

                //try
                //{
                //    refreshManager.UpdateLastTime(DateTime.Now);
                //}
                //catch (DatabaseConnectionException e)
                //{
                //    ServiceData sd = new ServiceData();
                //    sd.ErrorMessage = e.Message;
                //    throw new FaultException<ServiceData>(sd, new FaultReason(sd.ErrorMessage));
                //}
                //catch (DatabaseParameterException e)
                //{
                //    ServiceData sd = new ServiceData();
                //    sd.ErrorMessage = e.Message;
                //    throw new FaultException<ServiceData>(sd, new FaultReason(sd.ErrorMessage));
                //}
            }
        }