예제 #1
0
        protected void logeoBt_Click(object sender, EventArgs e)
        {
            login.Text = "" + funcionamiento;
            BaseDatos datab = new BaseDatos();
            SqlDataReader lector = datab.Consulta("select *from Usuario where nombreUsuario ='" + userName.Text + "' and PWDCOMPARE('" + pass.Text + "', contrasenia)= 1");
            if (lector.HasRows && funcionamiento == 0)
            {
                lector.Read();
                login.Text = "Bienvenido  " + lector.GetString(1);
                userName.Text = null;
                userName.Visible = false;
                pass.Text = null;
                pass.Visible = false;
                usuarioLb.Visible = false;
                passLb.Visible = false;
                funcionamiento = 1;
                logeoBt.Text = "Presiona acá para salir del sistema" + funcionamiento;
            }
            else if (funcionamiento == 1)
            {
                userName.Visible = true;
                pass.Visible = true;
                usuarioLb.Visible = true;
                passLb.Visible = true;
                logeoBt.Text = "Logeate aca";
            }
            else
            {

            }
        }
예제 #2
0
 protected void loginBt_Click(object sender, EventArgs e)
 {
     TextBox1.Text = " me he conectado";
     BaseDatos dab = new BaseDatos();
     bool f = dab.verificarconexion();
     if (f)
     {
         TextBox1.Text = " me he conectado";
     }
     string datos = "insert into Usuario(nombrePila,apellido,nacionalidad,nombreUsuario,contrasenia)values(\'" + nombre.Text +"\',\'"+ apellido.Text+"\', \'" + nacionalidad.Text+"\',\'"+ nick.Text+"\', PWDENCRYPT(\'"+pass.Text +"\')  )" ;
     TextBox1.Text = dab.insertarDatos(datos);
 }
예제 #3
0
 public WebService()
 {
     baseDatos = new BaseDatos("SERVER=localhost;DATABASE=cine;UID=root;PWD=''");
 }
예제 #4
0
        public static ResultadoTransaccion ListarCreditoClientes()
        {
            ResultadoTransaccion      res = new ResultadoTransaccion();
            IList <clsCreditoCliente> ListaCreditoCliente = new List <clsCreditoCliente>();

            try
            {
                //Abrir Conexion
                conn = BaseDatos.Conexion();

                objParams = SqlHelperParameterCache.GetSpParameterSet(conn, "SP_C_DIRECCION_CREDITO_CLIENTE");

                SqlCommand command = new SqlCommand("SP_C_DIRECCION_CREDITO_CLIENTE", conn);

                command.Transaction = transaction;
                command.Parameters.AddRange(objParams);
                command.CommandType = CommandType.StoredProcedure;
                dreader             = command.ExecuteReader();

                while (dreader.Read())
                {
                    clsCreditoCliente ObjClienteCredito = new clsCreditoCliente();

                    ObjClienteCredito.Id = Convert.ToInt32(dreader[0]);
                    ObjClienteCredito.MontoLineaCredito = Convert.ToDouble(dreader[5]);

                    ObjClienteCredito.ObjCuenta = new clsClienteMaster(true);

                    ObjClienteCredito.ObjCuenta.Id  = Convert.ToInt32(dreader[1]);
                    ObjClienteCredito.ObjCuenta.RUT = dreader[8].ToString();

                    ObjClienteCredito.ObjCuenta.Cuenta         = new clsCuenta();
                    ObjClienteCredito.ObjCuenta.Cuenta.Id      = Convert.ToInt32(dreader[1]);
                    ObjClienteCredito.ObjCuenta.NombreFantasia = dreader[2].ToString();
                    ObjClienteCredito.ObjCuenta.NombreCompañia = dreader[2].ToString();

                    ObjClienteCredito.ObjMoneda = new clsTipoMoneda();

                    ObjClienteCredito.ObjMoneda.Id     = Convert.ToInt32(dreader[3]);
                    ObjClienteCredito.ObjMoneda.Codigo = dreader[4].ToString();

                    ObjClienteCredito.ObjCuentaClasificacion = new clsCuentaclasificacion();

                    ObjClienteCredito.ObjCuentaClasificacion.Id     = Convert.ToInt32(dreader[6]);
                    ObjClienteCredito.ObjCuentaClasificacion.Nombre = dreader[7].ToString();

                    ObjClienteCredito.Vendedor = dreader[9].ToString();

                    if (dreader[10].ToString().Trim() != "" && dreader[11].ToString().Trim() != "")
                    {
                        ObjClienteCredito.TipoCliente = "Ambos";
                    }
                    else
                    {
                        if (dreader[10].ToString().Trim() != "")
                        {
                            ObjClienteCredito.TipoCliente = dreader[10].ToString();
                        }
                        else
                        {
                            ObjClienteCredito.TipoCliente = dreader[11].ToString();
                        }
                    }

                    ListaCreditoCliente.Add(ObjClienteCredito);
                }
                res.Accion            = Entidades.Enums.Enums.AccionTransaccion.Consultar;
                res.ObjetoTransaccion = ListaCreditoCliente;
            }
            catch (Exception ex)
            {
                Log.EscribirLog(ex.Message);

                res.Descripcion  = ex.Message;
                res.ArchivoError = "clsControlCreditoAdo.cs";
                res.MetodoError  = "ListarCreditoClientes";
            }
            finally
            {
                conn.Close();
            }
            return(res);
        }
예제 #5
0
 public Cliente()
 {
     this.data = new BaseDatos();
 }
예제 #6
0
 /// <summary>
 /// Constructor para inicializar la conexión a la base de datos.
 /// </summary>
 public AccesoDatosBase()
 {
     bd = AdministradorBaseDatos.CrearBaseDeDatosInternetBanking();
 }
 public Maquinaria_ServiciosController(BaseDatos context)
 {
     _context = context;
 }
