public HomeController(IEngineProject _Funcion, IEngineHttp _FuncionHttp, IEngineTool _Tool, IEngineProcesor _Proceso)
 {
     this.Funcion     = _Funcion;
     this.FuncionHttp = _FuncionHttp;
     this.Tool        = _Tool;
     this.Proceso     = _Proceso;
 }
        public Person SetListPerson(string strValue, IEngineTool Tool)
        {
            string[] x = strValue.Split('#');
            Person   p = new Person();

            p.Foto      = x[0];
            p.Nombre    = x[1];
            p.Apellido  = x[2];
            p.Dni       = x[3];
            p.Matricula = x[4];
            p.Rh        = x[5];
            p.Grado     = x[6];
            p.Grupo     = x[7];

            if (Tool.EmailEsValido(x[8]))
            {
                p.Email = x[8];
            }
            else
            {
                p.Email = string.Empty;
            }

            p.Company = x[9];
            p.Qr      = string.Empty;
            p.Turno   = Convert.ToInt32(x[10]);


            return(p);
        }
 public AsistenciaClaseApiController(IEngineTool _tool, IEngineDb _metodo, IEngineProject _funcion, IEngineNotify _notyfy)
 {
     Tool    = _tool;
     Metodo  = _metodo;
     Funcion = _funcion;
     Notify  = _notyfy;
 }
 public ContactController(IEngineProject _Funcion, IEngineHttp _FuncionHttp, IEngineTool _Tool, IEngineProcesor _Proceso, IEngineNotify _Notify)
 {
     this.Funcion     = _Funcion;
     this.FuncionHttp = _FuncionHttp;
     this.Tool        = _Tool;
     this.Proceso     = _Proceso;
     this.Notify      = _Notify;
 }
        public async Task <string> GetAccessTokenAsync(IEngineTool Tool, IEngineHttp HttpFuncion)
        {
            string strValid = Tool.DataLoginUserApi();

            strValid = await HttpFuncion.GetAccessToken(strValid);

            Valor.AccesToken = strValid;
            return(strValid);
        }
 public string NoDefinido(string email, IEngineTool Tool)
 {
     if (email == "*****@*****.**")
     {
         string[] p = email.Split('@');
         email = p[0] + Tool.ConstruirCodigo() + "@" + "gmail.com";
     }
     return(email);
 }
 public HomeController(IEngineNotify _EngineNotify, IEngineSerialize _EngineSerialize, IWebHostEnvironment _env, IEngineTool _EngineTool, IEmpresaClienteRepository _EmpresaClienteRepository, IProcesador _Procesador)
 {
     this.EngineNotify             = _EngineNotify;
     this.EngineSerialize          = _EngineSerialize;
     this.EngineTool               = _EngineTool;
     this.EmpresaClienteRepository = _EmpresaClienteRepository;
     this.env        = _env;
     this.Procesador = _Procesador;
 }
 public ProcesorController(IEngineProject _Funcion, IEngineHttp _FuncionHttp, IEngineTool _Tool, IEngineProcesor _Proceso, IEngineRead _Lector, IEngineNotify _Notify)
 {
     this.Funcion     = _Funcion;
     this.FuncionHttp = _FuncionHttp;
     this.Tool        = _Tool;
     this.Proceso     = _Proceso;
     this.Lector      = _Lector;
     this.Notify      = _Notify;
 }
示例#9
0
        public string BuildUserApiStr(string user, string password, IEngineTool Tool)
        {
            UserApi modelo = new UserApi();
            bool    result = Tool.EmailEsValido(user);

            if (result)
            {
                modelo.Email = user;
                modelo.User  = "******";
            }
            else
            {
                modelo.User  = user;
                modelo.Email = "A";
            }
            modelo.Password = password;
            return(JsonConvert.SerializeObject(modelo));
        }
