public virtual void Fill() { this.PreFill(); this.dsOSDataSet1 = new OSDataSet(); this.m_StartRow = 0; this.Cursor = Cursors.WaitCursor; this.m_GridLoading = true; ThreadPool.QueueUserWorkItem(new WaitCallback(this.FillDataThread), Thread.CurrentPrincipal); }
public TablicniRazmjestajSredstava() { base.Load += new EventHandler(this.IznosiNabave_Load); this.ds = new S_OS_STANJE_LOKACIJADataSet(); this.dalok = new LOKACIJEDataAdapter(); this.dslokacije = new LOKACIJEDataSet(); this.daStanje = new S_OS_STANJE_LOKACIJADataAdapter(); this.m_cmDisable = true; this.dsosnovna = new OSDataSet(); this.daosnovna = new OSDataAdapter(); this.InitializeComponent(); }
public void IspisKarticeOS(object sender, EventArgs e) { frmUvjetiBilanca bilanca = new frmUvjetiBilanca(); OSDataSet set = new OSDataSet(); ReportDocument document = new ReportDocument(); int index = 0; RowEnumerator enumerator = this.userControlDataGridOS.DataGrid.Selected.Rows.GetEnumerator(); while (enumerator.MoveNext()) { UltraGridRow current = enumerator.Current; DataRow[] rowArray = this.userControlDataGridOS.DataGrid.DataSet.OS.Select(Conversions.ToString(Operators.ConcatenateObject("invbroj = ", current.Cells["invbroj"].Value))); DataRow[] rowArray2 = this.userControlDataGridOS.DataGrid.DataSet.OSTEMELJNICA.Select(Conversions.ToString(Operators.ConcatenateObject("invbroj = ", current.Cells["invbroj"].Value))); set.OS.ImportRow(rowArray[0]); int num2 = rowArray2.Length - 1; for (index = 0; index <= num2; index++) { set.OSTEMELJNICA.ImportRow(rowArray2[index]); } } document.Load(System.Windows.Forms.Application.StartupPath + @"\Izvjestaji\rptOSKartica.rpt"); document.SetDataSource(set); KORISNIKDataSet dataSet = new KORISNIKDataSet(); new KORISNIKDataAdapter().Fill(dataSet); document.SetParameterValue("ustanova", RuntimeHelpers.GetObjectValue(dataSet.KORISNIK.Rows[0]["KORISNIK1NAZIV"])); document.SetParameterValue("ustanova2", Operators.AddObject(Operators.AddObject(dataSet.KORISNIK.Rows[0]["KORISNIK1ADRESA"], " "), dataSet.KORISNIK.Rows[0]["KORISNIK1MJESTO"])); document.SetParameterValue("tel", RuntimeHelpers.GetObjectValue(dataSet.KORISNIK.Rows[0]["KONTAKTTELEFON"])); document.SetParameterValue("fax", RuntimeHelpers.GetObjectValue(dataSet.KORISNIK.Rows[0]["KONTAKTFAX"])); document.SetParameterValue("oib", RuntimeHelpers.GetObjectValue(dataSet.KORISNIK.Rows[0]["KORISNIKOIB"])); ExtendedWindowWorkspace workspace = new ExtendedWindowWorkspace(); PreviewReportWorkItem item = this.Controller.WorkItem.Items.Get <PreviewReportWorkItem>("Pregled"); if (item == null) { item = this.Controller.WorkItem.Items.AddNew <PreviewReportWorkItem>("Pregled"); } item.Izvjestaj = document; item.Activate(); item.Show(item.Workspaces["main"]); }
public void DosImportHandler(object sender, EventArgs e) { int num = 0; OSDataSet dataSet = new OSDataSet(); OSDataAdapter adapter2 = new OSDataAdapter(); if (Interaction.MsgBox("Ukoliko prebacujete OS pritisnite tipku <YES>", MsgBoxStyle.YesNo, "Osnovna sredstva / SI") == MsgBoxResult.Yes) { num = 1; } else { num = 2; } if (Interaction.MsgBox("Postojeća OS biti će obrisane, želite li stvarno nastaviti???", MsgBoxStyle.YesNo, "Osnovna sredstva / SI") != MsgBoxResult.No) { IEnumerator enumerator = null; try { enumerator = this.userControlDataGridOS.DataGrid.DataSet.OS.Rows.GetEnumerator(); while (enumerator.MoveNext()) { ((DataRow)enumerator.Current).Delete(); } } finally { if (enumerator is IDisposable) { (enumerator as IDisposable).Dispose(); } } AMSKUPINEDataSet set3 = new AMSKUPINEDataSet(); new AMSKUPINEDataAdapter().Fill(set3); adapter2.Update(this.userControlDataGridOS.DataGrid.DataSet); OpenFileDialog dialog = new OpenFileDialog { InitialDirectory = @"c:\", Filter = "txt files (*.dbf)|*.dbf|All files (*.*)|*.*", FilterIndex = 2, RestoreDirectory = true }; if (dialog.ShowDialog() == DialogResult.OK) { OleDbDataAdapter adapter; string str3 = dialog.FileName.ToUpper().Replace(@"\OSM.DBF", ""); string prompt = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + str3 + ";Extended Properties=dBase IV;"; Interaction.MsgBox(prompt, MsgBoxStyle.OkOnly, null); OleDbConnection selectConnection = new OleDbConnection(prompt); if (Interaction.MsgBox("Želite li prebaciti i sredstva sa količinom 0", MsgBoxStyle.YesNo, null) == MsgBoxResult.Yes) { adapter = new OleDbDataAdapter("select * FROM OSM", selectConnection); } else { adapter = new OleDbDataAdapter("select * FROM OSM where KOLU > 0", selectConnection); } DataSet set2 = new DataSet(); adapter.Fill(set2, "OSA"); if (Interaction.MsgBox("Broj pronađenih zapisa: " + Conversions.ToString(set2.Tables["OSA"].Rows.Count) + "\r\n\r\nŽelite li zadržati importirane zapise?", MsgBoxStyle.YesNo, null) == MsgBoxResult.No) { set2.RejectChanges(); } else { IEnumerator enumerator2 = null; int num2 = 1; try { enumerator2 = set2.Tables["OSA"].Rows.GetEnumerator(); while (enumerator2.MoveNext()) { DataRow current = (DataRow)enumerator2.Current; DataRow row = dataSet.OS.NewRow(); if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(current["SIFRA"]))) { DateTime now; DateTime time2; string str4 = string.Empty; string str6 = string.Empty; string str5 = string.Empty; if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(current["NAZIV"]))) { str5 = DB.Ko437to852(Conversions.ToString(current["NAZIV"])).Substring(0, DB.Ko437to852(Conversions.ToString(current["NAZIV"])).Length - 1); } else { str5 = "Nije postojao upisani naziv"; } if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(current["DATUM"]))) { now = Conversions.ToDate(Interaction.IIf(Information.IsDate(RuntimeHelpers.GetObjectValue(current["DATUM"])), Conversions.ToDate(current["DATUM"]), DateTime.Now)); } else { now = DateTime.Now; } if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(current["DATUMUP"]))) { time2 = Conversions.ToDate(Interaction.IIf(Information.IsDate(RuntimeHelpers.GetObjectValue(current["DATUMUP"])), Conversions.ToDate(current["DATUMUP"]), DateTime.Now)); } else { time2 = DateTime.Now; } if (DateTime.Compare(time2, Conversions.ToDate("01/01/1754")) < 0) { time2 = DateTime.Now; } if (DateTime.Compare(now, Conversions.ToDate("01/01/1754")) < 0) { now = DateTime.Now; } if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(current["AMORT"]))) { str6 = Conversions.ToString(current["AMORT"]); } else { str6 = ""; } if (!Information.IsDBNull(RuntimeHelpers.GetObjectValue(current["NAPOMENA"]))) { str4 = DB.Ko437to852(Conversions.ToString(current["NAPOMENA"])).Substring(0, DB.Ko437to852(Conversions.ToString(current["NAPOMENA"])).Length - 1); } else { str4 = "Nije postojala upisana napomena"; } row["invbroj"] = Conversions.ToInteger(current["SIFRA"]); row["nazivos"] = Strings.Left(str5, 0x31); row["datumnabavke"] = now; row["datumuporabe"] = time2; if (set3.AMSKUPINE.Select("kratkasifra = '" + str6 + "'").Length == 0) { row["idamskupine"] = 0x270f; } else { row["idamskupine"] = RuntimeHelpers.GetObjectValue(set3.AMSKUPINE.Select("kratkasifra = '" + str6 + "'")[0]["idamskupine"]); } row["idosvrsta"] = num; row["napomenaos"] = Strings.Left(str4, 0x31); dataSet.OS.Rows.Add(row); DataRow row4 = dataSet.OSTEMELJNICA.NewRow(); row4["invbroj"] = Conversions.ToInteger(current["SIFRA"]); row4["idosdokument"] = 1; row4["osbrojdokumenta"] = 0; row4["osdatumdok"] = time2; row4["oskolicina"] = Convert.ToInt32(DB.N20(RuntimeHelpers.GetObjectValue(current["KOLU"]))); row4["osstopa"] = 0; row4["ososnovica"] = 0; if (Convert.ToInt32(DB.N20(RuntimeHelpers.GetObjectValue(current["KOLU"]))) > 0) { row4["osduguje"] = decimal.Multiply(DB.N20(RuntimeHelpers.GetObjectValue(current["NABVRI"])), new decimal(Convert.ToInt32(DB.N20(RuntimeHelpers.GetObjectValue(current["KOLU"]))))); } else { row4["osduguje"] = DB.N20(RuntimeHelpers.GetObjectValue(current["NABVRI"])); } row4["ospotrazuje"] = 0; row4["osOPIS"] = "PS-Nabavna"; dataSet.OSTEMELJNICA.Rows.Add(row4); row4 = dataSet.OSTEMELJNICA.NewRow(); row4["invbroj"] = Conversions.ToInteger(current["SIFRA"]); row4["idosdokument"] = 2; row4["osbrojdokumenta"] = 0; row4["osdatumdok"] = time2; row4["oskolicina"] = Convert.ToInt32(DB.N20(RuntimeHelpers.GetObjectValue(current["KOLU"]))); row4["osstopa"] = 0; row4["ososnovica"] = 0; row4["osduguje"] = 0; if (Convert.ToInt32(DB.N20(RuntimeHelpers.GetObjectValue(current["KOLU"]))) > 0) { row4["ospotrazuje"] = decimal.Multiply(DB.N20(RuntimeHelpers.GetObjectValue(current["ISPVRI"])), new decimal(Convert.ToInt32(DB.N20(RuntimeHelpers.GetObjectValue(current["KOLU"]))))); } else { row4["ospotrazuje"] = DB.N20(RuntimeHelpers.GetObjectValue(current["ISPVRI"])); } row4["osOPIS"] = "PS-Ispravak"; dataSet.OSTEMELJNICA.Rows.Add(row4); num2++; try { adapter2.Update(dataSet); continue; } catch (System.Exception exception1) { throw exception1; //continue; } } } } finally { if (enumerator2 is IDisposable) { (enumerator2 as IDisposable).Dispose(); } } MessageBox.Show("Importiranje OS/SI završeno!", "Import", MessageBoxButtons.OK, MessageBoxIcon.Asterisk); adapter2.Fill(this.userControlDataGridOS.DataGrid.DataSet); } } } }