예제 #1
0
        public DatosPresupuesto consultSociedad(string user)
        {
            DatosPresupuesto sociedades = new DatosPresupuesto();

            sociedades.sociedad = db.USUARIOs.Where(a => a.ID.Equals(user)).FirstOrDefault().SOCIEDADs.ToList();
            return(sociedades);
        }
예제 #2
0
        public DatosPresupuesto consultSociedad()
        {
            DatosPresupuesto sociedades = new DatosPresupuesto();

            sociedades.sociedad = db.SOCIEDADs.Where(x => x.ACTIVO == true).ToList();
            return(sociedades);
        }
 public void consultSociedad(ref DatosPresupuesto sociedades, string sociedad, string usuario)
 {
     sociedades.sociedad = db.USUARIOs.Where(a => a.ID.Equals(usuario)).FirstOrDefault().SOCIEDADs.ToList();
     if (String.IsNullOrEmpty(sociedad) == false)
     {
         sociedades.cambio = db.CSP_CAMBIO(sociedad).ToList();
     }
 }
예제 #4
0
        public DatosPresupuesto consultSociedad(string sociedad)
        {
            DatosPresupuesto sociedades = new DatosPresupuesto();

            sociedades.sociedad = db.SOCIEDADs.Where(x => x.ACTIVO == true).ToList();
            if (String.IsNullOrEmpty(sociedad) == false)
            {
                sociedades.cambio = db.CSP_CAMBIO(sociedad).ToList();
            }
            return(sociedades);
        }
        public DatosPresupuesto consultarDatos(string[] sociedad, string anio, string periodo, string cambio, string cpt, string excel, string ruta, string usuario)
        {
            DatosPresupuesto sociedades = new DatosPresupuesto();
            string           anioc      = "";// periodoc = "";
            string           chkcpt     = "";

            for (int i = 0; i < sociedad.Length; i++)
            {
                consultSociedad(ref sociedades, sociedad[i], usuario);
                if (String.IsNullOrEmpty(anio) == false)
                {
                    anioc = anio.Substring(2, 2);
                }
                //if (String.IsNullOrEmpty(periodo) == false)
                //{
                //    periodoc = periodo;
                //}
                if (String.IsNullOrEmpty(cpt) == false)
                {
                    chkcpt = "X";
                }
                if (String.IsNullOrEmpty(cambio) == false && sociedades.cambio.Count > 0)
                {
                    string[] moneda = cambio.Split('-');
                    sociedades.presupuesto.AddRange(db.CSP_CONSULTARPRESUPUESTO(sociedad[i], anioc, anio, periodo, periodo, sociedades.cambio[0].FCURR, moneda[1], chkcpt).ToList());
                }
                else
                {
                    sociedades.presupuesto.AddRange(db.CSP_CONSULTARPRESUPUESTO(sociedad[i], anioc, anio, periodo, periodo, "", "", chkcpt).ToList());
                }
            }
            if (excel != null)
            {
                string[] moneda = new string[1];
                if (String.IsNullOrEmpty(cambio) == false)
                {
                    moneda = cambio.Split('-');
                }
                else if (sociedades.cambio.Count > 0)
                {
                    moneda[0] = sociedades.cambio[0].FCURR;
                }
                generarRepPresuExcel(sociedades.presupuesto, sociedad, moneda[0], consultarUCarga(), ruta, cpt);
            }
            return(sociedades);
        }
예제 #6
0
        public string guardarPresupuesto(ref DatosPresupuesto presupuesto, string[] sociedadcpt, string[] periodocpt, string[] sociedadsap, string[] periodosap, string usuario, string opciong, string idioma, int pagina)
        {
            TAT001Entities db = new TAT001Entities();
            string         mensaje = "", soc = "", pre = "";
            int            ide      = 0;
            string         opc      = "1";
            string         sociedad = "";

            if (opciong != "on")
            {
                opc = "2";
            }
            if (presupuesto.presupuestoCPT.Count > 0)
            {
                soc = ""; pre = "";
                sociedadPeriodo(sociedadcpt, periodocpt, true, ref soc, ref pre);
                var id = db.CSP_PRESUPUESTO_ADD(Convert.ToInt32(presupuesto.presupuestoCPT[0].ANIO), soc, pre, usuario, "0", 1).ToList();
                if (id.Count > 0)
                {
                    ide = Convert.ToInt32(id[0].ToString());
                    if (ide != 0)
                    {
                        for (int i = 0; i < presupuesto.presupuestoCPT.Count; i++)
                        {
                            presupuesto.presupuestoCPT[i].ID = ide;
                        }
                        db.BulkInsert(presupuesto.presupuestoCPT);
                        for (int i = 0; i < sociedadcpt.Length; i++)
                        {
                            sociedad += sociedadcpt[i] + ",";
                        }
                        presupuesto.bannerscanal = db.CSP_BANNERSINCANAL(sociedad).ToList();
                        mensaje = mensajes(15, idioma, pagina); //"Guardado Correctamente CPT.";
                    }
                    else
                    {
                        mensaje = mensajes(10, idioma, pagina); //"El usuario con el que se esta cargando los datos no exitene en el sistema.";
                    }
                }
                else
                {
                    mensaje = mensajes(11, idioma, pagina); //"Ocurrio algo mientra se guardaba.";
                }
            }
            if (presupuesto.presupuestoSAP.Count > 0)
            {
                soc = ""; pre = "";
                sociedadPeriodo(sociedadsap, periodosap, false, ref soc, ref pre);
                var id = db.CSP_PRESUPUESTO_ADD(presupuesto.presupuestoSAP[0].ANIO, soc, pre, usuario, opc, 2).ToList();//0 remplazar 1 añadir
                if (id.Count > 0)
                {
                    ide = Convert.ToInt32(id[0].ToString());
                    if (ide != 0)
                    {
                        for (int i = 0; i < presupuesto.presupuestoSAP.Count; i++)
                        {
                            presupuesto.presupuestoSAP[i].ID = ide;
                        }
                        db.BulkInsert(presupuesto.presupuestoSAP);
                        mensaje = mensajes(12, idioma, pagina); //"Guardado Correctamente SAP.";
                    }
                    else
                    {
                        mensaje = mensajes(10, idioma, pagina); //"El usuario con el que se esta cargando los datos no exitene en el sistema.";
                    }
                }
                else
                {
                    mensaje = mensajes(13, idioma, pagina); //"Ocurrio algo mientra se guardaba.";
                }
            }
            return(mensaje);
        }