Ejemplo n.º 1
0
        public static List <string> getAllSellerMail()
        {
            List <string> allsellers = new List <string>();
            string        cmd        = "SELECT mail FROM Seller";

            //Seller tmpSeller = new Seller();
            //List<Seller> seller = new List<Seller>();

            using (DataTable table = DataBaseConnect.ExecuteSelectCommand(cmd, CommandType.Text))
            {
                if (table.Rows.Count > 0)
                {
                    //seller = MapSellers(table.Rows);
                    //List<DataRow> rows = table.Rows.Cast<DataRow>().ToList();
                    //IEnumerable<DataRow> sequence = table.AsEnumerable();

                    allsellers = table.AsEnumerable().Select(x => x[0].ToString()).ToList();

                    //List<DataRow> list = table.AsEnumerable().ToList();

                    //allsellers = table.AsEnumerable()
                    //     .Select(r=> r.Field<string>("UserCode"))
                    //   .ToList();
                }
            }
            return(allsellers);
        }
Ejemplo n.º 2
0
        public static List <BookAd> Read(string cmd)
        {
            List <BookAd> bookAds = null;

            using (DataTable table = DataBaseConnect.ExecuteSelectCommand(cmd, CommandType.Text))
            {
                if (table.Rows.Count > 0)
                {
                    bookAds = MapBooks(table.Rows);
                }
            }
            return(bookAds);
        }
Ejemplo n.º 3
0
        public static List <Course> Read(string cmd)
        {
            List <Course> courses = null;

            using (DataTable table = DataBaseConnect.ExecuteSelectCommand(cmd, CommandType.Text))
            {
                if (table.Rows.Count > 0)
                {
                    courses = MapCourses(table.Rows);
                }
            }
            return(courses);
        }
Ejemplo n.º 4
0
        public static List <Seller> Read(string cmd)
        {
            List <Seller> sellers = null;

            using (DataTable table = DataBaseConnect.ExecuteSelectCommand(cmd, CommandType.Text))
            {
                if (table.Rows.Count > 0)
                {
                    sellers = MapSellers(table.Rows);
                }
            }
            return(sellers);
        }
Ejemplo n.º 5
0
        public static List <Inst> Read(string cmd)
        {
            List <Inst> insts = null;

            using (DataTable table = DataBaseConnect.ExecuteSelectCommand(cmd, CommandType.Text))
            {
                if (table.Rows.Count > 0)
                {
                    insts = MapInsts(table.Rows);
                }
            }
            return(insts);
        }
Ejemplo n.º 6
0
        //Hämtar säljare från databasen (mail nyckel)
        public static Seller getSeller(string Mail)
        {
            string cmd = String.Format("SELECT * FROM Seller WHERE Mail = '{0}'", Mail); //String.Format för att underlätta inmatning

            Seller        tmpSeller = new Seller();
            List <Seller> seller    = new List <Seller>();

            seller.Insert(0, tmpSeller);
            using (DataTable table = DataBaseConnect.ExecuteSelectCommand(cmd, CommandType.Text))
            {
                if (table.Rows.Count > 0)
                {
                    seller = MapSellers(table.Rows);
                }
            }

            tmpSeller = seller.ElementAt(0);
            return(tmpSeller);
        }
Ejemplo n.º 7
0
        public static void Delete(string Title, string Author, string Isbn, string Date, string Price, string AdText, string Course, string Mail)
        {
            string cmd = String.Format("DELETE FROM BookAd WHERE isbn = '" + Isbn + "' ;");

            DataBaseConnect.ExecuteSelectCommand(cmd, CommandType.Text);
        }
Ejemplo n.º 8
0
        public static DataTable ReadDt(string cmd)
        {
            DataTable table = DataBaseConnect.ExecuteSelectCommand(cmd, CommandType.Text);

            return(table);
        }
Ejemplo n.º 9
0
        public static void Delete(string LName, string FName, string PhoneNbr, string Mail, string City, string Password)
        {
            string cmd = String.Format("DELETE FROM Seller WHERE Mail = '" + Mail + "' ;");

            DataBaseConnect.ExecuteSelectCommand(cmd, CommandType.Text);
        }