Exemplo n.º 1
0
        public INTGSTBL GetOne(int ID)
        {
            SqlConnection Con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["Con"].ToString());

            Con.Open();
            SqlCommand    cmd    = null;
            SqlDataReader SDR    = null;
            INTGSTBL      ObjTmp = new INTGSTBL();

            try
            {
                string Query = "SELECT * FROM  INTGSTBL where GSID=@GSID";
                cmd = new SqlCommand(Query, Con);
                cmd.Parameters.AddWithValue("@GSID", ID);
                SDR = cmd.ExecuteReader();
                while (SDR.Read())
                {
                    ObjTmp.GSID                = SDR.GetInt32(0);
                    ObjTmp.CatID               = SDR.GetInt32(1);
                    ObjTmp.Name                = SDR.GetString(2);
                    ObjTmp.Typeid              = SDR.GetInt32(3);
                    ObjTmp.UnitID              = SDR.GetInt32(4);
                    ObjTmp.Qty                 = SDR.GetDouble(5);
                    ObjTmp.PurchasedPrize      = SDR.GetDouble(6);
                    ObjTmp.PurchasedTax        = SDR.GetDouble(7);
                    ObjTmp.SalePrize           = SDR.GetDouble(8);
                    ObjTmp.SaleTax             = SDR.GetDouble(9);
                    ObjTmp.ISSaleable          = SDR.GetBoolean(10);
                    ObjTmp.ISdirectlyPurchased = SDR.GetBoolean(11);
                    ObjTmp.ISProcessed         = SDR.GetBoolean(12);
                    ObjTmp.ServicePrize        = SDR.GetDouble(13);
                    ObjTmp.ServiceTax          = SDR.GetDouble(14);
                }
            }
            catch (System.Exception e)
            { e.ToString(); }

            finally { Con.Close(); }

            return(ObjTmp);
        }
Exemplo n.º 2
0
        public static List <INTGSTBL> GetAll()
        {
            DBCon           con        = new DBCon();
            SqlCommand      cmd        = null;
            SqlDataReader   SDR        = null;
            List <INTGSTBL> listintcat = new List <INTGSTBL>();

            try
            {
                string Quary = "Select * from INTGSTBL";
                cmd = new SqlCommand(Quary, con.Con);
                SDR = cmd.ExecuteReader();

                while (SDR.Read())
                {
                    INTGSTBL OBJINT = new INTGSTBL();
                    OBJINT.GSID                = SDR.GetInt32(0);
                    OBJINT.CatID               = SDR.GetInt32(1);
                    OBJINT.Name                = SDR.GetString(2);
                    OBJINT.Typeid              = SDR.GetInt32(3);
                    OBJINT.UnitID              = SDR.GetInt32(4);
                    OBJINT.Qty                 = SDR.GetDouble(5);
                    OBJINT.PurchasedPrize      = SDR.GetDouble(6);
                    OBJINT.PurchasedTax        = SDR.GetDouble(7);
                    OBJINT.SalePrize           = SDR.GetDouble(8);
                    OBJINT.SaleTax             = SDR.GetDouble(9);
                    OBJINT.ISSaleable          = SDR.GetBoolean(10);
                    OBJINT.ISdirectlyPurchased = SDR.GetBoolean(11);
                    OBJINT.ISProcessed         = SDR.GetBoolean(12);
                    OBJINT.ServicePrize        = SDR.GetDouble(13);
                    OBJINT.ServiceTax          = SDR.GetDouble(14);
                    listintcat.Add(OBJINT);
                }
            }
            catch (Exception e) { e.ToString(); }
            finally { cmd.Dispose(); con.Con.Close(); }
            return(listintcat);
        }