예제 #8
0
        public bool M_AsociacionVecinoDel(int idUsuario, int idVecino, int idAdmin, out string mensaje)
        {
            bd = new BaseDatos();

            return(bd.p_AsociacionVecinoDel(idUsuario, idVecino, idAdmin, out mensaje));
        }
예제 #9
0
        public Usuario M_UsuarioByCorreoGet(string correo)
        {
            bd = new BaseDatos();

            return(bd.p_UsuarioByCorreoGet(correo));
        }
        private void itemAgregar_Click(object sender, Telerik.Windows.RadRoutedEventArgs e)
        {
            if (sender == itemAgregar)
            {
                RegistrarDeposito rd = new RegistrarDeposito();
                rd.Show();
                this.Close();
            }
            else
            {
                if (sender == itemEliminar)
                {
                    MessageBoxResult result = MessageBox.Show("Esta seguro de eliminar el deposito?", "Administracion", MessageBoxButton.YesNo);
                    switch (result)
                    {
                    case MessageBoxResult.Yes:

                        dynamic paciente = rgvDepositosAplicados.SelectedItem;
                        int     idp      = paciente.ID_PACIENTE;
                        int     idcuenta = paciente.ID_CUENTA;
                        int     iddepo   = paciente.ID_DEPOSITO;

                        if (rgvDepositosAplicados.SelectedItem != null)
                        {
                            var cuenta   = BaseDatos.GetBaseDatos().CUENTAS.Find(idcuenta);
                            var deposito = BaseDatos.GetBaseDatos().DEPOSITOS.Find(iddepo);

                            cuenta.TOTAL = cuenta.TOTAL - deposito.MONTO;
                            cuenta.SALDO = cuenta.SALDO - deposito.MONTO;
                            BaseDatos.GetBaseDatos().SaveChanges();

                            BaseDatos.GetBaseDatos().DEPOSITOS.Remove(deposito);
                            BaseDatos.GetBaseDatos().SaveChanges();
                            MessageBox.Show("El Deposito se ha eliminado correctamente");
                            VistaGrid();
                        }
                        break;

                    case MessageBoxResult.No:

                        break;
                    }
                }
                else
                {
                    if (sender == itemEditar)
                    {
                        if (rgvDepositosAplicados.SelectedItem != null)
                        {
                            dynamic paciente = rgvDepositosAplicados.SelectedItem;
                            int     idp      = paciente.ID_PACIENTE;
                            int     iddepo   = paciente.ID_DEPOSITO;
                            int     idcuent  = paciente.ID_CUENTA;

                            RegistrarDeposito obj = new RegistrarDeposito(idp, iddepo, idcuent);
                            obj.Show();
                            this.Close();
                        }
                    }
                }
            }
        }
 public ServicioBaseDatos()
 {
     bd = new BaseDatos(Constantes.NombreBD);
 }
예제 #12
0
        public FormReport()
        {
            cnn = new BaseDatos();

            InitializeComponent();
        }
예제 #13
0
        public static Clientes Buscar(int id)
        {
            var db = new BaseDatos();

            return(db.Usuario.Find(id));
        }
예제 #14
0
        public static ResultadoTransaccion Modificar(CotizacionDirecta cotizacionDirecta)
        {
            var            Res   = new ResultadoTransaccion();
            SqlTransaction trans = null;

            var cotizacionDB = ObtieneCotizacionDirecta(cotizacionDirecta.Id32).ObjetoTransaccion as CotizacionDirecta;
            //Abrir Conexion
            var conn = BaseDatos.Conexion();

            try {
                SqlCommand command = new SqlCommand("SP_A_COTIZACION_SOLICITUD_COTIZACIONES", conn);

                command.Transaction = conn.BeginTransaction();
                trans = command.Transaction;

                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@id", cotizacionDirecta.Id32);
                command.Parameters.AddWithValue("@Producto", cotizacionDirecta.Producto);
                command.Parameters.AddWithValue("@idUsuario", cotizacionDirecta.Usuario.Id32);
                command.Parameters.AddWithValue("@idCliente", cotizacionDirecta.Cliente.Id32);
                command.Parameters.AddWithValue("@nombreCliente", cotizacionDirecta.NombreCliente);
                command.Parameters.AddWithValue("@fechaSolicitud", cotizacionDirecta.FechaSolicitud);
                command.Parameters.AddWithValue("@idIncoterms", cotizacionDirecta.IncoTerm.Id32);
                command.Parameters.AddWithValue("@commodity", cotizacionDirecta.Commodity);
                command.Parameters.AddWithValue("@puertoEmbarque", "");
                command.Parameters.AddWithValue("@navieraReferencia", "");
                command.Parameters.AddWithValue("@tarifaReferencia", "");
                command.Parameters.AddWithValue("@Observaciones", cotizacionDirecta.Observaciones);
                command.Parameters.AddWithValue("@mercaderia", "");
                command.Parameters.AddWithValue("@gastosLocales", cotizacionDirecta.GastosLocales);
                command.Parameters.AddWithValue("@proveedorCarga", "");
                command.Parameters.AddWithValue("@credito", "");
                command.Parameters.AddWithValue("@fechaEstimadaEmbarque", "");
                command.Parameters.AddWithValue("@conAgenciamento", false);

                command.CommandType = CommandType.StoredProcedure;
                command.ExecuteScalar();

                ModificarOpciones(cotizacionDirecta, command);

                //Marcamos las opciones que el usuario marco para borrar.
                foreach (var opcion in cotizacionDB.Opciones)
                {
                    var op = cotizacionDirecta.Opciones.Find(foo => foo.Id32 == opcion.Id32);
                    if (op == null)
                    {
                        EliminaOpcion(opcion, command);
                    }
                }

                ClsGastosLocalesDao.Eliminar(cotizacionDirecta, command);
                ClsGastosLocalesDao.CrearGastosLocales(cotizacionDirecta, command);

                //Ejecutar transaccion
                trans.Commit();
                Res.Estado      = Entidades.Enums.Enums.EstadoTransaccion.Aceptada;
                Res.Descripcion = "Se modificó la cotización correctamente";
            } catch (Exception ex) {
                if (trans != null)
                {
                    trans.Rollback();
                }
                Log.EscribirLog(ex.Message);
                Res.Descripcion  = ex.Message;
                Res.ArchivoError = NombreClase;
                Res.MetodoError  = MethodBase.GetCurrentMethod().Name;
            } finally {
                conn.Close();
            }
            return(Res);
        }
 public AvionesController(BaseDatos context)
 {
     _context = context;
 }
