public WebServicesTools() { dbManager = new dbManager(); payvastWS = new AccountingServiceSoapClient(); NezamSenfiWS = new AccountingWebServiceSoapClient(); fiscalPeriod = (int)dbManager.GetFiscalPeriod(); }
public ActionResult ViewImage(int id) { ImageViewModel vm = new ImageViewModel(); if (TempData["message"] != null) { vm.Message = (string)TempData["message"]; } if (!PermissionToView(id)) { vm.AllowedToViewImage = false; vm.Image = new Images { Id = id }; } else { vm.AllowedToViewImage = true; dbManager db = new dbManager(Settings.Default.ConStr); db.IncrementView(id); var image = db.ViewImage(id); if (image == null) { return(RedirectToAction("index")); } vm.Image = image; } return(View(vm)); }
public ActionResult ViewImage(int id, string password) { dbManager db = new dbManager(Settings.Default.ConStr); var image = db.ViewImage(id); if (image == null) { return(Redirect("/home/index")); } if (password != image.Password) { TempData["message"] = "invalid password"; } else { List <int> allowedIds; if (Session["allowedIds"] == null) { allowedIds = new List <int>(); Session["allowedIds"] = allowedIds; } else { allowedIds = (List <int>)Session["allowedIds"]; } allowedIds.Add(id); } return(Redirect($"/viewer/viewimage?id={id}")); }
public ActionResult Delete() { dbManager db = new dbManager(Settings.Default.ConStr); db.Delete(); FormsAuthentication.SignOut(); return(Redirect("/")); }
public ActionResult SignUp(User user, string Password) { dbManager db = new dbManager(Settings.Default.ConStr); string salt = PasswordHelper.GenerateSalt(); string hash = PasswordHelper.HashPassword(Password, salt); db.AddUser(user, Password); return(RedirectToAction("Login")); }
// Original code, works OOTB with the proper environment variable // ControllerSettings__DbConfig__DbConnectionString: mongodb+srv://odedia:[email protected]/sampledb //public PersonController(IOptions<ControllerSettings> settings) //{ // _dbManager = new dbManager(settings?.Value.DbConfig); //} public PersonController(IOptions <ControllerSettings> settings, IConfiguration conf) { var uri = conf["vcap:services:user-provided:0:credentials:url"]; var db = new DB_Config(); db.DbConnectionString = uri; db.DbName = "sampledb"; _dbManager = new dbManager(db); }
public void TestGetPersonsList() { var config = getConf(); DB_Config dbConfig = new DB_Config(); dbConfig.DbConnectionString = config["ControllerSettings:DbConfig:DbConnectionString"]; dbConfig.DbName = config["ControllerSettings:DbConfig:DbName"]; dbManager _dbManager = new dbManager(dbConfig); Assert.That(_dbManager.GetPersonsList(), Is.Not.Empty); }
public void TestCreatePerson() { var config = getConf(); DB_Config dbConfig = new DB_Config(); dbConfig.DbConnectionString = config["ControllerSettings:DbConfig:DbConnectionString"]; dbConfig.DbName = config["ControllerSettings:DbConfig:DbName"]; dbManager _dbManager = new dbManager(dbConfig); _dbManager.InsertNewPerson(getTestPerson()); Assert.Pass(); }
public void Cleanup() { var config = getConf(); DB_Config dbConfig = new DB_Config(); dbConfig.DbConnectionString = config["ControllerSettings:DbConfig:DbConnectionString"]; dbConfig.DbName = config["ControllerSettings:DbConfig:DbName"]; dbManager _dbManager = new dbManager(dbConfig); Person testPerson = getTestPerson(); _dbManager.DeletePerson(testPerson.ID); }
public ActionResult DeleteImage(int id) { dbManager db = new dbManager(Settings.Default.ConStr); var userId = db.GetUsersImages(User.Identity.Name).Select(i => i.Id); if (!userId.Contains(id)) { return(Redirect("/home/myaccount")); } db.DeleteImage(id); return(Redirect("/home/myaccount")); }
public void TestGetPersonById() { var config = getConf(); DB_Config dbConfig = new DB_Config(); dbConfig.DbConnectionString = config["ControllerSettings:DbConfig:DbConnectionString"]; dbConfig.DbName = config["ControllerSettings:DbConfig:DbName"]; dbManager _dbManager = new dbManager(dbConfig); Person testPerson = getTestPerson(); Person person = _dbManager.GetPerson(testPerson.ID); Assert.AreEqual(person.ID, testPerson.ID); }
public ActionResult Uploading(Images image, HttpPostedFileBase fileImage) { string NewImage = Guid.NewGuid() + Path.GetExtension(fileImage.FileName); fileImage.SaveAs(Path.Combine(Server.MapPath("/uploadedimages"), NewImage)); image.FileName = NewImage; dbManager db = new dbManager(Settings.Default.ConStr); var user = db.GetUserByEmail(User.Identity.Name); image.UserId = user.Id; db.AddImage(image); return(View(image)); }
// Use this for initialization void Start() { ds = new dbManager("earldb.s3db"); ds.createTable(); emoteSnackbar.SetActive(false); //defaultBackground = background.texture; if (comp) { credentials = new Credentials("fa0d719942dea6bca4fe74a70b13ef9eff1d84c5", "https://watson-api-explorer.mybluemix.net/visual-recognition/api/v3/classify?"); _visualRecognition = new VisualRecognition(credentials); _visualRecognition.VersionDate = _visualRecognitionVersionDate; startFrontCam(); } }
public void TestUpdatePerson() { var config = getConf(); DB_Config dbConfig = new DB_Config(); dbConfig.DbConnectionString = config["ControllerSettings:DbConfig:DbConnectionString"]; dbConfig.DbName = config["ControllerSettings:DbConfig:DbName"]; dbManager _dbManager = new dbManager(dbConfig); Person testPerson = getTestPerson(); testPerson.FirstName = "UpdatedFirstName"; _dbManager.UpdatePerson(testPerson); Person personFromDb = _dbManager.GetPerson(testPerson.ID); Assert.AreEqual(personFromDb.FirstName, testPerson.FirstName); }
public ActionResult Login(string email, string password) { dbManager db = new dbManager(Settings.Default.ConStr); var salt = db.GetSaltById(email); var hash = db.GetHashById(email); if (salt == null) { return(RedirectToAction("login")); } var input = PasswordHelper.PasswordMatch(password, salt, hash); if (input) { FormsAuthentication.SetAuthCookie(email, true); } return(Redirect("/home/index")); }
private void initializeProgramStartup() { NewOrExistCatalog noecw = new NewOrExistCatalog(); var result = noecw.ShowDialog(); if (result == System.Windows.Forms.DialogResult.Abort || result == System.Windows.Forms.DialogResult.Cancel) { Environment.Exit(0); } else if (result == System.Windows.Forms.DialogResult.OK) { try { // Create an instance of a ListView column sorter and assign it // to the ListView control. lvwColumnSorter = new ListViewColumnSorter(); this.listViewDocs.ListViewItemSorter = lvwColumnSorter; dbm = new dbManager(noecw.Path); editable = false; this.selectedFileType = dbm.getSelectedFileTypeExtensions(); treeViewDirs.SelectedNode = treeViewDirs.Nodes[0]; listViewRefresh(); generateCustomVDirs(); refreshTags(); refreshAuthors(); } catch (SQLiteException sqle) { MessageBox.Show(sqle.Message); initializeProgramStartup(); } catch (Exception e) { MessageBox.Show(e.Message); initializeProgramStartup(); } } }
//Original code, works OOTB with the proper environment variable // ControllerSettings__DbConfig__DbConnectionString: mongodb+srv://odedia:[email protected]/sampledb public PersonController(IOptions <ControllerSettings> settings) { _dbManager = new dbManager(settings?.Value.DbConfig); }
public SearchLogic() { myDbManager = new dbManager(); // initialize queryString = "SELECT * FROM "; }
public ActionResult MyAccount() { dbManager db = new dbManager(Settings.Default.ConStr); return(View(db.GetUsersImages(User.Identity.Name))); }
public userLogic() { myDbManager = new dbManager(); }