示例#10
0
        public bool UpdatePersonFoto(IEngineTool Tool, IEngineHttp Funcion)
        {
            Excel.Application xlApp       = new Excel.Application();
            Excel.Workbook    xlWorkbook  = xlApp.Workbooks.Open(@"C:\Users\ASUS\Downloads\CARNETIZACION\Rosa\List\NUEVO.xlsx");
            Excel._Worksheet  xlWorksheet = xlWorkbook.Sheets[1];
            Excel.Range       xlRange     = xlWorksheet.UsedRange;
            xlApp.DisplayAlerts = false;
            int    rowCount = xlRange.Rows.Count;
            int    colCount = xlRange.Columns.Count;
            string strValue = string.Empty;
            bool   validate = false;

            string file = string.Empty;
            string foto = string.Empty;
            string dni  = string.Empty;

            string s = "#";

            for (int fila = 2; fila <= rowCount; fila++)
            {
                strValue = string.Empty;

                for (int columna = 1; columna <= colCount; columna++)
                {
                    try
                    {
                        if (xlRange.Cells[fila, columna] != null)
                        {
                            if (columna == 1)//foto
                            {
                                if (xlRange.Cells[fila, columna].Value != null)
                                {
                                    var      g    = (xlRange.Cells[fila, columna].Value2.ToString()).Replace("/", "#").Trim();
                                    string[] part = g.Split('#');
                                    file     = @"C:\Users\ASUS\Downloads\CARNETIZACION\Rosa\List\fotopeq" + part[1].Trim();
                                    validate = Tool.ExistsFile(file);
                                    if (validate)
                                    {
                                        foto = file;
                                    }
                                    else
                                    {
                                        file = @"C:\Users\ASUS\Downloads\CARNETIZACION\Rosa\List\fotopeq" + part[1].Trim();
                                        foto = file;
                                    }
                                }
                                else
                                {
                                    file = "NO_DEFINIDO";
                                    foto = file;
                                }
                                strValue = strValue + foto + s;
                            }
                            else if (columna == 2)//dni documento
                            {
                                try
                                {
                                    if (xlRange.Cells[fila, columna].Value2 != null)
                                    {
                                        dni = xlRange.Cells[fila, columna].Value2.ToString().Trim();
                                    }
                                    else
                                    {
                                        dni = xlRange.Cells[fila, columna].Value2.ToString().Trim();
                                    }
                                }
                                catch
                                {
                                    dni = "-";
                                }


                                strValue = strValue + dni + s;
                            }
                        }

                        //*************************************************************************************************************************************************************************
                    }
                    catch (Exception ex)
                    {
                        string err = ex.ToString();
                    }
                }


                foto     = Tool.ConvertImgTo64Img(foto);
                validate = Funcion.UpdatePersonFoto(dni, foto);

                strValue = string.Empty;
            }

            GC.Collect();
            GC.WaitForPendingFinalizers();
            while (Marshal.ReleaseComObject(xlRange) != 0)
            {
                ;
            }
            while (Marshal.ReleaseComObject(xlWorksheet) != 0)
            {
                ;
            }
            xlWorkbook.Close();
            while (Marshal.ReleaseComObject(xlWorkbook) != 0)
            {
                ;
            }
            xlApp.Quit();
            while (Marshal.ReleaseComObject(xlApp) != 0)
            {
                ;
            }
            ReadWriteTxt(@"C:\Users\ASUS\Downloads\CARNETIZACION\Rosa\List\NUEVO.xlsx");
            return(validate);
        }
示例#11
0
 public EngineNotify(IAppLogRepository _AppLogRepository, IEngineTool _EngineTool)
 {
     AppLogRepository = _AppLogRepository;
     EngineTool       = _EngineTool;
 }
 public DeviceApiController(IEngineTool _tool, IEngineDb _metodo, IEngineProject _funcion)
 {
     Tool    = _tool;
     Metodo  = _metodo;
     Funcion = _funcion;
 }
示例#13
0
 public PersonApiController(IEngineTool _tool, IEngineDb _metodo)
 {
     Tool   = _tool;
     Metodo = _metodo;
 }
