Пример #1
0
        protected PurchaseInvoicesDetails GetByID(int _ID)
        {
            Gate.Command.CommandText  = "select * from PurchaseInvoicesDetails";
            Gate.Command.CommandText += " Where ID = @ID ";
            Gate.Command.Parameters.Clear();
            Gate.Command.Parameters.AddWithValue("@ID", _ID);
            System.Data.SqlClient.SqlDataReader Reader = Gate.Execute();
            PurchaseInvoicesDetails             NewObj = new PurchaseInvoicesDetails();

            if (Reader != null && Reader.Read())
            {
                if (Reader["ID"] != null)
                {
                    NewObj.ID = int.Parse(Reader["ID"].ToString());
                }
                if (Reader["pur_invoiceID"] != null)
                {
                    NewObj.pur_invoiceID = int.Parse(Reader["pur_invoiceID"].ToString());
                }
                if (Reader["ProductID"] != null)
                {
                    NewObj.ProductID = int.Parse(Reader["ProductID"].ToString());
                }
                if (Reader["QTY"] != null)
                {
                    NewObj.QTY = int.Parse(Reader["QTY"].ToString());
                }
                if (Reader["BuyPrice"] != null)
                {
                    NewObj.BuyPrice = float.Parse(Reader["BuyPrice"].ToString());
                }
                if (Reader["SalePrice"] != null)
                {
                    NewObj.SalePrice = float.Parse(Reader["SalePrice"].ToString());
                }
                if (Reader["Tax"] != null)
                {
                    NewObj.Tax = float.Parse(Reader["Tax"].ToString());
                }
                if (Reader["ExpireDate"] != null)
                {
                    NewObj.ExpireDate = (DateTime)Reader["ExpireDate"];
                }
                if (Reader["Total"] != null)
                {
                    NewObj.Total = float.Parse(Reader["Total"].ToString());
                }
                if (Reader["Discount"] != null)
                {
                    NewObj.Discount = float.Parse(Reader["Discount"].ToString());
                }
            }
            ;
            Gate.Close();
            return(NewObj);
        }
Пример #2
0
        protected List <PurchaseInvoicesDetails> GetAll()
        {
            Gate.Command.CommandText = "select * from PurchaseInvoicesDetails";
            Gate.Command.Parameters.Clear();
            System.Data.SqlClient.SqlDataReader Reader = Gate.Execute();
            List <PurchaseInvoicesDetails>      List   = new List <PurchaseInvoicesDetails>();

            while (Reader != null && Reader.Read())
            {
                PurchaseInvoicesDetails NewObj = new PurchaseInvoicesDetails();
                if (Reader["ID"] != null)
                {
                    NewObj.ID = int.Parse(Reader["ID"].ToString());
                }
                if (Reader["pur_invoiceID"] != null)
                {
                    NewObj.pur_invoiceID = int.Parse(Reader["pur_invoiceID"].ToString());
                }
                if (Reader["ProductID"] != null)
                {
                    NewObj.ProductID = int.Parse(Reader["ProductID"].ToString());
                }
                if (Reader["QTY"] != null)
                {
                    NewObj.QTY = int.Parse(Reader["QTY"].ToString());
                }
                if (Reader["BuyPrice"] != null)
                {
                    NewObj.BuyPrice = float.Parse(Reader["BuyPrice"].ToString());
                }
                if (Reader["SalePrice"] != null)
                {
                    NewObj.SalePrice = float.Parse(Reader["SalePrice"].ToString());
                }
                if (Reader["Tax"] != null)
                {
                    NewObj.Tax = float.Parse(Reader["Tax"].ToString());
                }
                if (Reader["ExpireDate"] != null)
                {
                    NewObj.ExpireDate = (DateTime)Reader["ExpireDate"];
                }
                if (Reader["Total"] != null)
                {
                    NewObj.Total = float.Parse(Reader["Total"].ToString());
                }
                if (Reader["Discount"] != null)
                {
                    NewObj.Discount = float.Parse(Reader["Discount"].ToString());
                }
                List.Add(NewObj);
            }
            ;
            Gate.Close();
            return(List);
        }