예제 #1
0
        public List <Mandant> LoadMandants()
        {
            DataTable      tbl      = _con.Connection.GetData("CALL sp_GetMandants()");
            List <Mandant> mandants = new List <Mandant>();

            foreach (DataRow row in tbl.Rows)
            {
                Mandant m = new Mandant();
                m.FromDataRow(row);
                if (!(row["ParentMandantID"] is DBNull))
                {
                    m.Parent = LoadMandant((int)row["ParentMandantID"]);
                }
                mandants.Add(m);
            }
            return(mandants);
        }
예제 #2
0
        public Mandant LoadMandant(int mandantID)
        {
            DataTable tbl = _con.Connection.GetData("CALL sp_GetMandant(?mid)", new MySqlParameter("?mid", mandantID));

            if (tbl.Rows.Count != 1)
            {
                throw new ApplicationException("zu viele oder kein Mandant zu einer ID gefunden");
            }
            Mandant m = new Mandant();

            m.FromDataRow(tbl.Rows[0]);
            if (!(tbl.Rows[0]["ParentMandantID"] is DBNull))
            {
                m.Parent = LoadMandant((int)tbl.Rows[0]["ParentMandantID"]);
            }
            return(m);
        }