public void AddRestuarant(string name, string address) { // accesss data layer, sends a restuarant object // to be inserted into database DataAccess.DataAccess restuarant_crud = new DataAccess.DataAccess(); restuarant_crud.AddRestuarant(name, address); }
public List <PieResponse> GetAllExercisesForGraph(string graphType) { var returnData = new List <PieResponse>(); DataAccess.DataAccess da = new DataAccess.DataAccess(); var returnList = da.GetExerciseCollection(); var totalCount = returnList.Count; var nalCount = returnList.Where(x => x.type == "n/a").ToList <Exercise>().Count; totalCount = totalCount - nalCount; //todo: tv move this list to database List <string> mylist = new List <string>(); mylist.Add("chest"); mylist.Add("back"); mylist.Add("tricep"); mylist.Add("cardio"); mylist.Add("legs"); mylist.Add("bicep"); mylist.Add("abs"); mylist.Add("Shoulders"); mylist.Add("n/a"); var val = 0; foreach (var prop in mylist) { if (!prop.Equals("n/a")) { val = returnList.Where(x => x.type == prop).ToList <Exercise>().Count; var stringValue = (Convert.ToDecimal(val) / Convert.ToDecimal(totalCount)) * 100; returnData.Add(new PieResponse(prop, stringValue)); } } return(returnData); }
public List<PieResponse> GetAllExercisesForGraph(string graphType) { var returnData = new List<PieResponse>(); DataAccess.DataAccess da = new DataAccess.DataAccess(); var returnList = da.GetExerciseCollection(); var totalCount = returnList.Count; var nalCount = returnList.Where(x => x.type == "n/a").ToList<Exercise>().Count; totalCount = totalCount - nalCount; //todo: tv move this list to database List<string> mylist = new List<string>(); mylist.Add("chest"); mylist.Add("back"); mylist.Add("tricep"); mylist.Add("cardio"); mylist.Add("legs"); mylist.Add("bicep"); mylist.Add("abs"); mylist.Add("Shoulders"); mylist.Add("n/a"); var val = 0; foreach (var prop in mylist) { if (!prop.Equals("n/a")) { val = returnList.Where(x => x.type == prop).ToList<Exercise>().Count; var stringValue = (Convert.ToDecimal(val) / Convert.ToDecimal(totalCount))* 100; returnData.Add(new PieResponse(prop, stringValue)); } } return returnData; }
private void ExecuteSqlStatement() { DataAccess.DataAccess DataAccess = new DataAccess.DataAccess(); string ConnectionString = GetConnectionString(); MySqlConnection conn = null; MySqlDataReader reader = null; List<Customer> CustomerList = new List<Customer>(); Customer customer; try { conn = new MySqlConnection(ConnectionString); conn.Open(); reader = DataAccess.GetReader(conn, txtSql.Text); while (reader.Read()) { customer = new Customer(); customer.CustomerID = Int32.Parse(reader.GetValue(0).ToString()); customer.CustomerName = reader.GetValue(1).ToString(); customer.BirthDate = Convert.ToDateTime(reader.GetValue(2).ToString()); CustomerList.Add(customer); } dgvResults.DataSource = CustomerList; } catch (Exception ex) { lblStatus.Text = ex.Message; } finally { DataAccess.CloseConnection(conn); } }
static void Main(string[] args) { IDataAccess dal = new DataAccess.DataAccess(); BusinessLogic.BusinessLogic bl = new BusinessLogic.BusinessLogic(dal); User u = new User { Email = "email", Username = "******", Password = "******", Role = "user" }; try { // bl.UserLogic.AddUser(u); } catch (Exception ex) { Console.WriteLine(ex.InnerException.InnerException.Message); Console.WriteLine(DateTime.Now.ToString()); Console.WriteLine(DateTime.Now.AddHours(2)); } // bl.FormLogic.AddCategory("politics"); Console.WriteLine(DateTime.Now); // Form form = new Form() { CreatedDate = DateTime.Now, Deadline = DateTime.Now, State = "state", Title = "title",CategoryID=1 ,UserID=6}; // bl.FormLogic.AddForm(form); // Console.WriteLine(bl.AuthLogic.VerifyTokenDate("A7-AB-5B-E1-B4-0D-FC-F4-C2-EC-9C-19-9B-91-D8-47")); //Console.WriteLine(bl.AdminLogic.GetUserID("geo")); }
public List <Exercise> GetAllExercises() { DataAccess.DataAccess da = new DataAccess.DataAccess(); var returnList = da.GetExerciseCollection(); return(returnList); }
public List<Exercise> GetAllExercises() { DataAccess.DataAccess da = new DataAccess.DataAccess(); var returnList = da.GetExerciseCollection(); return returnList; }
private void SaveAllKFZ() { DataAccess.DataAccess da = new DataAccess.DataAccess(); //Diese Methode speichert die Liste AllKFZs in der DB. foreach (var kfz in AlleKFZs) { da.SaveKFZ(kfz); } }
/// <summary /// Save method which send output parameters into a save method which saves /// all data into the database /// </summary> public void SavingDB(int ID, string Name, int Age, string Gender, string Category, string Info) { try { DataAccess daSave = new DataAccess(); daSave.SaveAnimal(ID, Name, Age, Gender, Category, Info); } catch { throw; } }
public List <string> GetReviews(int id) { DataAccess.DataAccess restuarant_crud = new DataAccess.DataAccess(); var reviews = restuarant_crud.GetReviews(id); List <string> result = new List <string>(); foreach (var temp in reviews) { result.Add(temp.message); } UpdateDB(); return(result); }
/// <summary /// Method which calls another method and gets a DataSet in return with all /// database data. /// </summary> public DataSet PassingLoadAnimals() { try { DataAccess da = new DataAccess(); var daLoad = da.LoadAnimalData(); return daLoad; } catch { throw; } }
public List <string> GetAll() { // returns a list of all recorded restuarant names DataAccess.DataAccess restuarant_crud = new DataAccess.DataAccess(); var restuarants_list = restuarant_crud.GetRestuarants(); List <string> results = new List <string>(); foreach (var temp in restuarants_list) { results.Add(temp.name); } return(results); }
private void Form1_Load(object sender, EventArgs e) { try { adHelper = new ActiveDirectoryHelper(); um = UserManager.Instance; da = new DataAccess.DataAccess(); } catch (Exception ex) { rtbMsg.AppendText("Exception: " + ex.Message); } }
public List <string> Search(string input) { DataAccess.DataAccess restuarant_crud = new DataAccess.DataAccess(); List <string> results = new List <string>(); foreach (var t in restuarant_crud.GetRestuarants()) { if (t.name.ToLower().Contains(input.ToLower())) { results.Add(t.name); } } return(results); }
public void Dispose() { lock (m_Instance) { m_refCount--; } if (m_refCount <= 0) { m_adHelper.Close(); m_ThreadContext.Exit(); m_dataAccess = null; m_Instance = null; } }
public List <ClientLibrary.MyData> GetRestuarantRating(int n) { DataAccess.DataAccess restuarant_crud = new DataAccess.DataAccess(); var temp = restuarant_crud.ReturanRating(); List <MyData> results = new List <MyData>(); // sort temp temp.Sort((x, y) => y.rating.CompareTo(x.rating)); for (int i = 0; i < n; i++) { MyData t = new MyData(temp[i].rating, temp[i].name); results.Add(t); } return(results); }
public Client() { InitializeComponent(); LogIn logIn = new LogIn(); if (logIn.ShowDialog() == DialogResult.OK) { dataAccess = new DataAccess.DataAccess(logIn.DBType, logIn.ConnectionParameters); List <Book> allBooks = dataAccess.GetAllBooks(); dgvBooks.DataSource = allBooks; } //logIn.ShowDialog(); }
public ActionResult Add(DataAccess.Models.Product product, string command) { if(ModelState.IsValid) { try { using (Context context = new DataAccess.Context()) { string username = (string)Session["username"]; DataAccess.Models.Merchant merchant = context.Merchants.FirstOrDefault(x => x.username == username); product.sizes = product.SizeList.Where(x => x.IsSelected == true).ToList().Sum(s => (int)s.Size); product.colors = product.ColorsList.Where(x => x.IsSelected == true).ToList().Sum(s=>(int)s.Color); product.merchant_id = merchant.id; context.Products.Add(product); context.SaveChanges(); if(command == "2") { return RedirectToAction("ProductImage","Products", new { id = product.id, type = Enum.GetName(typeof(DataAccess.Models.ProductType), product.type), category = Enum.GetName(typeof(DataAccess.Models.Category), product.category) }); } //confirmation for save done TempData["Status"] = "1"; } } catch (Exception) { throw; } } return View(product); }
private UserManager() { if (m_adHelper == null) { m_adHelper = new ActiveDirectoryHelper(); } m_OU_Filter = m_adHelper.OU; if (m_dataAccess == null) { m_dataAccess = new DataAccess.DataAccess(); } if (m_ThreadContext == null) { m_ThreadContext = new SingleThreadedContext(); m_ThreadContext.ExceptionEvent += new ExceptionEventHandler(ThreadExceptionHandler); m_ThreadContext.Init("User Manager"); } if (m_Instance != null) { return; } }
public void AddReview(string _name, int _score, int _id, string _message) { // check to see if score can be *.ToInt() DataAccess.DataAccess restuaraunt_crud = new DataAccess.DataAccess(); restuaraunt_crud.AddReview(_name, _score, _id, _message); }
private static void fillGender(UserInfo userInfo, DataAccess.UserInformation uinfo) { switch (userInfo.Gender) { case Gender.Male: uinfo.Gender = 'M'; break; case Gender.Female: uinfo.Gender = 'F'; break; case Gender.Transgender: uinfo.Gender = 'T'; break; case Gender.None: uinfo.Gender = 'N'; break; } }
protected void Page_Load(object sender, EventArgs e) { DataAccess.DataAccess obj = new DataAccess.DataAccess(1); }
//构造函数 public GetData() { DC = new DataAccess(); this.Da = new SqlDataAdapter(); this.SelectCommand = new SqlCommand(); this.Da.SelectCommand = this.SelectCommand; this.SelectCommand.Connection = this.DC.myConn; }
public BusinessAccess() { access = new DataAccess.DataAccess(); }
private void DoLogin(DataAccess.Users user) { var timeOut = 400; UserData ud = new UserData(user.ID, user.UserName); FormsAuthenticationTicket authTicket = new FormsAuthenticationTicket(1, user.UserName, DateTime.Now, DateTime.Now.AddMinutes(timeOut), false, ud.ToXml()); string encryptedTicket = FormsAuthentication.Encrypt(authTicket); HttpCookie authCookie = new HttpCookie(FormsAuthentication.FormsCookieName, encryptedTicket); Response.Cookies.Add(authCookie); Response.Cookies.Add(new HttpCookie("ASP.NET_SessionId", ""));// InvalidateModulesCookie(); }
private void GetAllKFZ() { DataAccess.DataAccess da = new DataAccess.DataAccess(); AlleKFZs = da.GetAllKFZ(); }
public Email(DataAccess.user user, string email) { _userDal = user; emailto = email; }
public Email(DataAccess.user user) { _userDal = user; }
private void SaveKFZDetails() { DataAccess.DataAccess da = new DataAccess.DataAccess(); da.SaveKFZDetails(SelectedKFZ); }
//DateTime datetimeXX = new DateTime(2017, 04, 27, 13, 00, 00); public ExportDataService() { InitializeComponent(); dataAccess = new DataAccess.DataAccess(); businessLogic = new DataAccess.BusinessLogic(); }
public ActionResult Edit(DataAccess.Models.Product product) { if (ModelState.IsValid) { try { using (Context db = new DataAccess.Context()) { //var entity = db.Products.Find(product.id); product.sizes = product.SizeList.Where(x => x.IsSelected == true).ToList().Sum(s => (int)s.Size); product.colors = product.ColorsList.Where(x => x.IsSelected == true).ToList().Sum(s => (int)s.Color); product.modified = DateTime.Now; //entity = product; db.Entry(product).State = EntityState.Modified; db.SaveChanges(); //confirmation for save done TempData["Status"] = "1"; } } catch (Exception) { throw; } } return View(product); }
public void UpdateDB() { DataAccess.DataAccess restuarant_crud = new DataAccess.DataAccess(); restuarant_crud.UpdateDB(); }