Esempio n. 1
0
 public bool Actualizar(Datos.Curso entidad)
 {
     try
     {
         Datos.Curso original = this.Conexion.Cursoes.Find(entidad.Id);
         if (original != null)
         {
             original.IdDeporte = entidad.IdDeporte;
             original.Deporte = entidad.Deporte;
             original.IdProfesor = entidad.IdDeporte;
             original.Profesor = entidad.Profesor;
             original.Nombre = entidad.Nombre;
             original.Observacion = entidad.Observacion;
             original.Duracion = entidad.Duracion;
             original.FechaInicio = entidad.FechaInicio;
             original.FechaFin = entidad.FechaFin;
             original.HoraFin = entidad.HoraFin;
             original.HoraInicio = entidad.HoraInicio;
         }
         this.Conexion.SaveChanges();
         return true;
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 2
0
        private static void AlmacenarEnDatos(Datos dato, int SizeOfBlock, sbyte[] DirectoryTable, byte[,] DataTable)
        {
            byte[] File = dato.losBytes;
            int SizeOfFile = dato.Size;
            int i = LugarVacio(DirectoryTable);
            dato.Dir = i;

            float res = (float)SizeOfFile / 20;
            if (res > (int)res)
                res = (int)res + 1;
            if(res > HowManyFree(DirectoryTable))
                return;

            for (int WhereAmI = 0; WhereAmI < SizeOfFile; WhereAmI++)
            {
                if ((WhereAmI % 20) == 0 && WhereAmI != 0)
                {
                    //asigna el 'current' bloque como usado
                    DirectoryTable[i] = -1;
                    //busca uno nuevo y se lo asigna al 'current'
                    DirectoryTable[i] = LugarVacio(DirectoryTable);
                    //finalmente tomamos uno nuevo
                    i = LugarVacio(DirectoryTable);
                }
                int localWhereAmI = WhereAmI % SizeOfBlock;
                DataTable[i, localWhereAmI] = File[WhereAmI];
            }
            DirectoryTable[i] = -1;
        }
Esempio n. 3
0
        public bool GuardarInfoVehiculo(string strPlaca, string strColor, string strKilometraje, int intEjes, int intCapacidadCarga,DateTime dtmFechaVenceSoat, DateTime dtmFechaTecnomecanica, int IdUsuario)
        {
            Datos datos = new Datos();
            SqlParameter[] sqlParameters1 =
            { new SqlParameter("@strPlaca", strPlaca),
                new SqlParameter("@strColor", strColor),
                new SqlParameter("@strKilometraje", strKilometraje),
                new SqlParameter("@intEjes", intEjes),
                new SqlParameter("@intCapacidadCarga", intCapacidadCarga),
                new SqlParameter("@dtmFechaVenceSoat", dtmFechaVenceSoat),
                new SqlParameter("@dtmFechaTecnomecanica", dtmFechaTecnomecanica),
                new SqlParameter("@IdUsuario", IdUsuario),
            };
            try
            {
                var dtsVehiculo = datos.EjecutarSP("spCMAGuardarInfoVehiculo", sqlParameters1);

                return true;
            }
            catch (Exception e)
            {
                return false;
                throw;

            }
        }
Esempio n. 4
0
        public ABMCliente(Datos.Cliente.CLNT p_CLNT) 
        {
            funcion = Funcion.editar;
            _CLNT = p_CLNT;
            InitializeComponent();
            CrearCampos();
            Application.DoEvents();
            LlenarCampos();

        }
Esempio n. 5
0
 public List<Datos.Area> Buscar(Datos.Area entidad)
 {
     try
     {
         var resultados = conexion.Database.SqlQuery<Datos.Area>(Datos.GeneradorStringSQL.BuscarArea(entidad), new Object[0]);
         return resultados.ToList();
     }
     catch (Exception)
     {
         throw;
     }
 }
 public bool Eliminar(Datos.Profesor entidad)
 {
     try
     {
         Conexion.Profesors.Remove(entidad);
         Conexion.SaveChanges();
         return true;
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 7
0
 public List<Datos.Curso> Buscar(Datos.Curso entidad)
 {
     try
     {
         String sql = Datos.GeneradorStringSQL.BuscarCurso(entidad);
         IEnumerable<Datos.Curso> resultados = Conexion.Database.SqlQuery<Datos.Curso>(sql, new Object[0]);
         return resultados.ToList();
     }
     catch (Exception)
     {
         throw;
     }
 }
 public bool Eliminar(Datos.TipoArea entidad)
 {
     try
     {
         conexion.TipoAreas.Remove(entidad);
         conexion.SaveChanges();
         return true;
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 9
0
 public bool Insertar(Datos.Curso entidad)
 {
     try
     {
         this.Conexion.Cursoes.Add(entidad);
         this.Conexion.SaveChanges();
         return true;
     }
     catch (Exception)
     {
         throw;
     }
 }
 public bool Insertar(Datos.Profesor entidad)
 {
     try
     {
         Conexion.Profesors.Add(entidad);
         Conexion.SaveChanges();
         return true;
     }
     catch (Exception)
     {
         throw;
     }
 }
 public bool Insertar(Datos.TipoArea entidad)
 {
     try
     {
         conexion.TipoAreas.Add(entidad);
         conexion.SaveChanges();
         return true;
     }
     catch (Exception exception)
     {
         throw exception;
     }
 }
Esempio n. 12
0
 public bool Eliminar(Datos.Curso entidad)
 {
     try
     {
         this.Conexion.Cursoes.Remove(entidad);
         this.Conexion.SaveChanges();
         return true;
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 13
0
        private static void BorrarDatos(Datos dato, int SizeOfBlock, sbyte[] DirectoryTable, byte[,] DataTable)
        {
            int SizeOfFile = dato.Size;
            int block = dato.Dir;

            while ( DirectoryTable[block] != -1)
            {
                int tempBlock = DirectoryTable[block];
                DirectoryTable[block] = -2;
                block = tempBlock;

            }
            DirectoryTable[block] = -2;
        }
Esempio n. 14
0
        //*****************************************************************

        static int CosteEstimado(Nodo X, Datos d) {
            int coste = X.Creal;
            int k = X.lugar;
            if(k != d.dest) {
                int minFila = int.MaxValue;
                for(int i = 0; i < d.N; i++) {
                    if(d.T <= d.altura[k, i] && !X.marcado[i]) {
                        minFila = Min(minFila, d.distancia[k, i]);
                    }
                }
                coste += minFila;
            }
            return coste;
        }
 public List<Datos.TipoArea> Buscar(Datos.TipoArea entidad)
 {
     try
     {
         var resultados =
             from a in conexion.TipoAreas
             where a.Descripcion.Contains(entidad.Descripcion)
             select a ;
         return resultados.ToList();
     }
     catch (Exception)
     {
         throw;
     }
 }
 public bool Actualizar(Datos.TipoArea entidad)
 {
     try
     {
         Datos.TipoArea original = conexion.TipoAreas.Find(entidad.Codigo);
         if (original != null)
         {
             original.Descripcion = entidad.Descripcion;
         }
         conexion.SaveChanges();
         return true;
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 17
0
 public DataSet ListarEventos()
 {
     Datos datos = new Datos();
     try
     {
         DataSet dtsEventos = datos.EjecutarSP("spCMAListarEventos", null);
         if (dtsEventos.Tables[0].Rows.Count > 0)
         {
             return dtsEventos;
         }
         return null;
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Esempio n. 18
0
 public bool Actualizar(Datos.Deporte entidad)
 {
     try
     {
         Datos.Deporte original = this.Conexion.Deportes.Find(entidad.Id);
         if (original != null)
         {
             original.Descripcion = entidad.Descripcion;
         }
         this.Conexion.SaveChanges();
         return true;
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 19
0
        public DataSet ObtenerUbicacionAmigos(string strIdMovil)
        {
            var datos = new Datos();
            SqlParameter[] sqlParameters1 =
            { new SqlParameter("@ID_MOVIL", strIdMovil)
            };

            try
            {
                var dataSet = datos.EjecutarSP("spObtenerMovilesAmigos", sqlParameters1);
                return dataSet.Tables[0].Rows.Count > 0 ? dataSet : null;
            }
            catch (Exception e)
            {
                throw;
            }
        }
        //------------------------------------------------------------------------------------------------------------------------------------------------------------
        //------------------------------------------------------------------------------------------------------------------------------------------------------------
        //----------------- FUNCION PARA PODER RECARGAR UNA GRAFICA EXISTENTE Y PODER CREA UNA NUEVA BASANDOSE EN ESTA--------------------------------//
        public Datos funConsultaGrafica(string sFecha, string sTituloGrafica)
        {
            string sTamanoLee="";
            int iTamano;
            int iContador = 0;
            Datos dato = new Datos();

            //----------SELECT QUE OBTIENE EL NUMERO DE PUNTOS QUE LA GRAFICA POSEE--------------//
            OdbcCommand mySqlComando2 = new OdbcCommand(string.Format("SELECT COUNT(MaPUNTO.cx), trgrafica.ctipo, trgrafica.ctitulografica, trgrafica.cejex, trgrafica.cejey FROM MaPUNTO, TrGRAFICA WHERE MaPUNTO.ncodgrafica=TrGRAFICA.ncodgrafica and TrGRAFICA.dfecha='" + sFecha + "' and TrGrafica.ctitulografica='" + sTituloGrafica + "'"), ConexionODBC.Conexion.ObtenerConexion());
            OdbcDataReader mySqlDLector = mySqlComando2.ExecuteReader();
            while (mySqlDLector.Read())
            {
                sTamanoLee = mySqlDLector.GetString(0);
                dato.tipo = mySqlDLector.GetString(1);
                dato.titulo = mySqlDLector.GetString(2);
                dato.nombre_ejex = mySqlDLector.GetString(3);
                dato.nombre_ejey = mySqlDLector.GetString(4);
            }

            iTamano = System.Int32.Parse(sTamanoLee);

            dato.dx = new double[iTamano];
            dato.dy = new double[iTamano];
            dato.sx = new string[iTamano];

            //----------SELECT QUE OBTIENE TODOS LOS PUNTOS DE LA GRAFICA QUE SE DESEA--------------//
            OdbcCommand mySqlComando3 = new OdbcCommand(string.Format("SELECT MaPUNTO.cx, MaPUNTO.cy FROM MaPUNTO, TrGRAFICA WHERE MaPUNTO.ncodgrafica=TrGRAFICA.ncodgrafica and TrGRAFICA.dfecha='" + sFecha + "' and TrGrafica.ctitulografica='" + sTituloGrafica + "'"), ConexionODBC.Conexion.ObtenerConexion());
            OdbcDataReader mySqlDLector2 = mySqlComando3.ExecuteReader();
            while (mySqlDLector2.Read())
            {
                if ((dato.tipo.ToLower() == "lineal") || (dato.tipo.ToLower() == "pie"))
                {
                    dato.dx[iContador] = mySqlDLector2.GetDouble(0);
                    dato.dy[iContador] = mySqlDLector2.GetDouble(1);
                }
                else
                {
                    dato.sx[iContador] = mySqlDLector2.GetString(0);
                    dato.dy[iContador] = mySqlDLector2.GetDouble(1);
                }
                iContador++;
            }

            return dato;
        }
Esempio n. 21
0
        public DataSet ListarNoticias()
        {
            Datos datos = new Datos();

            try
            {
                DataSet dataSet = datos.EjecutarSP("spCMAListarNoticias", null);
                if (dataSet.Tables[0].Rows.Count > 0)
                {
                    return dataSet;
                }
                return null;
            }
            catch (Exception e)
            {
                throw e;
            }
        }
 public bool Actualizar(Datos.Profesor entidad)
 {
     try
     {
         Datos.Profesor original = this.Conexion.Profesors.Find(entidad.Id);
         if (original != null)
         {
             original.Apellido1 = entidad.Apellido1;
             original.Apellido2 = entidad.Apellido2;
             original.Nombres = entidad.Nombres;
             original.Ci = entidad.Ci;
             original.Telefono = entidad.Telefono;
         }
         this.Conexion.SaveChanges();
         return true;
     }
     catch (Exception)
     {
         throw;
     }
 }
Esempio n. 23
0
        public bool GuardarImagenPauta(string strDescripcion,string strImagen)
        {
            string dtmFechaRegistro = DateTime.Now.ToString("dd/MM/yyyy");
            Datos datos = new Datos();
            SqlParameter[] sqlParameters1 =
            { new SqlParameter("@strDescripcionPauta", strDescripcion),
                new SqlParameter("@strUrlImagenPauta",strImagen),
                new SqlParameter("@dtmFechaRegistro",Convert.ToDateTime(dtmFechaRegistro)),
            };
            try
            {
                var dtsPauta = datos.EjecutarSP("spCMAGuardarPauta", sqlParameters1);

                return true;
            }
            catch (Exception e)
            {
                return false;
                throw;

            }
        }
Esempio n. 24
0
        public bool GuardarUbicacionVehiculo(string strNumeroMovil, double dblLatitud, double dblLogintud, DateTime dtmFechaRegistro, int IdVehiculo)
        {
            Datos datos = new Datos();
            SqlParameter[] sqlParameters1 =
            { new SqlParameter("@strNumeroMovil", strNumeroMovil),
                new SqlParameter("@strLatitud", dblLatitud),
                new SqlParameter("@strLogintud", dblLogintud),
                new SqlParameter("@dtmFechaRegistro", dtmFechaRegistro),
                new SqlParameter("@IdVehiculo", IdVehiculo),
            };
            try
            {
                var dtsVehiculo = datos.EjecutarSP("spCMAGuardarUbicacionVehiculo", sqlParameters1);

                return true;
            }
            catch (Exception e)
            {
                return false;
                throw;

            }
        }
Esempio n. 25
0
 internal DataSet GuardarAtencion(Solicitudes solicitud)
 {
     var datos = new Datos();
     SqlParameter[] sqlParameters1 =
     { new SqlParameter("@strImagenSolicitud", solicitud.ImagenUrl),
         new SqlParameter("@strDescripcionSolicitud", solicitud.Solicitud),
         new SqlParameter("@idAreaSolicitud", solicitud.AreaSolicitud),
         new SqlParameter("@logActiva", solicitud.Activa),
         new SqlParameter("@logAtendido", solicitud.Atendido),
         new SqlParameter("@IdAtendido", solicitud.AtendidoPor),
         new SqlParameter("@IdSolicitado", solicitud.SolicitadoPor),
         new SqlParameter("@dtmFechaSolicitud", solicitud.FechaSolicitud),
         new SqlParameter("@@dtmFechaAtencion", solicitud.FechaAtencion),
     };
     try
     {
         var dataSet = datos.EjecutarSP("spCMACrearSolicitud", sqlParameters1);
         return dataSet.Tables[0].Rows.Count > 0 ? dataSet : null;
     }
     catch (Exception e)
     {
         throw;
     }
 }
Esempio n. 26
0
 static void Mostrar(Datos d, Resultado r) {
     Console.Write("Resultado: " + (char)(A + d.orig));
     foreach(int k in r.solución) {
         Console.Write(" -> " + (char)(A + k));
     }
     Console.WriteLine();
 }
Esempio n. 27
0
 static Nodo Raíz(Datos d) {
     Nodo nodo = new Nodo();
     nodo.solución = new int[0];
     nodo.marcado = Enumerable.Range(0, d.N).Select(x => false).ToArray();
     nodo.marcado[d.orig] = true;
     nodo.lugar = d.orig;
     nodo.Creal = 0;
     nodo.Cestimado = CosteEstimado(nodo, d);
     return nodo;
 }
Esempio n. 28
0
        private void button1_Click(object sender, EventArgs e)
        {
            #region validaciones

            if (inputvalor.Value.Equals(0))
            {
                Mensajes.error("Ingrese el valor que desea ajustar");
                return;
            }

            if (String.IsNullOrEmpty(inputmotivo.Text))
            {
                Mensajes.error("Ingrese el motivo del ajuste");
                return;
            }

            if (inputvalor.Value < 0)
            {
                comando = Datos.crearComando();

                comando.Parameters.Clear();
                comando.CommandText = "SELECT valor FROM caja";

                // Al ejecutar la consulta se devuelve un DataTable.
                // --
                DataTable caja = Datos.ejecutarComandoSelect(comando);

                if (caja.Rows.Count == 0)
                {
                    Mensajes.error("No esta configurada la caja, imposible realizar ajuste");
                    return;
                }

                if (Convert.ToDecimal(caja.Rows[0]["valor"].ToString()) < (inputvalor.Value * -1))
                {
                    Mensajes.error("No se puede sacar esa cantidad de la caja, es mayor al saldo actual");
                    return;
                }
            }

            #endregion

            #region transaccion

            if (Mensajes.confirmacion("¿Está seguro de que desea Insertar el registro?") == false)
            {
                return;
            }

            comando = Datos.crearComando();
            comando.Connection.Open();
            MySqlTransaction transaccion = comando.Connection.BeginTransaction();
            comando.Transaction = transaccion;
            bool operacionCorrecta = false;

            string fecha    = DateTime.Now.ToString("yyyy-MM-dd");
            string valor    = inputvalor.Value.ToString();
            string motivo   = inputmotivo.Text;
            string users_id = VGlobales.id_usuario;

            try
            {
                comando.Parameters.Clear();
                comando.CommandText = "INSERT INTO ajustes_caja (fecha, valor, motivo, users_id) VALUES (@fecha, @valor, @motivo, @users_id)";

                comando.Parameters.AddWithValue("@fecha", fecha);
                comando.Parameters.AddWithValue("@valor", valor);
                comando.Parameters.AddWithValue("@motivo", motivo);
                comando.Parameters.AddWithValue("@users_id", users_id);

                comando.ExecuteNonQuery();

                comando.Parameters.Clear();
                comando.CommandText = "UPDATE caja SET valor=valor + @valor";

                comando.Parameters.AddWithValue("@valor", valor);

                comando.ExecuteNonQuery();

                comando.Transaction.Commit();

                operacionCorrecta = true;
            }

            catch
            {
                comando.Transaction.Rollback();
            }
            finally
            {
                comando.Connection.Close();

                if (operacionCorrecta)
                {
                    string formulario  = this.Name;
                    string descripcion = "ACCIÓN: inserción; LOS DATOS DE LA ACCIÓN SON: fecha = " + fecha + ", valor = " + valor + ", motivo = " + motivo + ", users_id = " + users_id + "";
                    Datos.crearLOG(formulario, descripcion);

                    descripcion = "ACCIÓN: modificacion en la caja; LOS DATOS DE LA ACCIÓN SON: valor = " + valor + ", fecha = " + fecha + "";
                    Datos.crearLOG(formulario, descripcion);

                    Mensajes.informacion("El ajuste se ha realizado correctamente.");
                }
                else
                {
                    Mensajes.error("Ocurrió un error en el proceso, imposible crear los saldos iniciales");
                }
            }

            #endregion
        }
Esempio n. 29
0
        static Resultado Calcular(Datos d) {
            LinkedList<Nodo> C = new LinkedList<Nodo>();
            Nodo Y = new Nodo();
            Resultado r = new Resultado();

            Y = Raíz(d);
            Añadir(C, Y);
            r.coste = int.MaxValue;

            while(!EsVacía(C)) {
                Y = Sacar(C);
                if(Y.Cestimado < r.coste) {
                    foreach(Nodo X in Hijos(Y, d)) {
                        if(EsSolución(X, d)) {
                            if(X.Creal < r.coste) {
                                r.coste = X.Creal;
                                r.solución = X.solución;
                            }
                        } else if(EsCompletable(X, d) && X.Cestimado < r.coste) {
                            Añadir(C, X);
                        }
                    }
                }
            }

            return r;
        }
Esempio n. 30
0
        public bool GetExecuteReport(double TimeIni, double TimeFin, string IdVehiculoCodWialon, string PathImages, ref string urlMapaResult)
        {
            string contentJSON           = "";
            string urlTokenLoginForGetId = ""; // "https://hosting.wialon.com/wialon/ajax.html?svc=token/login&params={'token':'86fe6d5c99206c57cb445dd5e83b3c71F90F21B1A3DAF982449802E5D1EE3BA5FD2048E1'}";

            urlTokenLoginForGetId = @"https://hst-api.wialon.com/wialon/ajax.html?svc=token/login&params={""" + "token" + @""":""" + @"86fe6d5c99206c57cb445dd5e83b3c71ACE4B0A51A70875BF0D576FE47F3E444E96EC381""" + "}";

            //PARA LUEGO OBTENER ID
            HttpWebRequest http = (HttpWebRequest)WebRequest.Create(urlTokenLoginForGetId);

            http.Method = "GET";
            WebResponse  response = http.GetResponse();
            Stream       stream   = response.GetResponseStream();
            StreamReader sr       = new StreamReader(stream);

            contentJSON = sr.ReadToEnd();

            string sidsession = @"""" + "eid" + @""":";

            sidsession = contentJSON.Substring(contentJSON.IndexOf(sidsession) + sidsession.Length + 1, 32);

            string urlCleanReport = "https://hst-api.wialon.com/wialon/ajax.html?svc=report/cleanup_result&params={}&sid=[SID_VIALON]";

            urlCleanReport = urlCleanReport.Replace("[SID_VIALON]", sidsession);
            http           = (HttpWebRequest)WebRequest.Create(urlCleanReport);
            http.Method    = "GET";
            response       = http.GetResponse();
            stream         = response.GetResponseStream();
            sr             = new StreamReader(stream);
            contentJSON    = sr.ReadToEnd();

            string urlExecReport = "https://hst-api.wialon.com/wialon/ajax.html?svc=report/exec_report&" +
                                   "params={" +
                                   @"""reportResourceId""" + ":21174665, " +
                                   @"""reportTemplateId""" + ":[WIALON_ID_TEMPLATE_INFORME], " +
                                   @"""reportObjectId""" + ":[Id_Vehiculo], " +
                                   @"""reportObjectSecId""" + ":0, " +
                                   @"""interval""" + ":{ " +
                                   @"""from""" + ":" + TimeIni.ToString() + ", " +
                                   @"""to""" + ":" + TimeFin.ToString() + ", " +
                                   @"""flags""" + ":0 " +
                                   "}" +
                                   "}" +
                                   "&sid=[SID_VIALON]";

            urlExecReport = urlExecReport.Replace("[WIALON_ID_TEMPLATE_INFORME]", ConfigurationManager.AppSettings["WIALON_ID_TEMPLATE_INFORME"].ToString());
            urlExecReport = urlExecReport.Replace("[SID_VIALON]", sidsession);
            urlExecReport = urlExecReport.Replace("[Id_Vehiculo]", IdVehiculoCodWialon);
            http          = (HttpWebRequest)WebRequest.Create(urlExecReport);
            http.Method   = "GET";
            response      = http.GetResponse();
            stream        = response.GetResponseStream();
            sr            = new StreamReader(stream);
            contentJSON   = sr.ReadToEnd();

            JObject rootObject = JObject.Parse(contentJSON);
            JToken  tablas     = ((Newtonsoft.Json.Linq.JProperty)rootObject.First).Value.SelectToken("tables");

            if (tablas.HasValues)
            {
                //Se pide la tabla
                string urlGetRowsTable = "https://hst-api.wialon.com/wialon/ajax.html?svc=report/get_result_rows&" +
                                         @"params={""" + "tableIndex" + @""":0, " +
                                         @"""indexFrom""" + @":0, " +
                                         @"""indexTo""" + @":30}&sid=[SID_VIALON]";
                urlGetRowsTable = urlGetRowsTable.Replace("[SID_VIALON]", sidsession);
                urlGetRowsTable = urlGetRowsTable.Replace("[Id_Vehiculo]", IdVehiculoCodWialon);
                http            = (HttpWebRequest)WebRequest.Create(urlGetRowsTable);
                http.Method     = "GET";
                response        = http.GetResponse();
                stream          = response.GetResponseStream();
                sr          = new StreamReader(stream);
                contentJSON = sr.ReadToEnd();
                JArray arrayFilas = JArray.Parse(contentJSON);
                this.Datos = new DataTable();
                this.Datos.Columns.Add("zone_name"); this.Datos.Columns.Add("zone_type"); this.Datos.Columns.Add("zone_area");
                this.Datos.Columns.Add("time_begin"); this.Datos.Columns.Add("time_end"); this.Datos.Columns.Add("duration_in");
                this.Datos.Columns.Add("duration_ival");
                //"zone_name", "zone_type", "zone_area", "time_begin", "time_end", "duration_in", "duration_ival"

                for (int p = 0; p < arrayFilas.Count; p++)
                {
                    JObject rss2 = (JObject)arrayFilas[p];

                    DataRow DR = Datos.NewRow();
                    DR["zone_name"] = rss2["c"][0].ToString();
                    DR["zone_type"] = rss2["c"][1].ToString();
                    DR["zone_area"] = rss2["c"][2].ToString();

                    JObject rss3 = (JObject)rss2["c"][3];
                    DR["time_begin"] = rss3["t"].ToString();

                    rss3           = (JObject)rss2["c"][4];
                    DR["time_end"] = rss3["t"].ToString();

                    DR["duration_in"]   = rss2["c"][5].ToString();
                    DR["duration_ival"] = rss2["c"][6].ToString();

                    this.Datos.Rows.Add(DR);
                }
                //for (int p = 0; p < tablas.Children; p++)
                //{
                //    JToken Jtoken = arrayAlertas[p];
                //}
            }

            //Obtiene Mapa
            string xml = @"https://hst-api.wialon.com/wialon/ajax.html?svc=report/get_result_map&params={""" + "width" + @""":500," +
                         @"""height" + @""":500}&sid=[SID_VIALON]";

            xml         = xml.Replace("[SID_VIALON]", sidsession);
            http        = (HttpWebRequest)WebRequest.Create(xml);
            http.Method = "GET";
            response    = http.GetResponse();
            stream      = response.GetResponseStream();
            try
            {
                Bitmap bitmap3 = new Bitmap(stream);
                using (MemoryStream memory = new MemoryStream())
                {
                    using (FileStream fs = new FileStream(PathImages + @"\map.png", FileMode.Create, FileAccess.ReadWrite))
                    {
                        bitmap3.Save(memory, ImageFormat.Png);
                        byte[] bytes = memory.ToArray();
                        fs.Write(bytes, 0, bytes.Length);
                    }
                }
            }
            catch (Exception ex)
            {
                sr          = new StreamReader(stream);
                contentJSON = sr.ReadToEnd();
            }

            urlMapaResult = "images/map.png";

            return(true);
        }
 protected void LinkButton1_Click(object sender, EventArgs e)
 {
     RptCourse.DataSource = Datos.GetEmpleados(txtbuscar.Text);
     RptCourse.DataBind();
 }
Esempio n. 32
0
 /// <summary>
 /// Marca en la tabla el schema por defecto
 /// </summary>
 public override void MarkDefaultSchema()
 {
     List.SetPrincipal(PrincipalBase.GetDefaultSchema());
     Datos.ResetBindings(false);
 }
Esempio n. 33
0
        private bool Agregar9500()
        {
            // Se valida la parte de "Partes"
            if (!this.ctlPartes.Validar())
            {
                return(false);
            }
            // Se pide el efectivo, si aplica
            if (!this.ctlCobro.CompletarCobro())
            {
                return(false);
            }
            // Se valida que exista una Medida genérica, para las nuevas partes
            if (Datos.GetEntity <Medida>(q => q.MedidaID == Cat.Medidas.Pieza && q.Estatus) == null)
            {
                UtilLocal.MensajeAdvertencia("No existe una Medida genérica para asignarle a las partes nuevas. No se puede continuar.");
                return(false);
            }

            // Se solicitan la autorizaciones, si se requiere
            int iAutorizoID = 0;

            if (this.ctlPartes.AutorizacionRequeridaPrecio || this.ctlPartes.AutorizacionRequeridaAnticipo)
            {
                string sPermiso = (this.ctlPartes.AutorizacionRequeridaPrecio ? "Autorizaciones.Ventas.9500.PrecioFueraDeRango" :
                                   "Autorizaciones.Ventas.9500.NoAnticipo");
                var Res = UtilLocal.ValidarObtenerUsuario(sPermiso, "Autorización");
                iAutorizoID = (Res.Respuesta == null ? 0 : Res.Respuesta.UsuarioID);
            }

            // Se procede a guardar los datos
            DateTime dAhora = DateTime.Now;
            // Se genera la Cotización 9500
            var o9500 = this.ctlPartes.Generar9500();

            o9500.Fecha            = dAhora;
            o9500.RealizoUsuarioID = this.ctlCobro.VendodorID;
            if (this.ctlCobro.ComisionistaID > 0)
            {
                o9500.ComisionistaClienteID = this.ctlCobro.ComisionistaID;
            }
            // Se genera el detalle del 9500
            var oParteGanancia = this.ctlPartes.ObtenerParteGanancia(null);
            var o9500Detalle   = new List <Cotizacion9500Detalle>();

            foreach (var Parte9500 in this.ctlPartes.Detalle)
            {
                // Si la parte no existe, se agrega
                if (Parte9500.Value.ParteID <= 0)
                {
                    int    iFila          = UtilLocal.findRowIndex(this.ctlPartes.dgvPartes, "Llave", Parte9500.Key);
                    string sNumeroDeParte = Util.Cadena(this.ctlPartes.dgvPartes["NumeroDeParte", iFila].Value);
                    string sDescripcion   = Util.Cadena(this.ctlPartes.dgvPartes["Descripcion", iFila].Value);
                    var    oLinea         = Datos.GetEntity <Linea>(q => q.LineaID == Parte9500.Value.LineaID && q.Estatus);
                    Parte  oParte         = new Parte()
                    {
                        NumeroParte  = sNumeroDeParte,
                        LineaID      = Parte9500.Value.LineaID,
                        MarcaParteID = Parte9500.Value.MarcaParteID,
                        ProveedorID  = Parte9500.Value.ProveedorID,
                        NombreParte  = sDescripcion,
                        Es9500       = true,
                        SubsistemaID = oLinea.SubsistemaID.Valor()
                    };

                    // Se agregan los precios
                    PartePrecio oPartePrecio = null;
                    if (oParteGanancia != null)
                    {
                        oPartePrecio = new PartePrecio()
                        {
                            Costo = Parte9500.Value.Costo,
                            PorcentajeUtilidadUno    = oParteGanancia.PorcentajeDeGanancia1,
                            PorcentajeUtilidadDos    = oParteGanancia.PorcentajeDeGanancia2,
                            PorcentajeUtilidadTres   = oParteGanancia.PorcentajeDeGanancia3,
                            PorcentajeUtilidadCuatro = oParteGanancia.PorcentajeDeGanancia4,
                            PorcentajeUtilidadCinco  = oParteGanancia.PorcentajeDeGanancia5,
                            PrecioUno    = UtilTheos.AplicarRedondeo(Parte9500.Value.Costo * oParteGanancia.PorcentajeDeGanancia1),
                            PrecioDos    = UtilTheos.AplicarRedondeo(Parte9500.Value.Costo * oParteGanancia.PorcentajeDeGanancia2),
                            PrecioTres   = UtilTheos.AplicarRedondeo(Parte9500.Value.Costo * oParteGanancia.PorcentajeDeGanancia3),
                            PrecioCuatro = UtilTheos.AplicarRedondeo(Parte9500.Value.Costo * oParteGanancia.PorcentajeDeGanancia4),
                            PrecioCinco  = UtilTheos.AplicarRedondeo(Parte9500.Value.Costo * oParteGanancia.PorcentajeDeGanancia5)
                        };
                    }

                    // Se guarda
                    Guardar.Parte(oParte, oPartePrecio);
                    Parte9500.Value.ParteID = oParte.ParteID;
                }

                // Se agrega la parte al detalle del 9500
                o9500Detalle.Add(Parte9500.Value);
            }

            // Se guardan los datos de 9500
            Guardar.c9500(o9500, o9500Detalle);

            // Se genera la venta con el anticipo
            var oVenta = new Venta()
            {
                ClienteID        = o9500.ClienteID,
                RealizoUsuarioID = o9500.RealizoUsuarioID
            };
            var oPrecioAnticipo = Datos.GetEntity <PartePrecio>(c => c.ParteID == Cat.Partes.AnticipoClientes && c.Estatus);
            var oVentaDetalle   = new VentaDetalle()
            {
                ParteID           = Cat.Partes.AnticipoClientes,
                Cantidad          = 1,
                PrecioUnitario    = o9500.Anticipo,
                Costo             = oPrecioAnticipo.Costo.Valor(),
                CostoConDescuento = (oPrecioAnticipo.CostoConDescuento ?? oPrecioAnticipo.Costo.Valor())
            };

            Guardar.Venta(oVenta, new List <VentaDetalle>()
            {
                oVentaDetalle
            });

            // Se guarda el dato de la venta con el anticipo en el registro de 9500
            o9500.AnticipoVentaID = oVenta.VentaID;
            Datos.Guardar <Cotizacion9500>(o9500);

            // Se guardan las autorizaciones, si hubiera
            if (this.ctlPartes.AutorizacionRequeridaPrecio)
            {
                VentasProc.GenerarAutorizacion(Cat.AutorizacionesProcesos.c9500PrecioFueraDeRango, Cat.Tablas.Tabla9500, o9500.Cotizacion9500ID, iAutorizoID);
            }
            if (this.ctlPartes.AutorizacionRequeridaAnticipo)
            {
                VentasProc.GenerarAutorizacion(Cat.AutorizacionesProcesos.c9500SinAnticipo, Cat.Tablas.Tabla9500, o9500.Cotizacion9500ID, iAutorizoID);
            }

            // Se muestra una notifiación con el resultado
            UtilLocal.MostrarNotificacion("Cotización 9500 guardada correctamente.");

            return(true);
        }
Esempio n. 34
0
        private void ConfigAfectaciones_Load(object sender, EventArgs e)
        {
            this.cmbOperacion.CargarDatos("ContaConfigAfectacionID", "Operacion", Datos.GetListOf <ContaConfigAfectacion>().OrderBy(c => c.Operacion).ToList());
            this.cmbTipoDePoliza.CargarDatos("ContaTipoPolizaID", "TipoDePoliza", Datos.GetListOf <ContaTipoPoliza>());
            // this.CuentaAuxiliarID.CargarDatos("ContaCuentaAuxiliarID", "CuentaAuxiliar", General.GetListOf<ContaCuentaAuxiliar>());
            this.CargoAbono.Items.AddRange("Cargo", "Abono");
            this.AsigSucursalID.CargarDatos("ContaPolizaAsigSucursalID", "Sucursal", Datos.GetListOf <ContaPolizaAsigSucursal>());
            this.dgvAfectaciones.Inicializar();

            // Se cargan los datos para el grid de búsqueda
            var oDatos = Datos.GetListOf <ContaCuentaAuxiliar>();

            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.Clientes, CuentaAuxiliar = "* CLIENTES"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.Proveedores, CuentaAuxiliar = "* PROVEEDORES"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.Bancos, CuentaAuxiliar = "* BANCOS"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.Agua, CuentaAuxiliar = "* GASTOS"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.InteresesBancarios, CuentaAuxiliar = "* INTERESES BANCARIOS"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.CuentasPorPagarCortoPlazo, CuentaAuxiliar = "* CUENTAS POR PAGAR CORTO PLAZO"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.ReparteDeUtilidades, CuentaAuxiliar = "* REPARTO DE UTILIDADES"
            });

            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.Salarios, CuentaAuxiliar = "* SALARIOS"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.TiempoExtra, CuentaAuxiliar = "* TIEMPO EXTRA"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.PremioDeAsistencia, CuentaAuxiliar = "* PREMIO DE ASISTENCIA"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.PremioDePuntualidad, CuentaAuxiliar = "* PREMIO DE PUNTUALIDAD"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.Vacaciones, CuentaAuxiliar = "* VACACIONES"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.PrimaVacacional, CuentaAuxiliar = "* PRIMA VACACIONAL"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.Aguinaldo, CuentaAuxiliar = "* AGUINALDO"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.Ptu, CuentaAuxiliar = "* PTU"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.Imss, CuentaAuxiliar = "* IMSS"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.Ispt, CuentaAuxiliar = "* ISPT"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.Infonavit, CuentaAuxiliar = "* INFONAVIT"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.RetencionImss, CuentaAuxiliar = "* RETENCIÓN IMSS"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.SubsidioAlEmpleo, CuentaAuxiliar = "* SUBSIDIO AL EMPLEO"
            });
            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.RetencionInfonavit, CuentaAuxiliar = "* RETENCIÓN INFONAVIT"
            });

            oDatos.Add(new ContaCuentaAuxiliar()
            {
                ContaCuentaDeMayorID = Cat.ContaCuentasDeMayor.Nomina2Por, CuentaAuxiliar = "* 2 % SOBRE NÓMINA"
            });

            oDatos.Add(new ContaCuentaAuxiliar()
            {
                RelacionID = Cat.ContaAfectacionesCasosFijos.GerenteDeSucursal, CuentaAuxiliar = "= GERENTE DE SUCURSAL"
            });
            // oDatos.Add(new ContaCuentaAuxiliar() { ContaCuentaDeMayorID = Cat.ContaCuentasAuxiliares., CuentaAuxiliar = "* Clientes" });
            this.oListado = Util.ListaEntityADataTable(oDatos);
        }
Esempio n. 35
0
        /// <summary>
        /// Selecciona un elemento de la tabla
        /// </summary>
        /// <param name="oid">Identificar del elemento</param>
        protected override void Select(long oid)
        {
            int foundIndex = Datos.IndexOf(List.GetItem(oid));

            Datos.Position = foundIndex;
        }
Esempio n. 36
0
        private void CargarDatos()
        {
            Cargando.Mostrar();

            var oParams1 = new Dictionary <string, object>();

            oParams1.Add("Desde", this.dtpDesde1.Value);
            oParams1.Add("Hasta", this.dtpHasta1.Value);
            if (this.cmbSucursal1.SelectedValue != null)
            {
                oParams1.Add("SucursalID", Util.Entero(this.cmbSucursal1.SelectedValue));
            }
            var oParams2 = new Dictionary <string, object>();

            oParams2.Add("Desde", this.dtpDesde2.Value);
            oParams2.Add("Hasta", this.dtpHasta2.Value);
            if (this.cmbSucursal2.SelectedValue != null)
            {
                oParams2.Add("SucursalID", Util.Entero(this.cmbSucursal2.SelectedValue));
            }
            var oDatos  = Datos.ExecuteProcedure <pauContaCuentasPolizasImportes_Result>("pauContaCuentasPolizasImportes", oParams1);
            var oDatos2 = Datos.ExecuteProcedure <pauContaCuentasPolizasImportes_Result>("pauContaCuentasPolizasImportes", oParams2);

            // Se sacan las cuentas de mayor que no aplican
            oDatos = oDatos.Where(c => c.ContaCuentaID == Cat.ContaCuentas.Activo || c.ContaCuentaID == Cat.ContaCuentas.Pasivo ||
                                  c.ContaCuentaID == Cat.ContaCuentas.CapitalContable).ToList();
            oDatos2 = oDatos2.Where(c => c.ContaCuentaID == Cat.ContaCuentas.Activo || c.ContaCuentaID == Cat.ContaCuentas.Pasivo ||
                                    c.ContaCuentaID == Cat.ContaCuentas.CapitalContable).ToList();

            var oPorCuenta1 = oDatos.GroupBy(c => (c.Cuenta + " - " + c.Subcuenta)).Select(c => new { Subcuenta = c.Key, Importe = c.Sum(s => s.Importe) })
                              .ToDictionary(c => c.Subcuenta, d => d.Importe);
            var oPorCuentaDemayor1 = oDatos.GroupBy(c => new { Subcuenta = (c.Cuenta + " - " + c.Subcuenta), c.CuentaDeMayor }).Select(c =>
                                                                                                                                       new { Subcuenta = c.Key.Subcuenta, CuentaDeMayor = c.Key.CuentaDeMayor, Importe = c.Sum(s => s.Importe) }).ToList();
            var oPorCuenta2 = oDatos2.GroupBy(c => (c.Cuenta + " - " + c.Subcuenta)).Select(c => new { Subcuenta = c.Key, Importe = c.Sum(s => s.Importe) })
                              .ToDictionary(c => c.Subcuenta, d => d.Importe);
            var oPorCuentaDemayor2 = oDatos2.GroupBy(c => new { Subcuenta = (c.Cuenta + " - " + c.Subcuenta), c.CuentaDeMayor }).Select(c =>
                                                                                                                                        new { Subcuenta = c.Key.Subcuenta, CuentaDeMayor = c.Key.CuentaDeMayor, Importe = c.Sum(s => s.Importe) }).ToList();

            // Se comienzan a llenar los datos
            this.dgvActivos.Rows.Clear();
            this.dgvPasivos.Rows.Clear();
            decimal      mActivosT1 = oPorCuenta1.Where(c => c.Key.ToLower().StartsWith("activo")).Sum(c => c.Value).Valor();
            decimal      mPasivosT1 = oPorCuenta1.Where(c => !c.Key.ToLower().StartsWith("activo")).Sum(c => c.Value).Valor();
            decimal      mActivosT2 = oPorCuenta2.Where(c => c.Key.ToLower().StartsWith("activo")).Sum(c => c.Value).Valor();
            decimal      mPasivosT2 = oPorCuenta2.Where(c => !c.Key.ToLower().StartsWith("activo")).Sum(c => c.Value).Valor();
            DataGridView oGrid;
            string       sSubcuentaActivos = "", sSubcuentaPasivos = "";

            for (int i = 0; i < oPorCuentaDemayor1.Count; i++)
            {
                var oReg1 = oPorCuentaDemayor1[i];
                var oReg2 = oPorCuentaDemayor2[i];
                if (oReg1.Subcuenta.ToLower().StartsWith("activo"))
                {
                    oGrid = this.dgvActivos;
                    if (sSubcuentaActivos != oReg1.Subcuenta)
                    {
                        sSubcuentaActivos = oReg1.Subcuenta;
                        int iFila = oGrid.Rows.Add(oReg1.Subcuenta, oPorCuenta1[sSubcuentaActivos], Util.DividirONull(oPorCuenta1[sSubcuentaActivos], mActivosT1)
                                                   , oPorCuenta2[sSubcuentaActivos], Util.DividirONull(oPorCuenta2[sSubcuentaActivos], mActivosT2));
                        oGrid.Rows[iFila].DefaultCellStyle.Font = new Font(oGrid.DefaultCellStyle.Font, FontStyle.Bold);
                    }
                }
                else
                {
                    oGrid = this.dgvPasivos;
                    if (sSubcuentaPasivos != oReg1.Subcuenta)
                    {
                        sSubcuentaPasivos = oReg1.Subcuenta;
                        int iFila = oGrid.Rows.Add(oReg1.Subcuenta, oPorCuenta1[sSubcuentaPasivos], Util.DividirONull(oPorCuenta1[sSubcuentaPasivos], mPasivosT1)
                                                   , oPorCuenta2[sSubcuentaPasivos], Util.DividirONull(oPorCuenta2[sSubcuentaPasivos], mPasivosT2));
                        oGrid.Rows[iFila].DefaultCellStyle.Font = new Font(oGrid.DefaultCellStyle.Font, FontStyle.Bold);
                    }
                }

                oGrid.Rows.Add(oReg1.CuentaDeMayor
                               , oReg1.Importe, Util.DividirONull(oReg1.Importe, oPorCuenta1[oReg1.Subcuenta])
                               , oReg2.Importe, Util.DividirONull(oReg2.Importe, oPorCuenta2[oReg2.Subcuenta])
                               , Util.DividirONull(oReg1.Importe, oReg2.Importe));
            }

            Cargando.Cerrar();
        }
Esempio n. 37
0
        public void ActualizarDatos()
        {
            // Se limpian las monedas
            this.LimpiarMonedas();

            // Se llenan los importes
            int      iSucursalID = GlobalClass.SucursalID;
            DateTime dHoy        = DateTime.Today;
            var      oPagos      = Datos.GetListOf <VentasPagosDetalleView>(q => q.SucursalID == iSucursalID && EntityFunctions.TruncateTime(q.Fecha) == dHoy);

            // Se llanan los pagos con comprobantes bancarios
            this.dgvPagosBancarios.Rows.Clear();
            //VentaPagoDetalle oPagoBNegativo;
            foreach (var oPago in oPagos)
            {
                // Solo se cuenta los pagos de tipo bancario
                if (oPago.FormaDePagoID != Cat.FormasDePago.Cheque && oPago.FormaDePagoID != Cat.FormasDePago.Tarjeta &&
                    oPago.FormaDePagoID != Cat.FormasDePago.TarjetaDeDebito && oPago.FormaDePagoID != Cat.FormasDePago.Transferencia)
                {
                    continue;
                }
                // Se verifica si existe un pago contrario, lo cual indica que hubo una devolución de Cheque o Tarjeta
                var oPagoCont = oPagos.FirstOrDefault(q => q.VentaPagoDetalleID != oPago.VentaPagoDetalleID && q.VentaID == oPago.VentaID &&
                                                      q.BancoID == oPago.BancoID && q.Folio == oPago.Folio && q.Cuenta == oPago.Cuenta && q.Importe == (oPago.Importe * -1));
                if (oPagoCont != null)
                {
                    continue;
                }
                // Si ya fue resguardado, se omite
                if (oPago.Resguardado)
                {
                    continue;
                }

                this.dgvPagosBancarios.Rows.Add(oPago.VentaPagoDetalleID, oPago.FormaDePagoID, oPago.FormaDePago, oPago.Importe, oPago.Banco, oPago.Folio, oPago.Cuenta);
            }

            // Se resetean los totales
            this.Cheques = this.Tarjetas = this.Transferencias = 0;

            /*
             * // Se calcula el importe en efectivo
             * var oDia = General.GetEntity<CajaEfectivoPorDia>(q => q.SucursalID == iSucursalID && q.Dia == dHoy && q.Estatus);
             * this.Efectivo = (oDia == null ? 0 : oDia.Inicio);
             * this.Efectivo += oPagos.Where(q => q.FormaDePagoID == Cat.FormasDePago.Efectivo).Sum(q => q.Importe);
             * this.Efectivo += General.GetListOf<CajaIngreso>(q => q.SucursalID == iSucursalID && q.CajaTipoIngresoID == Cat.CajaTiposDeIngreso.Refuerzo
             *  && EntityFunctions.TruncateTime(q.Fecha) == dHoy && q.Estatus).Sum(q => q.Importe);
             * this.Efectivo -= General.GetListOf<CajaEgreso>(q => q.SucursalID == iSucursalID && q.CajaTipoEgresoID == Cat.CajaTiposDeEgreso.Resguardo
             *  && EntityFunctions.TruncateTime(q.Fecha) == dHoy && q.Estatus).Sum(q => q.Importe);
             * // Se calcula el resto de importes
             * this.Transferencias = oPagos.Where(q => q.FormaDePagoID == Cat.FormasDePago.Transferencia && !q.Resguardado).Sum(q => q.Importe);
             * this.Cheques = oPagos.Where(q => q.FormaDePagoID == Cat.FormasDePago.Cheque && !q.Resguardado).Sum(q => q.Importe);
             * this.Tarjetas = oPagos.Where(q => q.FormaDePagoID == Cat.FormasDePago.Tarjeta && !q.Resguardado).Sum(q => q.Importe);
             * // Se llenan las etiquetas
             * this.lblEfectivo.Text = this.Efectivo.ToString(GlobalClass.FormatoDecimal);
             * this.lblTransferencias.Text = this.Transferencias.ToString(GlobalClass.FormatoDecimal);
             * this.lblCheques.Text = this.Cheques.ToString(GlobalClass.FormatoDecimal);
             * this.lblTarjetas.Text = this.Tarjetas.ToString(GlobalClass.FormatoDecimal);
             * this.lblTotal.Text = (this.Efectivo + this.Transferencias + this.Cheques + this.Tarjetas).ToString(GlobalClass.FormatoDecimal);
             *
             * decimal mTruncado = (((int)(this.Efectivo / 100)) * 100);
             * decimal mImporteIdeal = Util.ConvertirDecimal(Config.Valor("Caja.Resguardo.Ideal"));
             * mImporteIdeal += (this.Efectivo - mTruncado);
             * this.lblImporteIdeal.Text = mImporteIdeal.ToString(GlobalClass.FormatoDecimal);
             */

            this.MonedasCambio();
        }
Esempio n. 38
0
        private bool Completar9500()
        {
            // Se validan las partes
            if (!this.ctlComDetalle.Validar())
            {
                return(false);
            }

            //if (Util.ControlAlFrente(this.pnlCompletar) == this.ctlComDetalle)
            //{
            //}

            // Se verifica que se haya hecho el pago del anticipo
            Cotizacion9500 o9500 = this.ctlPartes.oCotizacion9500;

            if (!Datos.Exists <Venta>(c => c.VentaID == o9500.AnticipoVentaID &&
                                      (c.VentaEstatusID == Cat.VentasEstatus.Completada || c.VentaEstatusID == Cat.VentasEstatus.Cobrada)))
            {
                UtilLocal.MensajeAdvertencia("Al parecer no se ha realizado el pago correspondiente al Anticipo. No se puede continuar.");
                return(false);
            }

            // Se confirma la operación
            if (UtilLocal.MensajePregunta(string.Format("¿Estás seguro que deseas completar el 9500 con el folio {0}?\n\n{1}"
                                                        , this.ctlPartes.oCotizacion9500.Cotizacion9500ID, this.ctlPartes.o9500Sel["lisDescripcion"])) != DialogResult.Yes)
            {
                return(false);
            }

            // Se guardan los datos
            DateTime dAhora = DateTime.Now;

            // Se cancela la venta del anticipo

            /* Ya no. Ahora todo esto se hace al cobrar la venta final
             * oVenta.VentaEstatusID = Cat.VentasEstatus.Cancelada;
             * Datos.Guardar<Venta>(oVenta);
             * // Se genera una devolución de efectivo (si se realizó un pago) de la venta cancelada, pues se generará una nueva venta con el importe total
             * if (oVentaPago != null)
             *  VentasProc.GenerarDevolucionDeEfectivo(o9500.AnticipoVentaID.Valor(), o9500.Anticipo);
             */

            // Se genera la venta correspondiente al 9500
            // var o9500Detalle = General.GetListOf<Cotizacion9500Detalle>(q => q.Estatus && q.Cotizacion9500ID == oCotizacion9500.Cotizacion9500ID);
            var oCliente = Datos.GetEntity <Cliente>(q => q.ClienteID == o9500.ClienteID && q.Estatus);
            var oDetalle = this.ctlComDetalle.ProductosSel();
            var oVenta   = new Venta()
            {
                Fecha                 = dAhora,
                ClienteID             = o9500.ClienteID,
                VentaEstatusID        = Cat.VentasEstatus.Realizada,
                RealizoUsuarioID      = o9500.RealizoUsuarioID,
                ComisionistaClienteID = o9500.ComisionistaClienteID
            };
            var oVentaDetalle = new List <VentaDetalle>();

            foreach (var oParte in oDetalle)
            {
                // Se toma el precio de la tabla "PartePrecio", pues pudo haber sido cambiado por el encargado de Compras
                var     oPartePrecio = Datos.GetEntity <PartePrecio>(q => q.ParteID == oParte.ParteID);
                decimal mPrecio      = UtilDatos.PartePrecioDeVenta(oPartePrecio, oCliente.ListaDePrecios);
                // Se agrega la parte al detalle de la venta
                oVentaDetalle.Add(new VentaDetalle()
                {
                    ParteID           = oParte.ParteID,
                    Costo             = oPartePrecio.Costo.Valor(),
                    CostoConDescuento = (oPartePrecio.CostoConDescuento ?? oPartePrecio.Costo.Valor()),
                    Cantidad          = oParte.Cantidad,
                    PrecioUnitario    = UtilTheos.ObtenerPrecioSinIva(mPrecio, 3),
                    Iva = UtilTheos.ObtenerIvaDePrecio(mPrecio, 3)
                });
            }
            // Se guarda la venta
            Guardar.Venta(oVenta, oVentaDetalle);

            // Se modifica el dato de la venta correspondiente al 9500
            o9500.VentaID           = oVenta.VentaID;
            o9500.EstatusGenericoID = Cat.EstatusGenericos.PorCompletar;
            Datos.Guardar <Cotizacion9500>(o9500);

            // Se restaura
            this.ctlPartes.ComCliente = null;
            this.pnlEnTotales.Controls.Remove(this.pnlCompletar);
            this.pnlCompletar.Dispose();
            this.pnlCompletar = null;
            this.CambiarOpcion(eOpcion.Agregar);
            this.ctlPartes.tab9500.SelectedIndex = 0;

            // Se muestra una notifiación con el resultado
            UtilLocal.MostrarNotificacion("Cotización 9500 guardada correctamente.");

            // Se retorna falso para que no se quite la opción de 9500
            return(false);
        }
        private void aLMACENARToolStripMenuItem_Click(object sender, EventArgs e)
        {
            #region validaciones

            if (String.IsNullOrEmpty(inputuser.Text))
            {
                Mensajes.error("Debe Ingresar el USUARIO");
                return;
            }

            if (String.IsNullOrEmpty(inputpass.Text))
            {
                Mensajes.error("Debe Ingresar la CONTRASEÑA");
                return;
            }

            if (String.IsNullOrEmpty(inputtipo_usuario_id.Text))
            {
                Mensajes.error("Debe Seleccionar el TIPO DE USUARIO");
                return;
            }

            if (String.IsNullOrEmpty(inputnombre.Text))
            {
                Mensajes.error("Debe Ingresar el NOMBRE del usuario");
                return;
            }

            if (String.IsNullOrEmpty(inputdocumento.Text))
            {
                Mensajes.error("Debe Ingresar el DOCUMENTO del usuario");
                return;
            }

            if (!inputpass.Text.Equals(inputpass2.Text))
            {
                Mensajes.error("La constraseñas no coinciden");
                return;
            }

            if (inputtipo_usuario_id.SelectedValue.Equals(2) && String.IsNullOrEmpty(inputruta.Text))
            {
                Mensajes.error("Debe asignar una ruta al cobrador");
                return;
            }

            if (inputtipo_usuario_id.SelectedValue.Equals(2))
            {
                comando = Datos.crearComando();

                comando.Parameters.Clear();
                comando.CommandText = "SELECT cantidad FROM cantidad_cobradores";

                // Al ejecutar la consulta se devuelve un DataTable.
                // --
                DataTable cantidadCobradores = Datos.ejecutarComandoSelect(comando);

                int cobradoresPermitidos = Convert.ToInt32(cantidadCobradores.Rows[0]["cantidad"].ToString());

                comando = Datos.crearComando();

                comando.Parameters.Clear();
                comando.CommandText = "SELECT COUNT(id) AS cantidad FROM users WHERE tipo_usuario_id = @tipo_usuario_id AND activo=@activo";
                comando.Parameters.AddWithValue("@tipo_usuario_id", inputtipo_usuario_id.SelectedValue.ToString());
                comando.Parameters.AddWithValue("@activo", "1");

                // Al ejecutar la consulta se devuelve un DataTable.
                // --
                cantidadCobradores = Datos.ejecutarComandoSelect(comando);

                int cobradoresConfigurados = Convert.ToInt32(cantidadCobradores.Rows[0]["cantidad"].ToString());

                if (cobradoresConfigurados >= cobradoresPermitidos)
                {
                    Mensajes.error("La cantidad de Cobradores llego al límite permitido, Imposible Configurar un Nuevo Cobrador");
                    Mensajes.informacion("Si desea ampliar la cantidad de cobradores permitidos, póngase en contacto con el distribuidor del software");
                    return;
                }
            }

            comando = Datos.crearComando();

            comando.Parameters.Clear();
            comando.CommandText = "SELECT user FROM users WHERE user = @user";
            comando.Parameters.AddWithValue("@user", inputuser.Text);

            // Al ejecutar la consulta se devuelve un DataTable.
            // --
            DataTable validacion = Datos.ejecutarComandoSelect(comando);

            if (validacion.Rows.Count > 0)
            {
                Mensajes.error("El nombre de usuario ya existe, imposible almacenar");
                return;
            }

            #endregion

            #region insert

            string fecha           = DateTime.Now.ToString("yyyy-MM-dd hh:mm");
            string user            = inputuser.Text;
            string pass            = inputpass.Text;
            string tipo_usuario_id = inputtipo_usuario_id.SelectedValue.ToString();
            bool   activo          = (bool)inputactivo.Checked;
            string nombre          = inputnombre.Text;
            string documento       = inputdocumento.Text;

            if (Mensajes.confirmacion("¿Está seguro de que desea Insertar el registro?") == false)
            {
                return;
            }

            try
            {
                //Se realiza la inserción de los datos en la base de datos
                comando = Datos.crearComando();

                comando.Parameters.Clear();
                comando.CommandText = "INSERT INTO users (fecha, user, pass, tipo_usuario_id, activo, nombre, documento, rutas_id) VALUES (@fecha, @user, @pass, @tipo_usuario_id, @activo, @nombre, @documento, @rutas_id)";

                comando.Parameters.AddWithValue("@fecha", fecha);
                comando.Parameters.AddWithValue("@user", user);
                comando.Parameters.AddWithValue("@pass", pass);
                comando.Parameters.AddWithValue("@tipo_usuario_id", tipo_usuario_id);
                comando.Parameters.AddWithValue("@activo", activo);
                comando.Parameters.AddWithValue("@nombre", nombre);
                comando.Parameters.AddWithValue("@documento", documento);
                comando.Parameters.AddWithValue("@rutas_id", inputruta.SelectedValue);

                // Ejecutar la consulta y decidir
                // True: caso exitoso
                // false: Error.
                if (Datos.ejecutarComando(comando))
                {
                    // TODO: OPERACIÓN A REALIZAR EN CASO DE ÉXITO.
                    Mensajes.informacion("La inserción se ha realizado correctamente.");

                    string formulario  = this.Name;
                    string descripcion = "ACCIÓN: inserción; LOS DATOS DE LA ACCIÓN SON: fecha = " + fecha + ", user = "******", pass = "******", tipo_usuario_id = " + tipo_usuario_id + ", activo = " + activo + ", nombre = " + nombre + ", documento = " + documento + ", rutas = " + inputruta.SelectedValue + " ";
                    Datos.crearLOG(formulario, descripcion);
                    llenarGridUsuarios();
                }
                else
                {
                    Mensajes.error("Ha ocurrido un error al intentar realizar la inserción.");
                }
            }
            catch
            {
                Mensajes.error("Ha ocurrido un error al intentar realizar la inserción.");
            }

            #endregion
        }
Esempio n. 40
0
 void NuevaEntidad(object entityObject)
 {
     Datos.EjecutarMetodo(ObjetoActual, "Nuevo");
     EstatusNuevo = true;
 }
Esempio n. 41
0
        private bool AccionGuardar()
        {
            // Se realiza la validación correspondiente
            if (!this.Validar())
            {
                return(false);
            }

            Cargando.Mostrar();

            // Se guarda la afectación
            int iAfectacionID = Util.Entero(this.cmbOperacion.SelectedValue);
            var oAfectacion   = Datos.GetEntity <ContaConfigAfectacion>(c => c.ContaConfigAfectacionID == iAfectacionID);

            oAfectacion.ContaTipoPolizaID = Util.Entero(this.cmbTipoDePoliza.SelectedValue);
            Datos.Guardar <ContaConfigAfectacion>(oAfectacion);

            // Se procede a guardar el detalle
            ContaConfigAfectacionDetalle oReg;

            foreach (DataGridViewRow oFila in this.dgvAfectaciones.Rows)
            {
                if (oFila.IsNewRow)
                {
                    continue;
                }

                int iId     = this.dgvAfectaciones.ObtenerId(oFila);
                int iCambio = this.dgvAfectaciones.ObtenerIdCambio(oFila);
                switch (iCambio)
                {
                case Cat.TiposDeAfectacion.Agregar:
                case Cat.TiposDeAfectacion.Modificar:
                    if (iCambio == Cat.TiposDeAfectacion.Agregar)
                    {
                        oReg = new ContaConfigAfectacionDetalle()
                        {
                            ContaConfigAfectacionID = iAfectacionID
                        }
                    }
                    ;
                    else
                    {
                        oReg = Datos.GetEntity <ContaConfigAfectacionDetalle>(c => c.ContaConfigAfectacionDetalleID == iId);
                    }

                    ConfigAfectaciones.TiposDeCuenta eTipo = (ConfigAfectaciones.TiposDeCuenta)oFila.Cells["TipoDeCuenta"].Value;
                    int iCuentaID = Util.Entero(oFila.Cells["CuentaID"].Value);
                    oReg.EsCuentaDeMayor           = (eTipo == ConfigAfectaciones.TiposDeCuenta.CuentaDeMayor);
                    oReg.EsCasoFijo                = (eTipo == ConfigAfectaciones.TiposDeCuenta.CasoFijo);
                    oReg.CuentaID                  = (iCuentaID);
                    oReg.EsCargo                   = (Util.Cadena(oFila.Cells["CargoAbono"].Value) == "Cargo");
                    oReg.ContaPolizaAsigSucursalID = Util.Entero(oFila.Cells["AsigSucursalID"].Value);
                    oReg.Observacion               = Util.Cadena(oFila.Cells["Observacion"].Value);

                    Datos.Guardar <ContaConfigAfectacionDetalle>(oReg);
                    break;

                case Cat.TiposDeAfectacion.Borrar:
                    oReg = Datos.GetEntity <ContaConfigAfectacionDetalle>(c => c.ContaConfigAfectacionDetalleID == iId);
                    Datos.Eliminar <ContaConfigAfectacionDetalle>(oReg);
                    break;
                }
            }

            Cargando.Cerrar();
            return(true);
        }
Esempio n. 42
0
        public List <Permiso> obtenerPermisosList(int usuarioCodigo, int app_codigo)
        {
            Datos capaDatos = new Datos();

            return(capaDatos.obtenerPermisos(usuarioCodigo));
        }
Esempio n. 43
0
 public ReportarParteFaltante(int iParteID)
 {
     InitializeComponent();
     this.oParte = Datos.GetEntity <Parte>(q => q.ParteID == iParteID);
 }
        /// <summary>
        /// Selecciona un elemento de la tabla
        /// </summary>
        /// <param name="oid">Identificar del elemento</param>
        protected override void Select(long oid)
        {
            int foundIndex = Datos.IndexOf(List[List.IndexOf(Datos.Current as IAgenteHipatia)]);

            Datos.Position = foundIndex;
        }
Esempio n. 45
0
        private void CargarDatos()
        {
            Cargando.Mostrar();

            // Se obtiene los datos
            int  iSucursalID   = Util.Entero(this.cmbSucursal.SelectedValue);
            int  iProveedorID  = Util.Entero(this.cmbProveedor.SelectedValue);
            int  iMarcaID      = Util.Entero(this.cmbMarca.SelectedValue);
            int  iLineaID      = Util.Entero(this.cmbLinea.SelectedValue);
            bool bCostoDesc    = this.chkCostoConDescuento.Checked;
            bool bSoloConExist = this.chkSoloConExistencia.Checked;
            var  oDatos        = Datos.GetListOf <PartesExistenciasView>(c =>
                                                                         (iSucursalID == 0 || c.SucursalID == iSucursalID) &&
                                                                         (iProveedorID == 0 || c.ProveedorID == iProveedorID) &&
                                                                         (iMarcaID == 0 || c.MarcaID == iMarcaID) &&
                                                                         (iLineaID == 0 || c.LineaID == iLineaID) &&
                                                                         (!bSoloConExist || c.Existencia > 0)
                                                                         ).OrderBy(c => c.NumeroDeParte).ToList();
            List <PartesExistenciasView> oDatosOr = null;

            // Si no hay sucursal, se agrupan los datos
            if (iSucursalID == 0)
            {
                // Se guarda una copia de los datos originales, para obtener el folio posteriormente, sólo si aplica
                if (this.chkFolioFactura.Checked)
                {
                    oDatosOr = oDatos;
                }
                //
                oDatos = oDatos.GroupBy(g => new { g.ParteID, g.NumeroDeParte, g.Descripcion, g.ProveedorID, g.Proveedor, g.MarcaID, g.Marca, g.LineaID, g.Linea
                                                   , g.Costo, g.CostoConDescuento }).Select(c => new PartesExistenciasView
                {
                    ParteID           = c.Key.ParteID,
                    NumeroDeParte     = c.Key.NumeroDeParte,
                    Descripcion       = c.Key.Descripcion,
                    ProveedorID       = c.Key.ProveedorID,
                    Proveedor         = c.Key.Proveedor,
                    MarcaID           = c.Key.MarcaID,
                    Marca             = c.Key.Marca,
                    LineaID           = c.Key.LineaID,
                    Linea             = c.Key.Linea,
                    Costo             = c.Key.Costo,
                    CostoConDescuento = c.Key.CostoConDescuento,
                    Existencia        = c.Sum(s => s.Existencia),
                    UltimaVenta       = c.Max(m => m.UltimaVenta),
                    UltimaCompra      = c.Max(m => m.UltimaCompra)
                }).ToList();
            }

            // Se verifica si se deben agrupar los datos, y se agrupan
            switch (this.cmbAgrupar.Text)
            {
            case "Proveedor":
                oDatos = oDatos.GroupBy(g => new { g.ProveedorID, g.Proveedor }).Select(c => new PartesExistenciasView
                {
                    Proveedor         = c.Key.Proveedor,
                    Marca             = "",
                    Linea             = "",
                    Costo             = c.Sum(s => s.Costo * s.Existencia),
                    CostoConDescuento = c.Sum(s => s.CostoConDescuento * s.Existencia),
                    Existencia        = c.Sum(s => s.Existencia)
                }).ToList();
                break;

            case "Marca":
                oDatos = oDatos.GroupBy(g => new { g.MarcaID, g.Marca }).Select(c => new PartesExistenciasView
                {
                    Proveedor         = "",
                    Marca             = c.Key.Marca,
                    Linea             = "",
                    Costo             = c.Sum(s => s.Costo * s.Existencia),
                    CostoConDescuento = c.Sum(s => s.CostoConDescuento * s.Existencia),
                    Existencia        = c.Sum(s => s.Existencia)
                }).ToList();
                break;

            case "Línea":
                oDatos = oDatos.GroupBy(g => new { g.LineaID, g.Linea }).Select(c => new PartesExistenciasView
                {
                    Proveedor         = "",
                    Marca             = "",
                    Linea             = c.Key.Linea,
                    Costo             = c.Sum(s => s.Costo * s.Existencia),
                    CostoConDescuento = c.Sum(s => s.CostoConDescuento * s.Existencia),
                    Existencia        = c.Sum(s => s.Existencia)
                }).ToList();
                break;

            case "Marca-Línea":
                oDatos = oDatos.GroupBy(g => new { g.MarcaID, g.Marca, g.LineaID, g.Linea }).Select(c => new PartesExistenciasView
                {
                    Proveedor         = "",
                    Marca             = c.Key.Marca,
                    Linea             = c.Key.Linea,
                    Costo             = c.Sum(s => s.Costo * s.Existencia),
                    CostoConDescuento = c.Sum(s => s.CostoConDescuento * s.Existencia),
                    Existencia        = c.Sum(s => s.Existencia)
                }).ToList();
                break;
            }

            // Se llena el grid
            decimal mExistenciaT = 0, mCostoT = 0;

            this.dgvDatos.Rows.Clear();
            if (this.cmbAgrupar.Text == "")
            {
                foreach (var oReg in oDatos)
                {
                    // Si se agruparon los datos, por no seleccionar sucursal, se llena la última copra
                    if (iSucursalID == 0 && this.chkFolioFactura.Checked)
                    {
                        var oRegMax = oDatosOr.Where(c => c.ParteID == oReg.ParteID).OrderByDescending(c => c.UltimaCompra).FirstOrDefault();
                        // oReg.UltimaCompra = oRegMax.UltimaCompra;
                        oReg.FolioFactura = oRegMax.FolioFactura;
                    }
                    //
                    this.dgvDatos.Rows.Add(oReg.ParteID, oReg.NumeroDeParte, oReg.Descripcion, oReg.Proveedor, oReg.Marca, oReg.Linea
                                           , (bCostoDesc ? oReg.CostoConDescuento : oReg.Costo), oReg.Existencia, ((bCostoDesc ? oReg.CostoConDescuento : oReg.Costo) * oReg.Existencia)
                                           , oReg.UltimaVenta, oReg.UltimaCompra, oReg.FolioFactura);
                    mExistenciaT += oReg.Existencia.Valor();
                    mCostoT      += ((bCostoDesc ? oReg.CostoConDescuento : oReg.Costo) * oReg.Existencia).Valor();
                }
            }
            else
            {
                foreach (var oReg in oDatos)
                {
                    this.dgvDatos.Rows.Add(null, null, null, oReg.Proveedor, oReg.Marca, oReg.Linea, null, oReg.Existencia, (bCostoDesc ? oReg.CostoConDescuento : oReg.Costo));
                    mExistenciaT += oReg.Existencia.Valor();
                    mCostoT      += (bCostoDesc ? oReg.CostoConDescuento : oReg.Costo).Valor();
                }
            }

            // Se agregan los totales
            this.lblExistenciaTotal.Text = mExistenciaT.ToString(GlobalClass.FormatoDecimal);
            this.lblCostoTotal.Text      = mCostoT.ToString(GlobalClass.FormatoMoneda);

            Cargando.Cerrar();
        }
Esempio n. 46
0
        private void HacerTraspaso()
        {
            var frmTraspaso = new MovimientoBancarioGen()
            {
                OrigenBancoCuentaID = this.ConBancoCuentaID, Text = "Traspaso entre cuentas"
            };

            frmTraspaso.LlenarComboCuenta();
            frmTraspaso.lblImporteInfo.Text = this.lblSaldoOperacion.Text;
            frmTraspaso.txtConcepto.Text    = "Traspaso entre cuentas";
            // Para concatenar la cuenta destino
            frmTraspaso.cmbBancoCuenta.SelectedIndexChanged += new EventHandler((s, e) =>
            {
                frmTraspaso.txtConcepto.Text = ("Traspaso entre cuentas - " + frmTraspaso.cmbBancoCuenta.Text);
            });
            // Para validar los datos
            frmTraspaso.delValidar += () => {
                frmTraspaso.ctlError.LimpiarErrores();
                if (frmTraspaso.BancoCuentaID <= 0)
                {
                    frmTraspaso.ctlError.PonerError(frmTraspaso.cmbBancoCuenta, "Debes especificar una cuenta.");
                }
                if (frmTraspaso.Importe == 0)
                {
                    frmTraspaso.ctlError.PonerError(frmTraspaso.txtImporte, "El importe especificado es inválido.");
                }
                return(frmTraspaso.ctlError.Valido);
            };
            if (frmTraspaso.ShowDialog(Principal.Instance) == DialogResult.OK)
            {
                Cargando.Mostrar();

                // Se crea el retiro de la cuenta origen
                var oMovOrigen = new BancoCuentaMovimiento
                {
                    BancoCuentaID = this.ConBancoCuentaID,
                    EsIngreso     = false,
                    Fecha         = frmTraspaso.dtpFecha.Value,
                    FechaAsignado = frmTraspaso.dtpFecha.Value,
                    SucursalID    = GlobalClass.SucursalID,
                    Importe       = frmTraspaso.Importe,
                    Concepto      = frmTraspaso.txtConcepto.Text,
                    Referencia    = GlobalClass.UsuarioGlobal.NombreUsuario
                };
                ContaProc.RegistrarMovimientoBancario(oMovOrigen);
                // Se crea el depósito a la cuenta destino
                var oMovDestino = new BancoCuentaMovimiento
                {
                    BancoCuentaID = frmTraspaso.BancoCuentaID,
                    EsIngreso     = true,
                    Fecha         = frmTraspaso.dtpFecha.Value,
                    FechaAsignado = frmTraspaso.dtpFecha.Value,
                    SucursalID    = GlobalClass.SucursalID,
                    Importe       = frmTraspaso.Importe,
                    Concepto      = frmTraspaso.txtConcepto.Text,
                    Referencia    = GlobalClass.UsuarioGlobal.NombreUsuario
                };
                ContaProc.RegistrarMovimientoBancario(oMovDestino);

                // Se crea la póliza sencilla correspondiente (AfeConta)
                var oCuentaOrigen    = Datos.GetEntity <BancoCuenta>(c => c.BancoCuentaID == oMovOrigen.BancoCuentaID);
                var oCuentaDestino   = Datos.GetEntity <BancoCuenta>(c => c.BancoCuentaID == oMovDestino.BancoCuentaID);
                var oCuentaAuxOrigen = Datos.GetEntity <ContaCuentaAuxiliar>(c => c.ContaCuentaDeMayorID ==
                                                                             (oCuentaOrigen.EsCpcp ? Cat.ContaCuentasDeMayor.CuentasPorPagarCortoPlazo : Cat.ContaCuentasDeMayor.Bancos) && c.RelacionID == oMovOrigen.BancoCuentaID);
                var oCuentaAuxDestino = Datos.GetEntity <ContaCuentaAuxiliar>(c => c.ContaCuentaDeMayorID ==
                                                                              (oCuentaDestino.EsCpcp ? Cat.ContaCuentasDeMayor.CuentasPorPagarCortoPlazo : Cat.ContaCuentasDeMayor.Bancos) && c.RelacionID == oMovDestino.BancoCuentaID);
                if (oCuentaAuxOrigen == null || oCuentaAuxDestino == null)
                {
                    Cargando.Cerrar();
                    UtilLocal.MensajeAdvertencia("No se encontró las cuenta auxiliar de alguna de las cuentas bancarias. No se realizará la Póliza.");
                }
                else
                {
                    var oPoliza = ContaProc.CrearPoliza(Cat.ContaTiposDePoliza.Diario, oMovOrigen.Concepto, oCuentaAuxDestino.ContaCuentaAuxiliarID,
                                                        oCuentaAuxOrigen.ContaCuentaAuxiliarID, oMovOrigen.Importe, oMovOrigen.Referencia, Cat.Tablas.BancoCuentaMovimiento, oMovOrigen.BancoCuentaMovimientoID);
                    oPoliza.Fecha = oMovOrigen.Fecha;
                    Datos.Guardar <ContaPoliza>(oPoliza);
                }

                Cargando.Cerrar();
                this.LlenarConciliaciones();
            }
            frmTraspaso.Dispose();
        }
 protected void txtbuscar_TextChanged(object sender, EventArgs e)
 {
     RptCourse.DataSource = Datos.GetEmpleados(txtbuscar.Text);
     RptCourse.DataBind();
 }
Esempio n. 48
0
        private void AgruparMovimientos()
        {
            // Se obtienen los movimientos marcados
            var     oMovsIds = new List <int>();
            decimal mDeposito = 0, mRetiro = 0;

            foreach (DataGridViewRow oFila in this.dgvConciliacion.Rows)
            {
                if (!Util.Logico(oFila.Cells["con_Sel"].Value))
                {
                    continue;
                }
                mDeposito += Util.Decimal(oFila.Cells["con_Depositos"].Value);
                mRetiro   += Util.Decimal(oFila.Cells["con_Retiros"].Value);
                oMovsIds.Add(Util.Entero(oFila.Cells["con_BancoCuentaMovimientoID"].Value));
            }

            // Se valida que haya movimientos o importe
            if ((mDeposito + mRetiro) == 0)
            {
                UtilLocal.MensajeAdvertencia("No hay ningún movimiento seleccionado o el importe es igual a cero.");
                return;
            }
            // Se valida que sean puros depósitos o puros retiros
            if (mDeposito > 0 && mRetiro > 0)
            {
                UtilLocal.MensajeAdvertencia("No es posible agrupar movimientos de tipo depósito con movimientos de tipo retiro.");
                return;
            }

            // Se abre forma para guardar los datos
            var frmDatos = new AgruparMovimientosBancarios();

            frmDatos.Deposito = (mDeposito > 0);
            frmDatos.Importe  = (mDeposito + mRetiro);
            // Se llenan los datos con el primer movimiento seleccionado
            int iPrimerMovID = oMovsIds[0];
            var oPrimerMov   = Datos.GetEntity <BancoCuentaMovimiento>(c => c.BancoCuentaMovimientoID == iPrimerMovID);

            frmDatos.Fecha      = oPrimerMov.FechaAsignado.Valor();
            frmDatos.SucursalID = oPrimerMov.SucursalID;
            frmDatos.Concepto   = oPrimerMov.Concepto;
            frmDatos.Referencia = oPrimerMov.Referencia;
            // Se muestra el formulario
            if (frmDatos.ShowDialog(Principal.Instance) == DialogResult.OK)
            {
                Cargando.Mostrar();
                // Se obtienen los movimientos a agrupar
                var oMovs = new List <BancoCuentaMovimiento>();
                foreach (int iModID in oMovsIds)
                {
                    oMovs.Add(Datos.GetEntity <BancoCuentaMovimiento>(c => c.BancoCuentaMovimientoID == iModID));
                }
                // Se genera y guarda el movimiento agrupador
                var oMovAgrupador = new BancoCuentaMovimiento()
                {
                    BancoCuentaID  = oPrimerMov.BancoCuentaID,
                    EsIngreso      = (mDeposito > 0),
                    Fecha          = DateTime.Now,
                    FechaAsignado  = frmDatos.Fecha,
                    SucursalID     = frmDatos.SucursalID,
                    Importe        = oMovs.Sum(c => c.Importe),
                    Concepto       = frmDatos.Concepto,
                    Referencia     = frmDatos.Referencia,
                    SaldoAcumulado = oMovs.OrderBy(c => c.FechaAsignado).Last().SaldoAcumulado
                };
                Datos.Guardar <BancoCuentaMovimiento>(oMovAgrupador);
                // Se agrupan los movimientos
                foreach (var oMov in oMovs)
                {
                    oMov.MovimientoAgrupadorID = oMovAgrupador.BancoCuentaMovimientoID;
                    Datos.Guardar <BancoCuentaMovimiento>(oMov);
                }
                // Se recalcula el acumulado
                this.RecalcularAcumulado(oMovAgrupador.FechaAsignado.Valor());
                //
                Cargando.Cerrar();
                this.LlenarConciliaciones();
            }
            frmDatos.Dispose();
        }
        public List <ObtieneCategoriaResult> Post(Datos Datos)
        {
            string UsuarioDesencripta = Seguridad.DesEncriptar(Datos.Usuario);

            DocumentoEntrada entrada = new DocumentoEntrada
            {
                Usuario     = UsuarioDesencripta,
                Origen      = "Programa CGE", //Datos.Origen;
                Transaccion = 120796,
                Operacion   = 16              //regresa una tabla con todos los campos de la tabla ( La cantidad de registros depende del filtro enviado)
            };


            entrada.agregaElemento("requisicion", Datos.Requisicion);
            entrada.agregaElemento("valida", Datos.Valida);

            DocumentoSalida respuesta = PeticionCatalogo(entrada.Documento);

            if (respuesta.Resultado == "1")
            {
                string[] GrMatId           = new string[100];
                string[] GrMatNombre       = new string[100];
                string[] GrMatPrecio       = new string[100];
                string[] GrMatIva          = new string[100];
                string[] GrMatGrupo        = new string[100];
                string[] GrMatUnidadMedida = new string[100];

                string TipoNodo = "";
                int    indice;

                indice = 0;

                string xmlData = respuesta.Documento.InnerXml;

                StringBuilder output = new StringBuilder();

                using (XmlReader reader = XmlReader.Create(new StringReader(xmlData)))
                {
                    XmlWriterSettings ws = new XmlWriterSettings();
                    ws.Indent = true;
                    using (XmlWriter writer = XmlWriter.Create(output, ws))
                    {
                        while (reader.Read())
                        {
                            // Only detect start elements.
                            switch (reader.NodeType)
                            {
                            case XmlNodeType.Element:     // The node is an element.

                                if (reader.Name == "GrMatId")
                                {
                                    TipoNodo = "GrMatId";
                                }
                                else if (reader.Name == "GrMatNombre")
                                {
                                    TipoNodo = "GrMatNombre";
                                }
                                else if (reader.Name == "GrMatPrecio")
                                {
                                    TipoNodo = "GrMatPrecio";
                                }
                                else if (reader.Name == "GrMatIva")
                                {
                                    TipoNodo = "GrMatIva";
                                }
                                else if (reader.Name == "GrMatGrupo")
                                {
                                    TipoNodo = "GrMatGrupo";
                                }
                                else if (reader.Name == "GrMatUnidadMedida")
                                {
                                    TipoNodo = "GrMatUnidadMedida";
                                }

                                break;

                            case XmlNodeType.Text:
                                if (TipoNodo == "GrMatId")
                                {
                                    GrMatId[indice] = Convert.ToString(reader.Value);
                                    TipoNodo        = "";
                                }
                                else if (TipoNodo == "GrMatNombre")
                                {
                                    GrMatNombre[indice] = Convert.ToString(reader.Value);
                                    TipoNodo            = "";
                                }
                                else if (TipoNodo == "GrMatPrecio")
                                {
                                    GrMatPrecio[indice] = Convert.ToString(reader.Value);
                                    TipoNodo            = "";
                                }
                                else if (TipoNodo == "GrMatIva")
                                {
                                    GrMatIva[indice] = Convert.ToString(reader.Value);

                                    TipoNodo = "";
                                }
                                else if (TipoNodo == "GrMatGrupo")
                                {
                                    GrMatGrupo[indice] = Convert.ToString(reader.Value);

                                    TipoNodo = "";
                                }
                                else if (TipoNodo == "GrMatUnidadMedida")
                                {
                                    GrMatUnidadMedida[indice] = Convert.ToString(reader.Value);
                                    indice   = indice + 1;
                                    TipoNodo = "";
                                }
                                break;
                            }
                        }
                    }

                    List <ObtieneCategoriaResult> lista = new List <ObtieneCategoriaResult>();

                    for (int i = 0; i <= indice - 1; i++)
                    {
                        ObtieneCategoriaResult ent = new ObtieneCategoriaResult
                        {
                            GrMatId           = GrMatId[i],
                            GrMatNombre       = GrMatNombre[i],
                            GrMatPrecio       = GrMatPrecio[i],
                            GrMatIva          = GrMatIva[i],
                            GrMatGrupo        = GrMatGrupo[i],
                            GrMatUnidadMedida = GrMatUnidadMedida[i],
                        };

                        lista.Add(ent);
                    }


                    return(lista);
                }



                // return respuesta.Documento;
            }
            else
            {
                var errores = respuesta.Documento;

                return(null);
            }
        }
Esempio n. 50
0
        public List <ParametrosSalidaResult> Post(Datos Datos)
        {
            try
            {
                string UsuarioDesencripta  = Seguridad.DesEncriptar(Datos.Usuario);
                string EmpleadoDesencripta = Seguridad.DesEncriptar(Datos.Empleado);

                DocumentoEntrada entrada = new DocumentoEntrada
                {
                    Usuario     = UsuarioDesencripta,
                    Origen      = "AdminApp",
                    Transaccion = 120037,
                    Operacion   = 17
                };

                entrada.agregaElemento("GrEmpId", EmpleadoDesencripta);

                DocumentoSalida respuesta = PeticionCatalogo(entrada.Documento);

                DataTable DTRequisiciones = new DataTable();

                if (respuesta.Resultado == "1")
                {
                    DTRequisiciones = respuesta.obtieneTabla("Empleados");

                    List <ParametrosSalidaResult> lista = new List <ParametrosSalidaResult>();

                    foreach (DataRow row in DTRequisiciones.Rows)
                    {
                        ParametrosSalidaResult ent = new ParametrosSalidaResult
                        {
                            Empleado = Convert.ToString(row["Empleado"]),
                            Nombre   = Convert.ToString(row["Nombre"]),
                            Usuario  = Convert.ToString(row["Usuario"]),
                        };
                        lista.Add(ent);
                    }
                    return(lista);
                }
                else
                {
                    var errores = respuesta.Errores.InnerText;

                    List <ParametrosSalidaResult> lista = new List <ParametrosSalidaResult>();

                    ParametrosSalidaResult ent = new ParametrosSalidaResult
                    {
                        Empleado = "Error",
                        Nombre   = Convert.ToString(errores),
                    };

                    lista.Add(ent);

                    return(lista);
                }
            }
            catch (Exception ex)
            {
                List <ParametrosSalidaResult> lista = new List <ParametrosSalidaResult>();

                ParametrosSalidaResult ent = new ParametrosSalidaResult
                {
                    Empleado = "Error ex",
                    Nombre   = ex.ToString(),
                };

                lista.Add(ent);

                return(lista);
            }
        }
Esempio n. 51
0
        //*****************************************************************

        public static void Resolver() {
            const int N = 7;

            Datos d = new Datos();
            d.N = N;
            d.T = 8;
            d.altura = new int[N, N]
            { //  A  B  C  D  E  F  G
                { 0, 9, 0, 9, 0, 0, 0 }, // A
                { 9, 0, 9, 9, 7, 0, 0 }, // B
                { 0, 9, 0, 0, 9, 0, 0 }, // C
                { 9, 9, 0, 0, 7, 9, 0 }, // D
                { 0, 7, 9, 7, 0, 7, 9 }, // E
                { 0, 0, 0, 9, 7, 0, 9 }, // F
                { 0, 0, 0, 0, 9, 9, 0 }  // G
            };
            d.distancia = new int[N, N]
            { // A  B  C   D   E   F   G
                {I, 7, I,  5,  I,  I,  I}, // A
                {7, I, 8,  9,  7,  I,  I}, // B
                {I, 8, I,  I,  5,  I,  I}, // C
                {5, 9, I,  I, 15,  6,  I}, // D
                {I, 7, 5, 15,  I,  8,  9}, // E
                {I, I, I,  6,  8,  I, 11}, // F
                {I, I, I,  I,  9, 11,  I}  // G
            };
            d.orig = 0;
            d.dest = 6;

            Resultado r = Calcular(d);
            Mostrar(d, r);
        }
Esempio n. 52
0
 protected override void AddAction()
 {
     _list.NewItem();
     Datos.ResetBindings(false);
 }
Esempio n. 53
0
        public void newUsuario(string usuario, string contrasena)
        {
            Datos capaDatos = new Datos();

            capaDatos.nuevoUsuario(usuario, contrasena);
        }
Esempio n. 54
0
        public JsonResult Usuario(int id)
        {
            var oUsuario = Datos.GetEntity <Usuario>(c => c.UsuarioID == id && c.Estatus);

            return(this.Json(new { oUsuario.UsuarioID, Usuario = oUsuario.NombreUsuario }));
        }
Esempio n. 55
0
 public void MostrarDatos(Datos.Alumno alumno)
 {
     textBox1.Text = alumno.Legajo;
     textBox2.Text = alumno.Nombre;
     textBox3.Text = alumno.Apellido;
 }
Esempio n. 56
0
        public JsonResult Sucursal(int id)
        {
            var oSucursal = Datos.GetEntity <Sucursal>(c => c.SucursalID == id && c.Estatus);

            return(this.Json(new { oSucursal.SucursalID, Sucursal = oSucursal.NombreSucursal }));
        }
Esempio n. 57
0
        // Agregar Usuarios
        public void Agregar_Usuarios()
        {
            try
            {
                cnGeneral = new Datos();
                SqlParameter[] parParameter = new SqlParameter[10];
                parParameter[0] = new SqlParameter();
                parParameter[0].ParameterName = "@opcion";
                parParameter[0].SqlDbType     = SqlDbType.Int;
                parParameter[0].SqlValue      = OBJusuarios.Opc;

                parParameter[1] = new SqlParameter();
                parParameter[1].ParameterName = "@cedula_usuario ";
                parParameter[1].SqlDbType     = SqlDbType.VarChar;
                parParameter[1].Size          = 50;
                parParameter[1].SqlValue      = OBJusuarios.Cedula_usuario;

                parParameter[2] = new SqlParameter();
                parParameter[2].ParameterName = "@nombre_usuario";
                parParameter[2].SqlDbType     = SqlDbType.VarChar;
                parParameter[2].Size          = 50;
                parParameter[2].SqlValue      = OBJusuarios.Nombre_usuario;

                parParameter[3] = new SqlParameter();
                parParameter[3].ParameterName = "@apellido1";
                parParameter[3].SqlDbType     = SqlDbType.VarChar;
                parParameter[3].Size          = 50;
                parParameter[3].SqlValue      = OBJusuarios.Apellido1;

                parParameter[4] = new SqlParameter();
                parParameter[4].ParameterName = "@apellido2";
                parParameter[4].SqlDbType     = SqlDbType.VarChar;
                parParameter[4].Size          = 50;
                parParameter[4].SqlValue      = OBJusuarios.Apellido2;

                parParameter[5] = new SqlParameter();
                parParameter[5].ParameterName = "@nick_name";
                parParameter[5].SqlDbType     = SqlDbType.VarChar;
                parParameter[5].Size          = 50;
                parParameter[5].SqlValue      = OBJusuarios.Nick_name;

                parParameter[6] = new SqlParameter();
                parParameter[6].ParameterName = "@correo_electronico";
                parParameter[6].SqlDbType     = SqlDbType.VarChar;
                parParameter[6].Size          = 50;
                parParameter[6].SqlValue      = OBJusuarios.Correo_electronico;

                parParameter[7] = new SqlParameter();
                parParameter[7].ParameterName = "@clave_usuario";
                parParameter[7].SqlDbType     = SqlDbType.VarChar;
                parParameter[7].Size          = 50;
                parParameter[7].SqlValue      = OBJusuarios.Clave_usuario;

                parParameter[8] = new SqlParameter();
                parParameter[8].ParameterName = "@rol";
                parParameter[8].SqlDbType     = SqlDbType.VarChar;
                parParameter[8].Size          = 50;
                parParameter[8].SqlValue      = OBJusuarios.Rol;

                parParameter[9] = new SqlParameter();
                parParameter[9].ParameterName = "@estado";
                parParameter[9].SqlDbType     = SqlDbType.VarChar;
                parParameter[9].Size          = 50;
                parParameter[9].SqlValue      = OBJusuarios.Estado;

                cnGeneral.EjecutarSP(parParameter, "SPUsuario_los_negritos");
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
        }
Esempio n. 58
0
 private void ImprimirEtiquetas_Load(object sender, EventArgs e)
 {
     this.cmbLinea.CargarDatos("LineaID", "NombreLinea", Datos.GetListOf <Linea>(q => q.Estatus).OrderBy(o => o.NombreLinea).ToList());
     this.cmbSucursales.CargarDatos("SucursalID", "NombreSucursal", Datos.GetListOf <Sucursal>(c => c.Estatus));
 }
Esempio n. 59
0
        public string Traspaso(int iTraspasoID)
        {
            var o = Datos.GetEntity <MovimientoInventarioTraspasosView>(c => c.MovimientoInventarioID == iTraspasoID);

            return(new System.Web.Script.Serialization.JavaScriptSerializer().Serialize(o));
        }
Esempio n. 60
0
        public List <string> obtenerRutasList(int api_codigo)
        {
            Datos capaDatos = new Datos();

            return(capaDatos.obtenerRutas(api_codigo));
        }