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); if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(dataSet.S_OS_BROJ_I_DATUM.Rows[0]["BROJDOK"]))) { this.BROJTEMELJNICE.MinValue = 1; this.BROJTEMELJNICE.Value = 1; } else { this.BROJTEMELJNICE.Value = RuntimeHelpers.GetObjectValue(dataSet.S_OS_BROJ_I_DATUM.Rows[0]["BROJDOK"]); } if (Information.IsDBNull(RuntimeHelpers.GetObjectValue(dataSet.S_OS_BROJ_I_DATUM.Rows[0]["ZADNJIDATUM"]))) { this.DATUMTEMELJNICE.MinDate = DateTime.Now; this.DATUMTEMELJNICE.Value = DateTime.Now; } else { this.DATUMTEMELJNICE.MinDate = Conversions.ToDate(dataSet.S_OS_BROJ_I_DATUM.Rows[0]["ZADNJIDATUM"]); this.DATUMTEMELJNICE.Value = Conversions.ToDate(dataSet.S_OS_BROJ_I_DATUM.Rows[0]["ZADNJIDATUM"]); } InfraCustom.PostaviSelectAllSvimEditKontrolama(this); InfraCustom.PostaviEnterUTabSvimEditKontrolama(this); }
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); }
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); this.BROJTEMELJNICE.MaxValue = Operators.SubtractObject(dataSet.S_OS_BROJ_I_DATUM.Rows[0]["BROJDOK"], 1); this.BROJTEMELJNICE.Value = Operators.SubtractObject(dataSet.S_OS_BROJ_I_DATUM.Rows[0]["BROJDOK"], 1); InfraCustom.PostaviSelectAllSvimEditKontrolama(this); InfraCustom.PostaviEnterUTabSvimEditKontrolama(this); }