예제 #16
0
        public static ResultadoTransaccion Crear(CotizacionDirecta cotizacionDirecta)
        {
            ResultadoTransaccion res   = new ResultadoTransaccion();
            SqlTransaction       trans = null;
            //Abrir Conexion
            var conn = BaseDatos.Conexion();

            try {
                SqlCommand command = new SqlCommand("SP_N_COTIZACION_SOLICITUD_COTIZACIONES", conn);

                command.Transaction = conn.BeginTransaction();
                trans = command.Transaction;

                command.CommandType = CommandType.StoredProcedure;
                command.Parameters.AddWithValue("@idUsuario", cotizacionDirecta.Usuario.Id32);
                command.Parameters.AddWithValue("@Producto", cotizacionDirecta.Producto);
                //command.Parameters.AddWithValue("@Producto", "FCL");
                command.Parameters.AddWithValue("@idCliente", cotizacionDirecta.Cliente.Id32);
                command.Parameters.AddWithValue("@nombreCliente", cotizacionDirecta.NombreCliente);
                command.Parameters.AddWithValue("@fechaSolicitud", cotizacionDirecta.FechaSolicitud);
                command.Parameters.AddWithValue("@idIncoterms", cotizacionDirecta.IncoTerm.Id32);
                command.Parameters.AddWithValue("@gastosLocales", cotizacionDirecta.GastosLocales);
                command.Parameters.AddWithValue("@ObservacionesFijas", cotizacionDirecta.ObservacionesFijas);
                command.Parameters.AddWithValue("@Observaciones", cotizacionDirecta.Observaciones);
                command.Parameters.AddWithValue("@commodity", cotizacionDirecta.Commodity);
                command.Parameters.AddWithValue("@COTIZACION_TIPOS_id", 1);
                command.Parameters.AddWithValue("@COTIZACION_Directa_ESTADOS_id", 1);
                command.Parameters.AddWithValue("@conAgenciamento", false);
                command.Parameters.AddWithValue("@CopiadoDe", cotizacionDirecta.CopiadoDe);

                command.CommandType = CommandType.StoredProcedure;

                var outParam = command.Parameters.Add("@Id", SqlDbType.BigInt);
                outParam.Direction = ParameterDirection.Output;
                command.ExecuteScalar();

                cotizacionDirecta.Id   = Convert.ToInt16(outParam.Value);
                cotizacionDirecta.Id32 = Convert.ToInt32(outParam.Value);

                CrearOpcion(cotizacionDirecta, command);
                ClsGastosLocalesDao.CrearGastosLocales(cotizacionDirecta, command);
                command.Transaction.Commit();

                res.Accion            = Entidades.Enums.Enums.AccionTransaccion.Consultar;
                res.ObjetoTransaccion = cotizacionDirecta;
                res.Descripcion       = "La cotización se guardó Exitosamente";
            } catch (Exception ex) {
                cotizacionDirecta.Id = cotizacionDirecta.Id32 = 0;
                foreach (var o in cotizacionDirecta.Opciones)
                {
                    o.Id = o.Id32 = 0;
                    foreach (var d in o.Detalles)
                    {
                        d.Id = d.Id32 = 0;
                    }
                }

                if (trans != null)
                {
                    trans.Rollback();
                }
                Log.EscribirLog(ex.Message);

                res.Descripcion  = ex.Message;
                res.ArchivoError = NombreClase;
                res.MetodoError  = MethodBase.GetCurrentMethod().Name;
            } finally {
                conn.Close();
            }
            return(res);
        }
 public TripulacionesController(BaseDatos context)
 {
     _context = context;
 }
예제 #18
0
        public bool M_CodigoVerificacionUsuarioGenera(string correo, int idUsuarioCreador, out string mensaje)
        {
            bd = new BaseDatos();

            return(bd.p_CodigoVerificacionUsuarioGenera(correo, idUsuarioCreador, out mensaje));
        }
예제 #19
0
 public HomeController(BaseDatos context)
 {
     _context = context;
 }
예제 #20
0
        public List <Usuario> M_AsociacionVecinosByCorreoLst(string correo)
        {
            bd = new BaseDatos();

            return(bd.p_AsociacionVecinosByCorreoLst(correo));
        }
