Exemplo n.º 1
0
        public static string  LoginUser(string user, string password, string session)
        {
            ResponseWM response = new ResponseWM();

            password = EngineTool.ConvertirBase64(user + password);
            EngineDb Method = new EngineDb();
            bool     result = Method.LoginUser(user, password);

            if (result)
            {
                System.Web.HttpContext.Current.Session["User"] = user;
                if (session == "si")
                {
                    EngineProject Function = new EngineProject();
                    Function.CreateGalleta();
                }
                response.Description = "Autentificacion Exitosa";
                response.Result      = true;
            }
            else
            {
                response.Description = "Autentificacion Fallida";
                response.Result      = false;
                System.Web.HttpContext.Current.Session["User"] = null;
            }
            return(JsonConvert.SerializeObject(response));
        }
        public static string ExtendSearchDate2(string dateInit, string dateEnd)
        {
            ResponseWM      response = new ResponseWM();
            EngineDb        Metodo   = new EngineDb();
            List <Employee> model    = Metodo.ExtendSearchDate(Convert.ToDateTime(dateInit), Convert.ToDateTime(dateEnd));

            return(JsonConvert.SerializeObject(model));
        }
Exemplo n.º 3
0
        public static string RemoveLogin()
        {
            EngineProject Function = new EngineProject();

            Function.RemoveLogin();
            ResponseWM response = new ResponseWM();

            response.Description = "Sesion cerrada";
            response.Result      = true;
            System.Web.HttpContext.Current.Session["User"] = null;
            return(JsonConvert.SerializeObject(response));
        }
        public static string DeleteEmployee(string id)
        {
            ResponseWM response = new ResponseWM();
            EngineDb   Metodo   = new EngineDb();
            bool       result   = Metodo.DeleteEmployee(id);

            if (result)
            {
                response.Result = true;
            }
            else
            {
                response.Result = false;
            }

            return(JsonConvert.SerializeObject(response));
        }
        public static string EditEmployee(string id, string name, string lastName, string email)
        {
            ResponseWM response = new ResponseWM();
            EngineDb   Metodo   = new EngineDb();
            bool       result   = Metodo.EditEmployee(id, name, lastName, email);

            if (result)
            {
                response.Result = true;
            }
            else
            {
                response.Result = false;
            }

            return(JsonConvert.SerializeObject(response));
        }
Exemplo n.º 6
0
        public static string CreateAdministrator(string name, string lastName, string user, string password)
        {
            ResponseWM response = new ResponseWM();

            response.Description = "Fallo crear administrador";
            response.Result      = false;
            try
            {
                password = EngineTool.ConvertirBase64(user + password);
                EngineProject Funcion = new EngineProject();
                Administrator adm     = Funcion.SetAdministrator(name, lastName, user, password);
                EngineDb      Metodo  = new EngineDb();
                bool          result  = Metodo.CreateAdministrator(adm);
                if (result)
                {
                    response.Description = "Administrador creado satisfactoriamente";
                    response.Result      = true;
                }
            }
            catch { }

            return(JsonConvert.SerializeObject(response));
        }