示例#14
0
        public bool CreateFileXlsx(List <Person> persons, string pathFile, IEngineTool Tool)
        {
            bool resultado = false;

            Excel.Application excel = default(Excel.Application);
            Excel.Workbook    libro = default(Excel.Workbook);
            Excel.Worksheet   hoja  = default(Excel.Worksheet);
            excel = new Excel.Application();
            excel.DisplayAlerts = false;
            try
            {
                libro = excel.Workbooks.Add();
                hoja  = libro.Worksheets[1];
                hoja.Activate();

                hoja.Range["A1"].Value = "FOTO";
                hoja.Range["B1"].Value = "NOMBRE";
                hoja.Range["C1"].Value = "APELLIDO";
                hoja.Range["D1"].Value = "DNI";
                hoja.Range["E1"].Value = "MATRICULA";
                hoja.Range["F1"].Value = "RH";
                hoja.Range["G1"].Value = "GRADO";
                hoja.Range["H1"].Value = "GRUPO";
                hoja.Range["I1"].Value = "QR";

                int    n        = 2;
                string foto64   = string.Empty;
                string sourceQr = string.Empty;
                string qr64     = string.Empty;
                string pathFoto = string.Empty;
                string pathQr   = string.Empty;
                foreach (Person p in persons)
                {
                    try
                    {
                        foto64   = Tool.ConvertImgTo64Img(p.Foto);
                        sourceQr = p.Nombre + "#" + p.Apellido + "#" + p.Dni;
                        sourceQr = Tool.ConvertirBase64(sourceQr);
                        p.Qr     = Tool.CreateQrCode(sourceQr, Valor.PathFolderImageQr() + @"\" + p.Dni + ".png");
                        qr64     = Tool.ConvertImgTo64Img(Valor.PathFolderImageQr() + @"\" + p.Dni + ".png");

                        var f = p.Foto.Split('\\');
                        var q = p.Qr.Split('\\');
                        hoja.Range["A" + n].Value = "FOTO/" + f[f.Length - 1];
                        hoja.Range["B" + n].Value = p.Nombre;
                        hoja.Range["C" + n].Value = p.Apellido;
                        hoja.Range["D" + n].Value = p.Dni;
                        hoja.Range["E" + n].Value = p.Matricula;
                        hoja.Range["F" + n].Value = p.Rh;
                        hoja.Range["G" + n].Value = p.Grado;
                        hoja.Range["H" + n].Value = p.Grupo;
                        hoja.Range["I" + n].Value = "QR/" + q[q.Length - 1];;

                        p.Foto = foto64;
                        p.Qr   = qr64;
                        n++;
                    }
                    catch (Exception ex) { MessageBox.Show("Error:  " + ex.ToString()); }
                }
                excel.ActiveWindow.Zoom = 100;
                excel.Columns.AutoFit();
                excel.Rows.AutoFit();
                libro.SaveAs(pathFile);
                ReadWriteTxt(pathFile);
                excel.Quit();
                Valor.SetPersons(persons);
                resultado = true;
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error:  " + ex.ToString());
            }

            return(resultado);
        }
示例#15
0
        public List <Person> LeerArchivo(string pathArchivo, IEngineTool Tool)
        {
            DataTable dt = new DataTable();

            dt = BuildColumnDataTable(dt);
            Person        p  = new Person();
            List <Person> lp = new List <Person>();

            Excel.Application application = new Excel.Application();
            Excel.Workbook    workbook    = application.Workbooks.Open(pathArchivo);
            Excel.Worksheet   worksheet   = workbook.Sheets[1];
            Excel.Range       xlRange     = worksheet.UsedRange;
            application.DisplayAlerts = false;
            int rowCount = xlRange.Rows.Count;
            int colCount = xlRange.Columns.Count;

            string foto      = string.Empty;
            string nombre    = string.Empty;
            string apellido  = string.Empty;
            string dni       = string.Empty;
            string matricula = string.Empty;
            string rh        = string.Empty;
            string grado     = string.Empty;
            string grupo     = string.Empty;
            string email     = string.Empty;
            string empresa   = string.Empty;
            string turno     = string.Empty;
            string file      = string.Empty;
            string strValue  = string.Empty;
            int    idx       = 0;

            for (int fila = 2; fila <= rowCount; fila++)
            {
                try
                {
                    if (worksheet.Cells[fila, 1].Value != null && worksheet.Cells[fila, 1].Value != string.Empty)
                    {
                        foto = worksheet.Cells[fila, 1].Value;
                        if (!Tool.ExistsFile(foto))
                        {
                            foto = "NO_EXISTE_FOTO";
                        }
                    }
                    else
                    {
                        foto = "NO_DEFINIDO";
                    }

                    if (worksheet.Cells[fila, 2].Value != null && worksheet.Cells[fila, 2].Value != string.Empty)
                    {
                        nombre = worksheet.Cells[fila, 2].Value;
                    }
                    else
                    {
                        nombre = "NO_DEFINIDO";
                    }

                    if (worksheet.Cells[fila, 3].Value != null && worksheet.Cells[fila, 3].Value != string.Empty)
                    {
                        apellido = worksheet.Cells[fila, 3].Value;
                    }
                    else
                    {
                        apellido = "NO_DEFINIDO";
                    }

                    if (worksheet.Cells[fila, 4].Value != null)
                    {
                        dni = worksheet.Cells[fila, 4].Value.ToString();
                    }
                    else
                    {
                        dni = "NO_DEFINIDO";
                    }

                    if (worksheet.Cells[fila, 5].Value != null)
                    {
                        matricula = worksheet.Cells[fila, 5].Value.ToString();
                    }
                    else
                    {
                        matricula = "NO_DEFINIDO";
                    }

                    if (worksheet.Cells[fila, 6].Value != null && worksheet.Cells[fila, 6].Value != string.Empty)
                    {
                        rh = worksheet.Cells[fila, 6].Value;
                    }
                    else
                    {
                        rh = "NO_DEFINIDO";
                    }

                    if (worksheet.Cells[fila, 7].Value != null && worksheet.Cells[fila, 7].Value != string.Empty)
                    {
                        grado = worksheet.Cells[fila, 7].Value;
                    }
                    else
                    {
                        grado = "NO_DEFINIDO";
                    }

                    if (worksheet.Cells[fila, 8].Value != null && worksheet.Cells[fila, 8].Value != string.Empty)
                    {
                        grupo = worksheet.Cells[fila, 8].Value;
                    }
                    else
                    {
                        grupo = "NO_DEFINIDO";
                    }

                    if (worksheet.Cells[fila, 9].Value != null && worksheet.Cells[fila, 9].Value != string.Empty)
                    {
                        email = worksheet.Cells[fila, 9].Value;
                    }
                    else
                    {
                        email = "NO_DEFINIDO";
                    }

                    if (worksheet.Cells[fila, 10].Value != null && worksheet.Cells[fila, 10].Value != string.Empty)
                    {
                        empresa = worksheet.Cells[fila, 10].Value;
                    }
                    else
                    {
                        empresa = "NO_DEFINIDO";
                    }

                    if (worksheet.Cells[fila, 11].Value != null && worksheet.Cells[fila, 11].Value != string.Empty)
                    {
                        turno = worksheet.Cells[fila, 11].Value;
                        if (turno.ToUpper() == "MAÑANA")
                        {
                            turno = "1";
                        }
                        else if (turno.ToUpper() == "TARDE")
                        {
                            turno = "2";
                        }
                        else if (turno.ToUpper() == "NOCHE")
                        {
                            turno = "3";
                        }
                    }
                    else
                    {
                        turno = "NO_DEFINIDO";
                    }


                    strValue = foto + "#" + nombre + "#" + apellido + "#" + dni + "#" + matricula + "#" + rh + "#" + grado + "#" + grupo + "#" + email.ToLower().Trim() + "#" + empresa + "#" + turno + "#";
                    p        = SetListPerson(strValue, Tool);
                    if (!string.IsNullOrEmpty(p.Email))
                    {
                        lp.Insert(idx, p);
                        idx++;
                    }
                    else
                    {
                        p.Email = NoDefinido("*****@*****.**", Tool);
                        lp.Insert(idx, p);
                        idx++;
                    }

                    dt = SetDataTable(strValue, dt, idx);
                }
                catch (Exception ex)
                {
                    string error = ex.ToString();
                }
            }
            Valor.SetDt(dt);
            return(lp);
        }
 public CompanyApiController(IEngineTool _tool, IEngineDb _metodo, IEngineNotify _notificacion)
 {
     Tool         = _tool;
     Metodo       = _metodo;
     Notificacion = _notificacion;
 }
示例#17
0
 public EngineDb(IEngineProject _funcion, IEngineTool _tool)
 {
     Funcion = _funcion;
     Tool    = _tool;
 }
示例#18
0
 public AsistenciaComedorApiController(IEngineTool _tool, IEngineDb _metodo)
 {
     Tool   = _tool;
     Metodo = _metodo;
 }
示例#19
0
 public EngineProcesor(IEngineHttp _HttpFuncion, IEngineProject _Funcion, IEngineTool _Tool)
 {
     HttpFuncion = _HttpFuncion;
     Funcion     = _Funcion;
     Tool        = _Tool;
 }