예제 #21
0
        public static ResultadoTransaccion ListarProspectoUsuarioEstado(long IdVendedor, string Estados)
        {
            ResultadoTransaccion res        = new ResultadoTransaccion();
            IList <clsMeta>      Prospectos = new List <clsMeta>();

            try
            {
                //Abrir Conexion
                conn = BaseDatos.Conexion();

                objParams = SqlHelperParameterCache.GetSpParameterSet(conn, "SP_C_DIRECCION_METAS_VENDEDOR");

                SqlCommand command = new SqlCommand("SP_C_DIRECCION_METAS_VENDEDOR", conn);
                objParams[0].Value = IdVendedor;
                objParams[1].Value = Estados;

                command.Transaction = transaction;
                command.Parameters.AddRange(objParams);
                command.CommandType = CommandType.StoredProcedure;
                dreader             = command.ExecuteReader();

                while (dreader.Read())
                {
                    clsMeta ObjProspecto = new clsMeta();

                    ObjProspecto.IdNumMeta        = dreader[1].ToString().Trim();
                    ObjProspecto.Id               = Convert.ToInt32(dreader[0]);
                    ObjProspecto.Prioridad        = new clsItemParametro();
                    ObjProspecto.Prioridad.Codigo = dreader[2].ToString();
                    //ObjProspecto.Prioridad.Nombre = dreader[3].ToString();
                    ObjProspecto.TipoOportunidad                                     = dreader[3].ToString().Trim();
                    ObjProspecto.GlosaClienteTarget                                  = dreader[4].ToString().Trim();
                    ObjProspecto.ObjClienteMaster                                    = new clsClienteMaster(true);
                    ObjProspecto.ObjClienteMaster.Id                                 = Convert.ToInt32(dreader[5]);
                    ObjProspecto.ObjClienteMaster.NombreFantasia                     = dreader[6].ToString().Trim();
                    ObjProspecto.ObjMetaAsignacion                                   = new clsMetaAsignacion();
                    ObjProspecto.ObjMetaAsignacion.ObjVendedorAsignado               = new clsUsuario();
                    ObjProspecto.ObjMetaAsignacion.ObjVendedorAsignado.Id            = Convert.ToInt32(dreader[7]);
                    ObjProspecto.ObjMetaAsignacion.ObjVendedorAsignado.NombreUsuario = dreader[8].ToString().Trim();
                    ObjProspecto.ObjMetaAsignacion.ObjVendedorAsignado.Email         = dreader[9].ToString().Trim();
                    ObjProspecto.EstadoMeta    = (Enums.EstadosMetas)Convert.ToInt16(dreader[10]);
                    ObjProspecto.FechaApertura = Convert.ToDateTime(dreader[11]);
                    //ObjProspecto.FechaRevision = Convert.ToDateTime(dreader[12]);
                    ObjProspecto.FechaUltActulizacion    = Convert.ToDateTime(dreader[13]);
                    ObjProspecto.IdTipoActualizacion     = Convert.ToInt32(dreader[14]);
                    ObjProspecto.FechaHoy                = Convert.ToDateTime(dreader[15]);
                    ObjProspecto.UsuarioAsignador        = new clsUsuario();
                    ObjProspecto.UsuarioAsignador.Id     = Convert.ToInt32(dreader[16]);
                    ObjProspecto.UsuarioAsignador.Email  = dreader[17].ToString().Trim();
                    ObjProspecto.UsuarioAsignador.Nombre = dreader[18].ToString().Trim();

                    ObjProspecto.FollowUps = clsClienteMasterADO.ObtenerFollowUpActivosClientePorTarget(ObjProspecto.Id32);

                    Prospectos.Add(ObjProspecto);
                }

                res.Accion            = Entidades.Enums.Enums.AccionTransaccion.Consultar;
                res.ObjetoTransaccion = Prospectos;
            }
            catch (Exception ex)
            {
                Log.EscribirLog(ex.Message);

                res.Descripcion  = ex.Message;
                res.ArchivoError = "clsMetaAdo.cs";
                res.MetodoError  = "ListarProspectos";
            }
            finally
            {
                conn.Close();
            }
            return(res);
        }
 public MantenimientosController(BaseDatos context)
 {
     _context = context;
 }
예제 #23
0
        public static ResultadoTransaccion GuardarVariosProspectos(IList <clsMeta> ListaProspectos)
        {
            ResultadoTransaccion Res = new ResultadoTransaccion();

            //Abrir Conexion
            conn = BaseDatos.Conexion();
            //Crear Transaccion
            transaction = conn.BeginTransaction();
            try
            {
                foreach (clsMeta Prospecto in ListaProspectos)
                {
                    Res = clsMetaAdo.GuardarProspecto(Prospecto);

                    if (Res.Estado == ProyectoCraft.Entidades.Enums.Enums.EstadoTransaccion.Aceptada)
                    {
                        foreach (var followUp in Prospecto.FollowUps)
                        {
                            followUp.IdTarget = Prospecto.Id32;
                        }

                        Res = GuardarFollowups(new List <clsClienteFollowUp>(), Prospecto);
                        Res = clsMetaAdo.GuardarProspectoUsuario(Prospecto.Id, Prospecto.ObjMetaAsignacion.ObjVendedorAsignado.Id, Prospecto.FechaApertura);
                        if (Prospecto.ObjMetaCompetencia != null)
                        {
                            foreach (clsMetaCompetencia Competencia in Prospecto.ObjMetaCompetencia)
                            {
                                Res = clsMetaAdo.GuardarProspectoCompetencia(Prospecto.Id, Competencia);
                                if (Res.Estado == ProyectoCraft.Entidades.Enums.Enums.EstadoTransaccion.Rechazada)
                                {
                                    transaction.Rollback();
                                    Log.EscribirLog(Res.Descripcion);
                                    return(Res);
                                }
                            }
                        }
                        if (Prospecto.ObjMetaGlosasTrafico != null)
                        {
                            foreach (clsMetaGlosasTrafico Traficos in Prospecto.ObjMetaGlosasTrafico)
                            {
                                Res = clsMetaAdo.GuardarProspectoTraficos(Prospecto.Id, Traficos);
                                if (Res.Estado == ProyectoCraft.Entidades.Enums.Enums.EstadoTransaccion.Rechazada)
                                {
                                    transaction.Rollback();
                                    Log.EscribirLog(Res.Descripcion);
                                    return(Res);
                                }
                            }
                        }
                        if (Prospecto.ObjTipoProducto != null)
                        {
                            foreach (clsTipoProducto Producto in Prospecto.ObjTipoProducto)
                            {
                                Res = clsMetaAdo.GuardarProspectoTiposProductos(Prospecto.Id, Producto.Id);
                                if (Res.Estado == ProyectoCraft.Entidades.Enums.Enums.EstadoTransaccion.Rechazada)
                                {
                                    transaction.Rollback();
                                    Log.EscribirLog(Res.Descripcion);
                                    return(Res);
                                }
                            }
                        }
                    }
                }
                //Ejecutar transaccion
                transaction.Commit();
                Res.Estado      = Enums.EstadoTransaccion.Aceptada;
                Res.Descripcion = "Se registró la asiganción del prospecto correctamente";
            }
            catch (Exception ex)
            {
                transaction.Rollback();
                Log.EscribirLog(ex.Message);

                Res.Descripcion  = ex.Message;
                Res.ArchivoError = "clsMetaAdo.cs";
                Res.MetodoError  = "GuardarAsignacionProspecto";
                Res.Estado       = Enums.EstadoTransaccion.Rechazada;
            }
            finally
            {
                conn.Close();
            }
            return(Res);
        }
