コード例 #1
0
 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);
 }
コード例 #2
0
        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);
        }
コード例 #3
0
        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;
        }
コード例 #4
0
ファイル: HelloWorld.cs プロジェクト: kloseking7/Development
        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);
            }
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: GeorgeMi/PollApp
        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"));
        }
コード例 #6
0
        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);
            }
        }
コード例 #7
0
ファイル: Program.cs プロジェクト: GeorgeMi/PollApp
        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"));
        }
コード例 #8
0
        public List <Exercise> GetAllExercises()
        {
            DataAccess.DataAccess da = new DataAccess.DataAccess();

            var returnList = da.GetExerciseCollection();

            return(returnList);
        }
コード例 #9
0
        public List<Exercise> GetAllExercises()
        {
            DataAccess.DataAccess da = new DataAccess.DataAccess();

            var returnList = da.GetExerciseCollection();

            return returnList;
        }
コード例 #10
0
 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);
     }
 }
コード例 #11
0
 /// <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;
     }
 }
コード例 #12
0
        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);
        }
コード例 #13
0
 /// <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;
     }
 }
コード例 #14
0
        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);
        }
コード例 #15
0
 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);
     }
 }
コード例 #16
0
        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);
        }
コード例 #17
0
ファイル: UserManager.cs プロジェクト: PulseCRM/Pulse
 public void Dispose()
 {
     lock (m_Instance)
     {
         m_refCount--;
     }
     if (m_refCount <= 0)
     {
         m_adHelper.Close();
         m_ThreadContext.Exit();
         m_dataAccess = null;
         m_Instance   = null;
     }
 }
コード例 #18
0
        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);
        }
コード例 #19
0
ファイル: Client.cs プロジェクト: listayefir/Library
        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();
        }
コード例 #20
0
        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);
        }
コード例 #21
0
ファイル: UserManager.cs プロジェクト: PulseCRM/Pulse
        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;
            }
        }
コード例 #22
0
 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);
 }
コード例 #23
0
 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;
     }
 }
コード例 #24
0
 protected void Page_Load(object sender, EventArgs e)
 {
     DataAccess.DataAccess obj = new DataAccess.DataAccess(1);
 }
コード例 #25
0
ファイル: DataAccess.cs プロジェクト: pwf2/Tell1
 //构造函数
 public GetData()
 {
     DC = new DataAccess();
     this.Da = new SqlDataAdapter();
     this.SelectCommand = new SqlCommand();
     this.Da.SelectCommand = this.SelectCommand;
     this.SelectCommand.Connection = this.DC.myConn;
 }
コード例 #26
0
ファイル: BusinessAccess.cs プロジェクト: vijaymann0102/WCF
 public BusinessAccess()
 {
     access = new DataAccess.DataAccess();
 }
コード例 #27
0
 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();
 }
コード例 #28
0
        private void GetAllKFZ()
        {
            DataAccess.DataAccess da = new DataAccess.DataAccess();

            AlleKFZs = da.GetAllKFZ();
        }
コード例 #29
0
ファイル: Email.cs プロジェクト: yalunwang/family
 public Email(DataAccess.user user, string email)
 {
     _userDal = user;
     emailto = email;
 }
コード例 #30
0
ファイル: Email.cs プロジェクト: yalunwang/family
 public Email(DataAccess.user user)
 {
     _userDal = user;
 }
コード例 #31
0
 private void SaveKFZDetails()
 {
     DataAccess.DataAccess da = new DataAccess.DataAccess();
     da.SaveKFZDetails(SelectedKFZ);
 }
コード例 #32
0
        //DateTime datetimeXX = new DateTime(2017, 04, 27, 13, 00, 00);

        public ExportDataService()
        {
            InitializeComponent();
            dataAccess    = new DataAccess.DataAccess();
            businessLogic = new DataAccess.BusinessLogic();
        }
コード例 #33
0
        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);
        }
コード例 #34
0
 public void UpdateDB()
 {
     DataAccess.DataAccess restuarant_crud = new DataAccess.DataAccess();
     restuarant_crud.UpdateDB();
 }