示例#1
0
        public mvReply Login([FromBody] mvAccess model)
        {
            mvReply oR = new mvReply();

            try
            {
                using (ExamenEntities db = new ExamenEntities())
                {
                    var list = db.Users.Where(i => i.email == model.email && i.password == model.password && i.idEstatus == 1);
                    if (list.Count() > 0)
                    {
                        oR.result = 1;
                        oR.data   = Guid.NewGuid().ToString();

                        Users oUser = list.First();
                        oUser.token           = (string)oR.data;
                        db.Entry(oUser).State = System.Data.Entity.EntityState.Modified;
                        db.SaveChanges();
                    }
                    else
                    {
                        oR.message = "Datos incorrectos";
                    }
                }
            }
            catch (Exception ex)
            {
                oR.result  = 0;
                oR.message = "Ocurrio un error, estamos corrigiendolo";
            }
            return(oR);
        }
示例#2
0
        public mvReply vna([FromBody] mvSecurity model)
        {
            mvReply oR = new mvReply();

            oR.result = 0;

            if (!Verify(model.token))
            {
                oR.message = "No Autorizado";
                return(oR);
            }
            try
            {
                using (ExamenEntities db = new ExamenEntities())
                {
                    string          ruta         = "C:\\Users\\danie\\Desktop\\EjercicioDictum.xlsx";
                    SLDocument      sl           = new SLDocument(ruta);
                    SpreadSheet     oSpreadSheet = new SpreadSheet(sl.GetCurrentWorksheetName());
                    List <mvInputs> oModel       = new List <mvInputs>();
                    int             iCol         = 1;
                    const int       rowHead      = 1;
                    const int       row          = 2;
                    while (sl.GetCellValueAsString(rowHead, iCol) != "TASA")
                    {
                        oModel.Add(new mvInputs()
                        {
                            Name  = sl.GetCellValueAsString(rowHead, iCol),
                            Valor = sl.GetCellValueAsInt32(row, iCol)
                        });
                        iCol++;
                    }
                    oSpreadSheet.set(oModel);
                    oSpreadSheet.calculate();
                    oR.data    = oSpreadSheet.get();
                    oR.message = "resultado:" + oSpreadSheet.vna();
                    oR.result  = 1;
                }
            }
            catch (Exception ex)
            {
                oR.message = "Ocurrio un error en el servidor, inteta más tarde";
            }
            return(oR);
        }