db.all(sql, function(err, rows) { if(rows.length > 0){ dialog.info('YES'); }else{ dialog.info('NO'); } });
function getFilePath() { var path; var ret = null; try { path = configFilePath('Documents'); stats = fs.lstatSync(path); if(stats.isFile) { ret = path; } } catch (e1) { try { path = configFilePath('My Documents'); stats = fs.lstatSync(path); if(stats.isFile) { ret = path; } } catch (e2) { var dialog = require('dialog'); dialog.info('Could not find Path of Exile\'s configuration file', 'Error', function () { gui.App.closeAllWindows(); gui.App.quit(); }); } } lastFilePath = ret; return ret; }
exports.msgErro = function(object){ var text = ''; for (var i = 0; i < Object.keys(object.errors).length; i++) { text += object.errors[Object.keys(object.errors)[i]].message + '\n\n'; } dialog.info(text); }
downloadImage(src, function (err, filename) { if (err) { return console.log(err); } console.log(filename + ' downloaded'); completed++, running--; if(completed === arrImg.length) { console.timeEnd('download'); dialog.info('Done!!',"Download....."); } next(); });
}, function(err, user) { console.log("USER-------->"+user); if(user!=null){ console.log("user_id: "+user.id); Role.roleOfProgram.update({"_id":role.id}, { "position":req.body.position, $push: { "user": user.id} } , function(add_ass_program) { console.log('ADD TO ROLE OF PROGRAM SUCCESSFUL : '+add_ass_program); User.update({"_id":user.id}, { $push: { "roleOfProgram": role.id} } , function(err, user) { if (err){console.log('cant edit new program Management'+err);} else{ console.log('ADD ROLE OF PROGRAM TO user SUCCESSFUL : '+user); } }); }); } else{ dialog.info('This user does not exist in this program'); } });
app.post('/edit',isLoggedIn, function (req, res){ console.log( "Post editprofile"); console.log(req.body.username); //console.log(req.files.file.path) user : req.user if((req.body.role == 'staff' &&!isNaN(req.body.terminationYear) && !isNaN(req.body.yearattend))|| (req.body.role == 'student' && !isNaN(req.body.yearattend))){ User.findOne({'local.username' : req.body.username }, function(err, user) { if (err){ console.log("Upload Failed!"); return done(err);} if (user){ var date = req.body.month+"/"+req.body.day+"/"+req.body.year console.log("date: "+date); console.log("dateOfBirth: "+user.local.dateOfBirth); console.log(user); console.log("eiei"); // user.local.dateOfBirth = date // user.local.dateOfBirth user.updateUser(req, res) } }); } else{ dialog.info('Termination year or Year Attend have to be a number :)'); } });
MongoClient.connect('mongodb://localhost:27017/parking',function(err,db){ if (err) throw err; console.log("Connected to Database"); var cursor=db.collection('parking').find({Name:user_name}).count(); if(cursor==0) { var document = {Name:user_name, Password:password1}; //insert record db.collection('parking').insert(document, function(err, records) { if (err) throw err; console.log("Record added as "); //res.send(500,'showAlert'); dialog.info('Record added'); }); } else { console.log("User already registerd"); dialog.info('User already there'); } });
app.post('/', function(req, res) { var Q_number = req.body.Q_number; var T_time = req.body.T_time; var html = 'Your Question Bank is Downloaded' + '.<br>' + '<a href="/">Generate another Question Bank.</a>'; //validation checks if((!validator.isNull(Q_number))&&(!validator.isNull(T_time))) { //connection from mysql to retrieve data var mysql = require('mysql'); var HOST = 'localhost'; var PORT = 8084; var MYSQL_USER = '******'; var MYSQL_PASS = '******'; var DATABASE = 'question'; var TABLE = 'table2'; var connection = mysql.createConnection ({ host : 'localhost', user : '******', password : '******', database : 'question', PORT : 8084 }); //make connection connection.connect(); connection.query('USE question');//database which we want to use //query to insert data in the database connection.query("SELECT * FROM table2", function(err, rows) { if(err) { throw err; } else { var idrand=que_sel_logic(Q_number,T_time,rows);//function call for question selection connection.query("SELECT * FROM table2 where id in ("+idrand.toString()+")", function(err, rows) { if(err) { console.log(myQuery); throw err; } else { console.log("all is fetch"); pdf_generate(Q_number,T_time,rows);//function call for pdf file generation connection.end();//connection from mysql end } }); }//else end });//query end res.send(html);//pdf downloaded message to the user }//validation if end else { dialog.info('Please enter valid Question numbers and Total time'); } });//post end
function alert(msg){ dialog.info(msg); }
app.on('info', function() { dialog.info('A menubar application that automatically change your wallpaper at the desired interval, uses photos from https://unsplash.com', 'Unsplash Wallpaper'); });
}, function(err, user) { console.log("USER-------->"+user); if(user!=null){ console.log("user_id: "+user.id); Role.roleOfProgram.update({ $and: [ { 'type': "Development Committee" }, { 'academicYear': acyear.id }, { 'position': k_dev["position"] } ]}, { $push: { "user": user.id} },function(err, add_ass_program){ if (err){console.log('cant edit new program Management'+err);} else{ console.log('ADD TO ROLE OF PROGRAM SUCCESSFUL : '+add_ass_program); Role.roleOfProgram.findOne({ $and: [ { 'type': "Development Committee" }, { 'academicYear': acyear.id }, { 'position': k_dev["position"] } ]} , function(err, role) { console.log('role: '+role); User.update({ $and:[ {'local.name' : k_dev["name"] }, {'local.surname':k_dev["surname"]} ] }, { $push: { "roleOfProgram": role.id} } , function(err, user) { if (err){console.log('cant edit new program Management'+err);} else{ console.log('ADD ROLE OF PROGRAM TO user SUCCESSFUL : '+user); } }); }); } }); } else{ dialog.info('This user does not exist in this program'); } });
db.collection('parking').insert(document, function(err, records) { if (err) throw err; console.log("Record added as "); //res.send(500,'showAlert'); dialog.info('Record added'); });