GetDBNullableText() public static méthode

public static GetDBNullableText ( DataRow row, string field ) : string
row System.Data.DataRow
field string
Résultat string
Exemple #1
0
        public static ArrayList GetPossibleSubItems(GISADataset.NivelRow nRow)         //PossibleSubNivel()
        {
            //ToDo()
            // Obter os TipoNivelRelacionados das RelacaoHierarquicas das EPs superiores. Para cada TiponivelRelacionado devolver também o intervalo da relação associada.
            // espandir os TipoNivelRelacionados permitidos como subníveis para cada um dos TipoNivelRelacionados encontrados anteriormente. Para cada um dos tipos de subnivel guardar o intervalo de data em que ele faz sentido

            ArrayList subNiveis = new ArrayList();

            GisaDataSetHelper.HoldOpen ho = new GisaDataSetHelper.HoldOpen(GisaDataSetHelper.GetConnection());
            try
            {
                Trace.WriteLine("<getPossibleSubTypesOf>");

                IDataReader dataReader = null;
                dataReader = TipoNivelRule.Current.GetPossibleSubItems(nRow.ID, ho.Connection);

                Trace.WriteLine("<getPossibleSubTypesOf/>");

                while (dataReader.Read())
                {
                    PossibleSubNivel subNivel = new PossibleSubNivel();
                    subNivel.SubIDTipoNivelRelacionado = System.Convert.ToInt64(dataReader.GetValue(0));
                    subNivel.Designacao = GisaDataSetHelper.GetDBNullableText(ref dataReader, 1);
                    subNivel.InicioAno  = GisaDataSetHelper.GetDBNullableText(ref dataReader, 2);
                    subNivel.InicioMes  = GisaDataSetHelper.GetDBNullableText(ref dataReader, 3);
                    subNivel.InicioDia  = GisaDataSetHelper.GetDBNullableText(ref dataReader, 4);
                    subNivel.FimAno     = GisaDataSetHelper.GetDBNullableText(ref dataReader, 5);
                    subNivel.FimMes     = GisaDataSetHelper.GetDBNullableText(ref dataReader, 6);
                    subNivel.FimDia     = GisaDataSetHelper.GetDBNullableText(ref dataReader, 7);
                    subNiveis.Add(subNivel);
                }
                dataReader.Close();
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
                throw ex;
            }
            finally
            {
                ho.Dispose();
            }

            // não são encontrados subniveis organicos possiveis se não existirem
            if (subNiveis.Count == 0)
            {
            }

            return(subNiveis);
        }
Exemple #2
0
		public virtual int Compare(object x, object y)
		{
			try
			{
				// Possibilitar a recepção de nulls para ter em conta as EDs
				if (x == null && y == null)
				{
					return 0;
				}
				else if (x == null)
				{
					return -1;
				}
				else if (y == null)
				{
					return 1;
				}

				Debug.Assert(x is GISADataset.RelacaoHierarquicaRow);
				Debug.Assert(y is GISADataset.RelacaoHierarquicaRow);

				// se forem o mesmo objecto são garantidamente iguais
				if (x == y)
				{
					return 0;
				}

				GISADataset.RelacaoHierarquicaRow rhRow1 = (GISADataset.RelacaoHierarquicaRow)x;
				GISADataset.RelacaoHierarquicaRow rhRow2 = (GISADataset.RelacaoHierarquicaRow)y;

				decimal xgui = rhRow1.TipoNivelRelacionadoRow.GUIOrder;
				decimal ygui = rhRow2.TipoNivelRelacionadoRow.GUIOrder;

				if (xgui == ygui)
				{
					string anoInicio1 = GisaDataSetHelper.GetDBNullableText( rhRow1, "InicioAno");
					string mesInicio1 = GisaDataSetHelper.GetDBNullableText( rhRow1, "InicioMes");
					string diaInicio1 = GisaDataSetHelper.GetDBNullableText( rhRow1, "InicioDia");
					string anoInicio2 = GisaDataSetHelper.GetDBNullableText( rhRow2, "InicioAno");
					string mesInicio2 = GisaDataSetHelper.GetDBNullableText( rhRow2, "InicioMes");
					string diaInicio2 = GisaDataSetHelper.GetDBNullableText( rhRow2, "InicioDia");
					string dataInicio1 = string.Format("{0}{1}{2}", normalizeYear(anoInicio1), normalizeMonth(mesInicio1), normalizeYear(diaInicio1));
					string dataInicio2 = string.Format("{0}{1}{2}", normalizeYear(anoInicio2), normalizeMonth(mesInicio2), normalizeDay(diaInicio2));
					if (dataInicio1.CompareTo(dataInicio2) < 0)
					{
						return -1;
					}
					else if (dataInicio1.CompareTo(dataInicio2) > 0)
					{
						return 1;
					}

					//Dim xcod As String = rhRow1.NivelRowByNivelRelacaoHierarquica.Codigo
					//Dim ycod As String = rhRow2.NivelRowByNivelRelacaoHierarquica.Codigo

					//If MathHelper.IsNumber(xcod) AndAlso MathHelper.IsNumber(ycod) Then
					//    Dim xdec As Integer = Integer.Parse(xcod)
					//    Dim ydec As Integer = Integer.Parse(ycod)

					//    If xdec < ydec Then Return -1
					//    If xdec > ydec Then Return 1
					//Else
					//    If xcod < ycod Then Return -1
					//    If xcod > ycod Then Return 1
					//End If

					// Se o codigo for igual, comparar a designacao
					return CompareDesignacao(rhRow1, rhRow2);
				}
				else if (xgui < ygui)
				{
					return -1;
				}
				else //If xgui > ygui Then
				{
					return 1;
				}
			}
			catch (Exception ex)
			{
				Trace.WriteLine(ex);
			}
			//INSTANT C# NOTE: Inserted the following 'return' since all code paths must return a value in C#:
			return 0;
		}