Beispiel #1
0
        public static Kiosk getByCode(int code)
        {
            Kiosk k = new Kiosk();

            try
            {
                KioskProvider p = new KioskProvider();
                DataSet ds = p.getByCode(code);
                if (ds.Tables[0].Rows.Count > 0)
                {
                    k._id = int.Parse(ds.Tables[0].Rows[0]["id_kiosk"].ToString());
                    k._del = bool.Parse(ds.Tables[0].Rows[0]["del"].ToString());
                    k._name = ds.Tables[0].Rows[0]["name"].ToString();
                    k._path = ds.Tables[0].Rows[0]["path"].ToString();
                    k._code = int.Parse(ds.Tables[0].Rows[0]["code"].ToString());
                }

            }
            catch (Exception ex)
            {
            }

            return k;
        }
Beispiel #2
0
        public bool Save()
        {
            bool ret = false;

            try
            {
                KioskProvider p = new KioskProvider();
                p.update(this._name, this._path, this._code, this._id);
                ret = true;
            }
            catch
            {
                ret = false;
            }

            return ret;
        }
Beispiel #3
0
        public bool Add()
        {
            bool ret = false;

            try
            {
                KioskProvider p = new KioskProvider();
                if (p.add(this._name, this._path, this._code) > 0)
                {
                    ret = true;
                }
                else
                {
                    ret = false;
                }
            }
            catch(Exception ex)
            {
                ret = false;
            }

            return ret;
        }
Beispiel #4
0
        public bool Delete()
        {
            bool ret = false;

            try
            {
                KioskProvider p = new KioskProvider();
                p.delete(this._id, this._del);
                ret = true;
            }
            catch
            {
                ret = false;
            }

            return ret;
        }
Beispiel #5
0
        public static List<Kiosk> getListAll()
        {
            List<Kiosk> l = new List<Kiosk>();

            try
            {
                KioskProvider p = new KioskProvider();
                DataSet ds = p.GetAll();
                for (int i = 0; i < ds.Tables[0].Rows.Count; i++)
                {
                    Kiosk k = new Kiosk();
                    k._id = int.Parse(ds.Tables[0].Rows[i]["id_kiosk"].ToString());
                    k._del = bool.Parse(ds.Tables[0].Rows[i]["del"].ToString());
                    k._name = ds.Tables[0].Rows[i]["name"].ToString();
                    k._path = ds.Tables[0].Rows[i]["path"].ToString();
                    k._code = int.Parse(ds.Tables[0].Rows[i]["code"].ToString());

                    l.Add(k);
                }
            }
            catch (Exception ex)
            {
            }

            return l;
        }