Exemple #1
0
        public static List <AddOnItems> GetAll(string AddOnItemId)
        {
            DBCon             con            = new DBCon();
            SqlCommand        cmd            = null;
            SqlDataReader     SDR            = null;
            List <AddOnItems> listAddOnItems = new List <AddOnItems>();

            try
            {
                string Quary = "Select * from HG_AddOnItems where AdddOnItemId IN (" + AddOnItemId + ")";
                cmd = new SqlCommand(Quary, con.Con);
                SDR = cmd.ExecuteReader();

                while (SDR.Read())
                {
                    AddOnItems OBJINT = new AddOnItems();
                    OBJINT.AddOnItemId = SDR.GetInt32(0);
                    OBJINT.ItemId      = SDR.GetInt32(1);
                    OBJINT.CostPrice   = SDR.GetDouble(2);
                    OBJINT.Tax         = SDR.GetDouble(3);
                    OBJINT.Price       = SDR.GetDouble(4);
                    OBJINT.AddonID     = SDR.GetInt32(5);
                    listAddOnItems.Add(OBJINT);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); con.Con.Close(); }
            return(listAddOnItems);
        }
Exemple #2
0
        public AddOnItems GetOne(int ID)
        {
            DBCon         dBCon  = new DBCon();
            SqlCommand    cmd    = null;
            SqlDataReader SDR    = null;
            AddOnItems    ObjTmp = new AddOnItems();

            try
            {
                string Query = "SELECT * FROM  HG_AddOnItems where AddOnItemId=" + ID;
                cmd = new SqlCommand(Query, dBCon.Con);
                cmd.Parameters.AddWithValue("@AddOnItemId", ID);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    int index = 0;
                    ObjTmp.AddOnItemId = SDR.GetInt32(index++);
                    ObjTmp.ItemId      = SDR.GetInt32(index++);
                    ObjTmp.CostPrice   = SDR.GetDouble(index++);
                    ObjTmp.Tax         = SDR.GetDouble(index++);
                    ObjTmp.Price       = SDR.GetDouble(index++);
                    ObjTmp.AddonID     = SDR.GetInt32(index++);
                }
            }
            catch (Exception e)
            { e.ToString(); }

            finally { dBCon.Con.Close(); SDR.Close(); }

            return(ObjTmp);
        }