示例#1
0
        public bool GuardarCliente(ClienteBE objCliente, out string mensaje)
        {
            ClienteDA objClienteDA = new ClienteDA();

            try
            {
                using (TransactionScope transaccion = new TransactionScope(TransactionScopeOption.Required))
                {
                    if (objClienteDA.GuardarCliente(objCliente, out mensaje))
                    {
                        transaccion.Complete();
                        return(true);
                    }
                    else
                    {
                        transaccion.Dispose();
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#2
0
        public bool GuardarCliente(ClienteBE objCliente, out string IdCliente, out string mensaje)
        {
            ClienteDA objClienteDA = new ClienteDA();

            try
            {
                /*if (objCliente.Nombre == "")
                 * {
                 *  IdCliente = "0";
                 *  mensaje = "El nombre del Cliente no puede estar vacio.";
                 *  return false;
                 * }*/
                if (objClienteDA.GuardarCliente(objCliente, out IdCliente))
                {
                    mensaje = "Se registro al Cliente.";
                    return(true);
                }
                else
                {
                    IdCliente = "0";
                    mensaje   = "Ocurrio un error al guardar al Cliente.";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
示例#3
0
        public bool GuardarCliente(ClienteBE objCliente, out string mensaje)
        {
            ClienteDA objClienteDA = new ClienteDA();

            try
            {
                using (TransactionScope transaccion = new TransactionScope(TransactionScopeOption.Required))
                {
                    if (objCliente.TipoCliente == null)
                    {
                        objCliente.TipoCliente = new TipoClienteBE()
                        {
                            IdTipoCliente = 2
                        }
                    }
                    ;
                    if (objCliente.Auditoria == null)
                    {
                        objCliente.Auditoria = new AuditoriaBE()
                        {
                            Usuario = "admin"
                        }
                    }
                    ;

                    if (objClienteDA.GuardarCliente(objCliente, out mensaje))
                    {
                        transaccion.Complete();
                        return(true);
                    }
                    else
                    {
                        transaccion.Dispose();
                        return(false);
                    }
                }
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }