Example #1
0
        /// <summary>
        /// metodo que cambia el estado del paquete e invoca a informar estado
        /// </summary>
        public void MockCicloDeVida()
        {
            while (this.Estado != EEstado.Entregado)
            {
                System.Threading.Thread.Sleep(500);

                if (this.Estado == EEstado.Ingresando)
                {
                    this.Estado = EEstado.EnViaje;
                }
                else
                {
                    this.Estado = EEstado.Entregado;
                }

                InformaEstado.Invoke(new object { }, EventArgs.Empty);
            }

            try
            {
                PaqueteDAO.Insertar(this);
            }
            catch (Exception e)
            {
                SQLError.Invoke(e.Message);
            }
        }
Example #2
0
 //constructor
 public SQLEventArgs(string query, Tuple <string, dynamic>[] queryParameters, SQLError error, SQLData data, Guid guid)
 {
     _query           = query;
     _queryParameters = queryParameters;
     _error           = error;
     _data            = data;
     _guid            = guid;
 }
Example #3
0
        /// <summary>
        /// 通过Id得到书籍信息
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        public string GetBook(string id)
        {
            int bookId = Convert.ToInt32(id);

            try
            {
                //var books = (from s in book.Books
                //         where s.Id == id
                //         select s).SingleOrDefault();
                var books = book.Books.Where(e => e.Id.Equals(bookId)).SingleOrDefault();

                return(XmlHelper.ToXML <Books>(books));
            }
            catch (Exception ex)
            {
                //这里如果出现异常,则返回一个自定义的错误信息,用于进行调试,可以看到更详细的异常信息,方便定位问题。
                string   reason = GetErrorMessage(ex);
                SQLError error  = new SQLError("更新数据库操作", reason);
                throw new FaultException <SQLError>(error, new FaultReason(reason), new FaultCode("Edit"));
            }
        }