예제 #1
0
        /// <summary>
        /// Basing on the submitted Form, check which elements are dirty (changes)
        /// </summary>
        public List<Mail> CheckDirtyElements()
        {
            // Get number of Elements
            int amount = int.Parse((string)Request.Form["ctl00$MainContent$entryCount"]);

            List<Mail> list = new List<Mail>();

            // Check one by one...
            for (int i=0;i<amount;i++)
            {
                if ((string)Request.Form["ctl00$MainContent$repMails$ctl"+i.ToString("D2")+"$textAdress"] != (string)Request.Form["ctl00$MainContent$repMails$ctl" + i.ToString("D2") + "$textAdressOld"])
                {
                    // Found a dirty item, Create a User for this and store data

                    // TODO: Check for syntactically correct mail adress

                    string adress = (string)Request.Form["ctl00$MainContent$repMails$ctl" + i.ToString("D2") + "$textAdress"];
                    string name = (string)Request.Form["ctl00$MainContent$repMails$ctl" + i.ToString("D2") + "$textName"];
                    Mail mail = new Mail();
                    mail.adress = adress;
                    mail.username = name;
                    
                    list.Add(mail);
                }

                // Todo: Deletions
            }

            return list;
        }
예제 #2
0
        /// <summary>
        /// Returns a List of the users and their mailadresses
        /// </summary>
        private async Task<List<Mail>> GetMailsAsync()
        {

            MySqlDataReader reader = this.Query("SELECT * FROM gk_mail");

            List<Mail> list = new List<Mail>();

            while (await reader.ReadAsync())
            {
                Mail mail = new Mail();

                mail.adress = reader.GetString("adress");
                mail.username = reader.GetString("username");
                try
                {
                    mail.active = Boolean.Parse(reader.GetString("active"));
                }
                catch
                {
                    mail.active = false;
                }

                list.Add(mail);
            }

            reader.Close();
            this.Close();
            return list;
        }