예제 #24
0
        // Specify what you want to happen when the Elapsed event is
        // raised.
        private static void OnTimedEvent(object source, ElapsedEventArgs e)
        {
            string path = @"C:/poslog/log.txt";

            try
            {
                Console.WriteLine("sincronizando información", e.SignalTime);


                string servidorLocal  = ConfigurationManager.AppSettings["servidor_local"];
                string baseDatosLocal = ConfigurationManager.AppSettings["base_datos_local"];


                BaseDatos     cnnLocal = new BaseDatos(servidorLocal, baseDatosLocal, "Integrated Security = true");
                Configuration config   = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);

                Tienda tienda = cnnLocal.consultarTienda();

                using (StreamWriter file = File.AppendText(path))
                {
                    file.WriteLine(DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "sincronizando servidor local: " + servidorLocal);
                    file.WriteLine(DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + " sucursal:" + tienda.nombreTienda);
                }

/*
 *              config.AppSettings.Settings.Remove("id_tienda");
 *              config.AppSettings.Settings.Add("id_tienda", tienda.idTienda.ToString());
 *
 *              config.AppSettings.Settings.Remove("nombre sucursal");
 *              config.AppSettings.Settings.Add("nombre sucursal", tienda.nombreTienda);
 *
 *
 *              config.Save(ConfigurationSaveMode.Full);*/

                Sincronizador sinc = new Sincronizador();


                using (StreamWriter file = File.AppendText(path))
                {
                    file.WriteLine(DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "sincronizando información para la tienda: " + tienda.nombreTienda);
                }


                // sincronizacion de la nube a local
                #region usuarios
                sinc.sincronizarUsuarios();
                sinc.sincronizarPrivilegios();
                sinc.sincronizarPrivilegiosAsignados();
                sinc.sincronizarPerfil();
                #endregion

                #region sucursal
                sinc.sincronizarTienda();
                #endregion

                #region productos
                sinc.sincronizarFamilias();
                sinc.sincronizarProductos();
                #endregion

                // sincronizacion local a la nube

                #region productos vendidos
                sinc.sincronizarDinero();
                sinc.sincronizarCaja();
                sinc.sincronizarVentas();
                sinc.sincronizarFormaPago();
                sinc.sincronizarProductosVendidos();


                #endregion

                using (StreamWriter file = File.AppendText(path))
                {
                    file.WriteLine(DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "fin de sincronización :D");
                }


                // sinc.sincronizarProductos();
                // sinc.sincronizarVentas();
            }
            catch (Exception ex)
            {
                using (StreamWriter file = File.AppendText(path))
                {
                    file.WriteLine(DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss") + "Erro al sincronizar :(   " + ex.Message);
                }
            }
        }
예제 #25
0
        public static ResultadoTransaccion ObtenerMetaPorId(Int64 IdMeta)
        {
            ResultadoTransaccion res = new ResultadoTransaccion();
            clsMeta ObjProspecto     = null;

            try
            {
                //Abrir Conexion
                conn = BaseDatos.Conexion();

                objParams          = SqlHelperParameterCache.GetSpParameterSet(conn, "SP_C_DIRECCION_META_PORID");
                objParams[0].Value = IdMeta;
                SqlCommand command = new SqlCommand("SP_C_DIRECCION_META_PORID", conn);

                command.Transaction = transaction;
                command.Parameters.AddRange(objParams);
                command.CommandType = CommandType.StoredProcedure;
                dreader             = command.ExecuteReader();

                while (dreader.Read())
                {
                    ObjProspecto           = new clsMeta();
                    ObjProspecto.FollowUps = clsClienteMasterADO.ObtenerFollowUpActivosClientePorTarget(IdMeta);

                    ObjProspecto.GlosaClienteTarget       = dreader["GlosaClienteTarget"].ToString().Trim();
                    ObjProspecto.GlosaCommodity           = dreader["GlosaCommodity"].ToString();
                    ObjProspecto.ObjTipoContenedor        = new clsItemParametro();
                    ObjProspecto.ObjTipoContenedor.Nombre = dreader["TipoContenedor"].ToString();
                    //ObjProspecto.FechaRevision = Convert.ToDateTime(dreader["FechaRevision"]);
                    ObjProspecto.ObjMetaAsignacion = new clsMetaAsignacion();
                    ObjProspecto.ObjMetaAsignacion.ObjVendedorAsignado = new clsUsuario();
                    //ObjProspecto.ObjMetaAsignacion.ObjVendedorAsignado.Id = Convert.ToInt32(dreader[7]);
                    ObjProspecto.ObjMetaAsignacion.ObjVendedorAsignado.Nombre          = dreader["VendedorNombres"].ToString().Trim();
                    ObjProspecto.ObjMetaAsignacion.ObjVendedorAsignado.ApellidoPaterno = dreader["VendedorPaterno"].ToString().Trim();
                    ObjProspecto.ObjMetaAsignacion.ObjVendedorAsignado.ApellidoMaterno = dreader["VendedorMaterno"].ToString().Trim();
                    ObjProspecto.FechaApertura = Convert.ToDateTime(dreader["FechaApertura"]);
                    ObjProspecto.Shipper       = dreader["Shipper"].ToString();

                    ObjProspecto.NombreUsuarioCierra = dreader["UCNombres"].ToString().Trim() + " " +
                                                       dreader["UCierraPaterno"].ToString().Trim() + " " +
                                                       dreader["UCierraMaterno"].ToString().Trim();
                    if (dreader["FechaCierre"] is DBNull)
                    {
                        ObjProspecto.FechaCierre = null;
                    }
                    else
                    {
                        ObjProspecto.FechaCierre = Convert.ToDateTime(dreader["FechaCierre"]);
                    }

                    ObjProspecto.Instruction = dreader["Instruction"].ToString();
                    if (dreader["FechaCancelacion"] is DBNull)
                    {
                        ObjProspecto.FechaCancelacion = null;
                    }
                    else
                    {
                        ObjProspecto.FechaCancelacion = Convert.ToDateTime(dreader["FechaCancelacion"]);
                    }


                    ObjProspecto.ObjMetaObservaciones             = new clsMetaObservaciones();
                    ObjProspecto.ObjMetaObservaciones.Observacion = dreader["Observaciones"].ToString();
                    ObjProspecto.FollowUps = clsClienteMasterADO.ObtenerFollowUpActivosClientePorTarget(ObjProspecto.Id32);
                }


                res.Estado            = Enums.EstadoTransaccion.Aceptada;
                res.Accion            = Entidades.Enums.Enums.AccionTransaccion.Consultar;
                res.ObjetoTransaccion = ObjProspecto;
            }
            catch (Exception ex)
            {
                Log.EscribirLog(ex.Message);

                res.Descripcion  = ex.Message;
                res.ArchivoError = "clsMetaAdo.cs";
                res.MetodoError  = "ListarProspectos";
            }
            finally
            {
                conn.Close();
            }
            return(res);
        }
예제 #26
0
 public bool Guardar(int usuarioID, System.Data.SqlClient.SqlTransaction transaccion)
 {
     try
     {
         Config.Conexion.EjecutarSinResultados(transaccion, "TarifarioClienteFleteTopeINS", this.tarifarioClienteFleteID, this.Tope.TopeID, BaseDatos.DoubleToSql(this.Cm3Hasta), this.Importe, Utiles.BaseDatos.DoubleToSql(this.ImporteBultoExc), usuarioID, this.KgVariable);
         return(true);
     }
     catch (Exception)
     {
         return(false);
     }
 }
예제 #27
0
        public static ResultadoTransaccion BuscaUsuarioPorUserName(string username)
        {
            ResultadoTransaccion res     = new ResultadoTransaccion();
            clsUsuario           usuario = null;

            try {
                //Abrir Conexion
                conn = BaseDatos.NuevaConexion();

                objParams          = SqlHelperParameterCache.GetSpParameterSet(conn, "SP_C_USUARIO_POR_USERNAME");
                objParams[0].Value = username;

                SqlCommand command = new SqlCommand("SP_C_USUARIO_POR_USERNAME", conn);
                command.Parameters.AddRange(objParams);
                command.CommandType = CommandType.StoredProcedure;
                dreader             = command.ExecuteReader();

                while (dreader.Read())
                {
                    usuario                 = new clsUsuario();
                    usuario.Id              = Convert.ToInt64(dreader["Id"]);
                    usuario.Nombre          = dreader["Nombres"].ToString();
                    usuario.ApellidoPaterno = dreader["ApellidoPaterno"].ToString();
                    usuario.ApellidoMaterno = dreader["ApellidoMaterno"].ToString();
                    usuario.NombreUsuario   = dreader["NombreUsuario"].ToString();
                    usuario.Estado          = (Entidades.Enums.Enums.Estado)dreader["Estado"];
                    usuario.FechaCreacion   = (DateTime)dreader["FechaCreacion"];
                    if (!String.IsNullOrEmpty(dreader["SemanasCalendarioCompartido"].ToString()))
                    {
                        usuario.CantidadSemanasCalentarioCompartido = Convert.ToInt64(dreader["SemanasCalendarioCompartido"]);
                    }

                    if (!String.IsNullOrEmpty(dreader["SemanasMiCalendario"].ToString()))
                    {
                        usuario.CantidadSemanasMiCompartido = Convert.ToInt64(dreader["SemanasMiCalendario"]);
                    }

                    usuario.Cargo     = new clsUsuarioCargo(Convert.ToInt16(dreader["IdCargo"]), dreader["Descripcion"].ToString());
                    usuario.CargoEnum = (Entidades.Enums.Enums.UsuariosCargo)Convert.ToInt64(dreader["IdCargo"]);
                    if (dreader["Email"] is DBNull)
                    {
                        usuario.Email = "";
                    }
                    else
                    {
                        usuario.Email = dreader["Email"].ToString();
                    }
                }

                res.Estado            = Entidades.Enums.Enums.EstadoTransaccion.Aceptada;
                res.Accion            = Entidades.Enums.Enums.AccionTransaccion.Consultar;
                res.ObjetoTransaccion = usuario;
            } catch (Exception ex) {
                res.Estado      = Entidades.Enums.Enums.EstadoTransaccion.Rechazada;
                res.Descripcion = ex.Message;
                Base.Log.Log.EscribirLog(ex.Message);
            } finally {
                if (dreader != null)
                {
                    dreader.Close();
                }
                if (conn != null)
                {
                    conn.Close();
                }
            }

            return(res);
        }
예제 #28
0
        public static ResultadoTransaccion ListarContrlDeudoresFecha(DateTime Fecha)
        {
            ResultadoTransaccion  res = new ResultadoTransaccion();
            ClsArrRegistrosGrilla ObjArrRegistrosGrilla = new ClsArrRegistrosGrilla();
            clsArregloDetGrilla   ObjArregloDetGrilla   = new clsArregloDetGrilla();
            clsRegistroGrilla     ObjRegistroGrilla     = new clsRegistroGrilla();

            string RutClienteActual = "";
            int    i = 0;

            try
            {
                //Abrir Conexion
                conn = BaseDatos.Conexion();

                objParams          = SqlHelperParameterCache.GetSpParameterSet(conn, "sp_c_direccion_control_deuda");
                objParams[0].Value = Fecha;

                SqlCommand command = new SqlCommand("sp_c_direccion_control_deuda", conn);

                command.Transaction = transaction;
                command.Parameters.AddRange(objParams);
                command.CommandType = CommandType.StoredProcedure;
                dreader             = command.ExecuteReader();

                while (dreader.Read())
                {
                    // primer cliente
                    if (i == 0)
                    {
                        ObjRegistroGrilla             = new clsRegistroGrilla();
                        ObjRegistroGrilla.Cliente     = dreader[1].ToString();
                        ObjRegistroGrilla.Rut         = dreader[2].ToString();
                        ObjRegistroGrilla.TipoCliente = dreader[3].ToString();

                        ClsDetalleGrilla ObjDetalleGrilla = new ClsDetalleGrilla();

                        ObjDetalleGrilla.Moneda          = dreader[4].ToString();
                        ObjDetalleGrilla.MontoDeuda      = Convert.ToDouble(dreader[5]);
                        ObjDetalleGrilla.MontoDocumentos = Convert.ToDouble(dreader[8]);
                        ObjDetalleGrilla.MontoFacturar   = Convert.ToDouble(dreader[11]);
                        ObjDetalleGrilla.MDeudaMB        = Convert.ToDouble(dreader[6]);
                        ObjDetalleGrilla.MDeudaUSD       = Convert.ToDouble(dreader[7]);
                        ObjDetalleGrilla.MDocuMB         = Convert.ToDouble(dreader[9]);
                        ObjDetalleGrilla.MDocuUSD        = Convert.ToDouble(dreader[10]);
                        ObjDetalleGrilla.MFacMB          = Convert.ToDouble(dreader[12]);
                        ObjDetalleGrilla.MFacUSD         = Convert.ToDouble(dreader[13]);

                        ObjArregloDetGrilla.Add(ObjDetalleGrilla);

                        ObjRegistroGrilla.DeudaMB      = Convert.ToDouble(dreader[6]);
                        ObjRegistroGrilla.DeudaOM      = Convert.ToDouble(dreader[7]);
                        ObjRegistroGrilla.DocuMB       = Convert.ToDouble(dreader[9]);
                        ObjRegistroGrilla.DocuOM       = Convert.ToDouble(dreader[10]);
                        ObjRegistroGrilla.FacturarMB   = Convert.ToDouble(dreader[12]);
                        ObjRegistroGrilla.FacturarOM   = Convert.ToDouble(dreader[13]);
                        ObjRegistroGrilla.TotalDeudaUS = Convert.ToDouble(dreader[16]);
                        // Si cliente viene en blanco quiere decir que está creado sólo en la contabilidad
                        if (dreader[0].ToString().Trim() == "")
                        {
                            ObjRegistroGrilla.TipoRegistro = "Cliente no creado";
                        }
                        else
                        {
                            // En caso que el cliente no tiene definida una línea de crédito
                            if (dreader[15].ToString().Trim() == "")
                            {
                                ObjRegistroGrilla.TipoRegistro   = "Cliente sin definición de crédito";
                                ObjRegistroGrilla.TotalCreditoUS = 0;
                            }
                            else
                            {
                                ObjRegistroGrilla.TipoRegistro   = "Cliente con crédito";
                                ObjRegistroGrilla.TotalCreditoUS = Convert.ToDouble(dreader[15]);
                            }
                        }
                        ObjRegistroGrilla.Riesgo = ObjRegistroGrilla.TotalCreditoUS - ObjRegistroGrilla.TotalDeudaUS;

                        RutClienteActual = ObjRegistroGrilla.Rut;
                        i = 1;
                    }
                    // cliente nuevo
                    else
                    {
                        if (dreader[2].ToString() != RutClienteActual && i != 0)
                        {
                            ObjRegistroGrilla.ArregloDetalle = ObjArregloDetGrilla;
                            ObjArrRegistrosGrilla.Add(ObjRegistroGrilla);

                            ObjArregloDetGrilla = new clsArregloDetGrilla();
                            ObjRegistroGrilla   = new clsRegistroGrilla();

                            ObjRegistroGrilla.TipoRegistro = "";
                            // Si cliente viene en blanco quiere decir que está creado sólo en la contabilidad
                            if (dreader[1].ToString().Trim() == "")
                            {
                                ObjRegistroGrilla.TipoRegistro   = "Cliente no creado";
                                ObjRegistroGrilla.TotalCreditoUS = 0;
                            }

                            ObjRegistroGrilla.Cliente     = dreader[1].ToString();
                            ObjRegistroGrilla.Rut         = dreader[2].ToString();
                            ObjRegistroGrilla.TipoCliente = dreader[3].ToString();

                            ClsDetalleGrilla ObjDetalleGrilla = new ClsDetalleGrilla();

                            ObjDetalleGrilla.Moneda          = dreader[4].ToString();
                            ObjDetalleGrilla.MontoDeuda      = Convert.ToDouble(dreader[5]);
                            ObjDetalleGrilla.MontoDocumentos = Convert.ToDouble(dreader[8]);
                            ObjDetalleGrilla.MontoFacturar   = Convert.ToDouble(dreader[11]);
                            ObjDetalleGrilla.MDeudaMB        = Convert.ToDouble(dreader[6]);
                            ObjDetalleGrilla.MDeudaUSD       = Convert.ToDouble(dreader[7]);
                            ObjDetalleGrilla.MDocuMB         = Convert.ToDouble(dreader[9]);
                            ObjDetalleGrilla.MDocuUSD        = Convert.ToDouble(dreader[10]);
                            ObjDetalleGrilla.MFacMB          = Convert.ToDouble(dreader[12]);
                            ObjDetalleGrilla.MFacUSD         = Convert.ToDouble(dreader[13]);


                            ObjArregloDetGrilla.Add(ObjDetalleGrilla);

                            ObjRegistroGrilla.DeudaMB      = Convert.ToDouble(dreader[6]);
                            ObjRegistroGrilla.DeudaOM      = Convert.ToDouble(dreader[7]);
                            ObjRegistroGrilla.DocuMB       = Convert.ToDouble(dreader[9]);
                            ObjRegistroGrilla.DocuOM       = Convert.ToDouble(dreader[10]);
                            ObjRegistroGrilla.FacturarMB   = Convert.ToDouble(dreader[12]);
                            ObjRegistroGrilla.FacturarOM   = Convert.ToDouble(dreader[13]);
                            ObjRegistroGrilla.TotalDeudaUS = Convert.ToDouble(dreader[16]);
                            // Si cliente viene en blanco quiere decir que está creado sólo en la contabilidad
                            if (dreader[0].ToString().Trim() == "")
                            {
                                ObjRegistroGrilla.TipoRegistro   = "Cliente no creado";
                                ObjRegistroGrilla.TotalCreditoUS = 0;
                            }
                            else
                            {
                                // En caso que el cliente no tiene definida una línea de crédito
                                if (dreader[15].ToString().Trim() == "")
                                {
                                    ObjRegistroGrilla.TipoRegistro   = "Cliente sin definición de crédito";
                                    ObjRegistroGrilla.TotalCreditoUS = 0;
                                }
                                else
                                {
                                    ObjRegistroGrilla.TipoRegistro   = "Cliente con crédito";
                                    ObjRegistroGrilla.TotalCreditoUS = Convert.ToDouble(dreader[15]);
                                }
                            }
                            ObjRegistroGrilla.Riesgo = ObjRegistroGrilla.TotalCreditoUS - ObjRegistroGrilla.TotalDeudaUS;
                            RutClienteActual         = ObjRegistroGrilla.Rut;
                            i = 2;
                        }
                        // mismo cliente
                        //if (dreader[0].ToString() == RutClienteActual )
                        else
                        {
                            ClsDetalleGrilla ObjDetalleGrilla = new ClsDetalleGrilla();

                            ObjDetalleGrilla.Moneda          = dreader[4].ToString();
                            ObjDetalleGrilla.MontoDeuda      = Convert.ToDouble(dreader[5]);
                            ObjDetalleGrilla.MontoDocumentos = Convert.ToDouble(dreader[8]);
                            ObjDetalleGrilla.MontoFacturar   = Convert.ToDouble(dreader[11]);
                            ObjDetalleGrilla.MDeudaMB        = Convert.ToDouble(dreader[6]);
                            ObjDetalleGrilla.MDeudaUSD       = Convert.ToDouble(dreader[7]);
                            ObjDetalleGrilla.MDocuMB         = Convert.ToDouble(dreader[9]);
                            ObjDetalleGrilla.MDocuUSD        = Convert.ToDouble(dreader[10]);
                            ObjDetalleGrilla.MFacMB          = Convert.ToDouble(dreader[12]);
                            ObjDetalleGrilla.MFacUSD         = Convert.ToDouble(dreader[13]);

                            ObjArregloDetGrilla.Add(ObjDetalleGrilla);

                            ObjRegistroGrilla.DeudaMB      = Convert.ToDouble(dreader[6]) + ObjRegistroGrilla.DeudaMB;
                            ObjRegistroGrilla.DeudaOM      = Convert.ToDouble(dreader[7]) + ObjRegistroGrilla.DeudaOM;
                            ObjRegistroGrilla.DocuMB       = Convert.ToDouble(dreader[9]) + ObjRegistroGrilla.DocuMB;
                            ObjRegistroGrilla.DocuOM       = Convert.ToDouble(dreader[10]) + ObjRegistroGrilla.DocuOM;
                            ObjRegistroGrilla.FacturarMB   = Convert.ToDouble(dreader[12]) + ObjRegistroGrilla.FacturarMB;
                            ObjRegistroGrilla.FacturarOM   = Convert.ToDouble(dreader[13]) + ObjRegistroGrilla.FacturarOM;
                            ObjRegistroGrilla.TotalDeudaUS = Convert.ToDouble(dreader[16]) + ObjRegistroGrilla.TotalDeudaUS;
                            // En caso que el cliente no tiene definida una línea de crédito
                            if (dreader[15].ToString().Trim() == "")
                            {
                                ObjRegistroGrilla.TotalCreditoUS = 0;
                            }
                            else
                            {
                                ObjRegistroGrilla.TotalCreditoUS = Convert.ToDouble(dreader[15]);
                            }
                            ObjRegistroGrilla.Riesgo = ObjRegistroGrilla.TotalCreditoUS - ObjRegistroGrilla.TotalDeudaUS;
                            i = 3;
                        }
                    }
                }
                if (i == 1 || i == 3)
                {
                    ObjRegistroGrilla.ArregloDetalle = ObjArregloDetGrilla;
                    ObjArrRegistrosGrilla.Add(ObjRegistroGrilla);
                }
                res.Accion            = Entidades.Enums.Enums.AccionTransaccion.Consultar;
                res.ObjetoTransaccion = ObjArrRegistrosGrilla;
            }
            catch (Exception ex)
            {
                Log.EscribirLog(ex.Message);

                res.Descripcion  = ex.Message;
                res.ArchivoError = "claTargetDao.cs";
                res.MetodoError  = "ListarClienteMasterporUsuario";
            }
            finally
            {
                conn.Close();
            }
            return(res);
        }
예제 #29
0
 public Modelo(MvcMovieContext context)
 {
     bd = new BaseDatos(context);
 }
예제 #30
0
 public ArchivoController(IHostingEnvironment env, BaseDatos baseDatos)
 {
     this.hostingEnv = env;
     _baseDatos      = baseDatos;
 }
예제 #31
0
        public void DaoGetTipoDocumentosTest()
        {
            BaseDatos prueba = new BaseDatos();

            var x = prueba.DaoGetTipoDocumentos();
        }
예제 #32
0
        public bool M_UsuarioDel(int idUsuario, out string mensaje)
        {
            bd = new BaseDatos();

            return(bd.p_UsuarioDel(idUsuario, out mensaje));
        }
예제 #33
0
 public static bool IniciarSesion()
 {
     Datos = new CapaDatos();
     return Datos.AbrirConexion();
 }