Example #1
0
    private void frmIdentifikator_Load(object sender, EventArgs e)
    {
        S_OS_BROJ_I_DATUMDataAdapter adapter = new S_OS_BROJ_I_DATUMDataAdapter();
        S_OS_BROJ_I_DATUMDataSet     dataSet = new S_OS_BROJ_I_DATUMDataSet();

        adapter.Fill(dataSet);
        SqlCommand    command    = new SqlCommand();
        SqlConnection connection = new SqlConnection();

        command.CommandType         = CommandType.Text;
        command.CommandText         = "SELECT MAX(OSDATUMDOK) FROM OSTEMELJNICA WHERE IDOSDOKUMENT = 2 and osbrojdokumenta > 0";
        connection.ConnectionString = Mipsed7.Core.ApplicationDatabaseInformation.ConnectionString;
        command.Connection          = connection;
        connection.Open();
        SqlDataReader reader = command.ExecuteReader();

        try
        {
            reader.Read();

            DateTime dateTime = reader.GetDateTime(0);
            this.ODDATUMA.Value = dateTime.AddDays(1.0);
            this.DODATUMA.Value = dateTime.AddYears(1);
        }
        catch (System.Exception)
        {
            this.ODDATUMA.Value = DateAndTime.DateSerial(DateTime.Now.Year, 1, 1);
            this.DODATUMA.Value = DateAndTime.DateSerial(DateTime.Now.Year, 12, 31);
        }

        connection.Close();
        this.BROJTEMELJNICE.Value = RuntimeHelpers.GetObjectValue(Interaction.IIf(Information.IsDBNull(RuntimeHelpers.GetObjectValue(dataSet.S_OS_BROJ_I_DATUM.Rows[0]["BROJDOK"])), 1, RuntimeHelpers.GetObjectValue(dataSet.S_OS_BROJ_I_DATUM.Rows[0]["BROJDOK"])));
        InfraCustom.PostaviSelectAllSvimEditKontrolama(this);
        InfraCustom.PostaviEnterUTabSvimEditKontrolama(this);
    }