Exemple #1
0
        private void ViewDetailsData(string id)
        {
            populatePropertyInterface();
            //dt za autora
            DataTable     dt     = new DataTable();
            SqlDataReader reader = SqlHelper.ExecuteReader(SqlHelper.GetConnectionString(), CommandType.Text,
                                                           myProperty.GetProcedureSelectAllDetails(), myProperty.GetProcedureParametersIznajmljivanjeID().ToArray());

            dt.Load(reader);
            reader.Close();

            if (myProperty.GetType() == typeof(PropertyZaposleni))
            {
                lbDetaljno.Items.Add("-----------------------------------------");
                lbDetaljno.Items.Add("Radno mjesto: ");

                foreach (DataRow row in dt.Rows)
                {
                    int h = 0;
                    foreach (DataColumn col in dt.Columns)
                    {
                        lbDetaljno.Items.Add("\t" + row[h++]);
                    }
                }
            }
            else if (myProperty.GetType() == typeof(PropertyClanarina))
            {
                lbDetaljno.Items.Clear();
                foreach (DataRow row in dt.Rows)
                {
                    int h = 0;
                    foreach (DataColumn col in dt.Columns)
                    {
                        lbDetaljno.Items.Add(col + ": " + row[h++]);
                    }
                }
            }
            else if (myProperty.GetType() == typeof(PropertyIznajmljivanje))
            {
                lbDetaljno.Items.Clear();

                foreach (DataRow row in dt.Rows)
                {
                    int h = 0;
                    foreach (DataColumn col in dt.Columns)
                    {
                        lbDetaljno.Items.Add(col + ": " + row[h++]);
                    }
                }
            }
        }