public void RowEnumerator_MoveNext_ReturnsTheExpectedLocation() { var board = new Board(5, 5); board[1, 0].Occupied = Occupied.Red; board[1, 1].Occupied = Occupied.Yellow; board[1, 2].Occupied = Occupied.Red; var sut = new RowEnumerator(board, 1); sut.MoveNext(); sut.Current.Occupied.ShouldBe(Occupied.Red); sut.MoveNext(); sut.Current.Occupied.ShouldBe(Occupied.Yellow); sut.MoveNext(); sut.Current.Occupied.ShouldBe(Occupied.Red); }
public void knjizi_sve() { SqlConnection connection = new SqlConnection { ConnectionString = Configuration.ConnectionString }; connection.Open(); SqlCommand command = new SqlCommand { CommandType = CommandType.Text, Connection = connection, CommandText = "update ddobracun set DDZAKLJUCAN = 1" }; try { command.ExecuteNonQuery(); RowEnumerator enumerator = this.UltraGrid1.Rows.GetEnumerator(); while (enumerator.MoveNext()) { enumerator.Current.Cells["DDZAKLJUCAN"].Value = 1; } } catch (System.Exception exception1) { throw exception1; } connection.Close(); }
public void RowEnumerator_InitialState_InvalidUntilMoveNextCalled() { var board = new Board(5, 5); var sut = new RowEnumerator(board, 2); Assert.Throws<IndexOutOfRangeException>(() => { var location = sut.Current; }); sut.MoveNext(); Assert.DoesNotThrow(() => { var location = sut.Current; }); }
/// <summary> /// If the row enumerator hasn't been initialized for the current result set, the /// enumerator for the current result set is defined. Increments the enumerator /// </summary> /// <returns>True if tere were more rows, false otherwise</returns> public override bool Read() { if (ThrowOnRead) { throw new TestDbException(); } if (RowEnumerator == null) { RowEnumerator = ResultSetEnumerator.Current.GetEnumerator(); } return(RowEnumerator.MoveNext()); }
private bool Brisi() { bool flag = false; string str = string.Empty; this.cbSifra.Enabled = false; if (!this.ProvjeraPrijeSpremanja()) { this.cbSifra.Enabled = true; return(false); } RowEnumerator enumerator = this.__Parent_Obracun.UltraGrid1.Rows.GetEnumerator(); while (enumerator.MoveNext()) { string str3 = string.Empty; UltraGridRow current = enumerator.Current; if (Conversions.ToBoolean(current.Cells["oznacen"].Value)) { DataView defaultView = this.__Parent_Obracun.ObracunDataSet1.ObracunElementi.DefaultView; defaultView.RowFilter = string.Format("IDRADNIK = {0} AND IDELEMENT = {1}", RuntimeHelpers.GetObjectValue(current.Cells["IDRADNIK"].Value), RuntimeHelpers.GetObjectValue(this.cbSifra.Value)); if (defaultView.Count > 0) { str3 = defaultView[0]["IDRADNIK"].ToString(); defaultView[0].Delete(); } } if (str != "") { str = str + ", "; } str = str + str3; } if (str == "") { MessageBox.Show("Element_nije_pronađen_ni_na_jednom_označenom_zaposleniku"); } else { MessageBox.Show("Element_je_uspješno_obrisan_označenim_zaposlenicima"); } this.DialogResult = System.Windows.Forms.DialogResult.OK; return(flag); }
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 RowEnumerator_MoveNext_ReturnsFalseAtEndOfRow() { var board = new Board(5, 5); board[1, 0].Occupied = Occupied.Red; board[1, 1].Occupied = Occupied.Yellow; board[1, 2].Occupied = Occupied.Red; var sut = new RowEnumerator(board, 1); sut.MoveNext().ShouldBe(true); sut.MoveNext().ShouldBe(true); sut.MoveNext().ShouldBe(true); sut.MoveNext().ShouldBe(true); sut.MoveNext().ShouldBe(true); sut.MoveNext().ShouldBe(false); }
private void AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { BindingList <ICompoundGroupItem> selectedCompounds = new BindingList <ICompoundGroupItem>(); SelectedRowsCollection seletedRows = this.ultraGrid.Selected.Rows; if (seletedRows != null) { RowEnumerator enumerator = seletedRows.GetEnumerator(); if (enumerator != null) { while (enumerator.MoveNext()) { UltraGridRow row = enumerator.Current; ICompoundGroupItem compound = row.ListObject as ICompoundGroupItem; if (compound != null) { selectedCompounds.Add(compound); } } } } this.Model.SelectedCompoundGroups = selectedCompounds; }
private void AfterSelectChange(object sender, AfterSelectChangeEventArgs e) { BindingList <ISample> selectedSamples = new BindingList <ISample>(); SelectedRowsCollection seletedRows = this.ultraGrid.Selected.Rows; if (seletedRows != null) { RowEnumerator enumerator = seletedRows.GetEnumerator(); if (enumerator != null) { while (enumerator.MoveNext()) { UltraGridRow row = enumerator.Current; ISample sample = row.ListObject as ISample; if (sample != null) { selectedSamples.Add(sample); } } } } this.Model.SelectedSamples = selectedSamples; }
public void Ispis_Naljepnica_MaliFORMAT() { KORISNIKDataSet dataSet = new KORISNIKDataSet(); new KORISNIKDataAdapter().Fill(dataSet); string str = Conversions.ToString(dataSet.KORISNIK.Rows[0]["KORISNIK1NAZIVZANALJEPNICE"]); Encoding encoding = Encoding.GetEncoding(0x4e2); StreamWriter writer = new StreamWriter("maleN.txt", false, encoding); RowEnumerator enumerator = this.userControlDataGridOS.DataGrid.Selected.Rows.GetEnumerator(); while (enumerator.MoveNext()) { int num3 = 0; int num4 = 0; UltraGridRow current = enumerator.Current; foreach (DataRow row2 in this.userControlDataGridOS.DataGrid.DataSet.OSTEMELJNICA.Select(Conversions.ToString(Operators.ConcatenateObject("INVBROJ = ", current.Cells["INVBROJ"].Value)))) { if (Conversions.ToBoolean(Operators.OrObject(Operators.CompareObjectEqual(row2["idosdokument"], 1, false), Operators.CompareObjectEqual(row2["idosdokument"], 6, false)))) { num4 = Conversions.ToInteger(Operators.AddObject(num4, row2["OSKOLICINA"])); } if (Conversions.ToBoolean(Operators.OrObject(Operators.CompareObjectEqual(row2["idosdokument"], 3, false), Operators.CompareObjectEqual(row2["idosdokument"], 7, false)))) { num3 = Conversions.ToInteger(Operators.AddObject(num3, row2["OSKOLICINA"])); } } int num2 = num4 + num3; num4 = 0; num3 = 0; int num7 = num2; for (int i = 1; i <= num7; i++) { string str3 = "\"" + str + "\""; string str4 = Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject("\"", current.Cells["NAZIVOS"].Value), "\"")); string str2 = Conversions.ToString(Operators.ConcatenateObject(Operators.ConcatenateObject("\"", current.Cells["INVBROJ"].Value), "\"")); writer.WriteLine(""); writer.WriteLine("N"); writer.WriteLine("I8,B,001"); writer.WriteLine("Q152,32"); writer.WriteLine("q100"); writer.WriteLine("rN"); writer.WriteLine("S2"); writer.WriteLine("D7"); writer.WriteLine("ZB"); writer.WriteLine("JF"); writer.WriteLine("OD"); writer.WriteLine("R60,0"); writer.WriteLine("A210,26,0,1,1,1,N," + str3); writer.WriteLine("A210,46,0,1,1,1,N," + str4); writer.WriteLine("B210,65,0,1,2,2,60,B," + str2); writer.WriteLine("P1"); } } writer.Close(); if (Interaction.MsgBox("Izrada naljepnica završena. Želite li ispisati naljepnice na ZEBRA printer?", MsgBoxStyle.YesNo, "OS-Ispis naljepnica") == MsgBoxResult.Yes) { PrintDialog dialog = new PrintDialog { PrinterSettings = new PrinterSettings() }; if (dialog.ShowDialog(this) == DialogResult.OK) { DOSPrinter.SendFileToPrinter(dialog.PrinterSettings.PrinterName, "maleN.txt"); } else { Interaction.MsgBox("Odustali ste od ispisa naljepnica!", MsgBoxStyle.OkOnly, "OS-Ispis naljepnica"); } } }
private void NetoUBrutoObracun_Load(object sender, EventArgs e) { IEnumerator <object> enumerator = this.Controller.WorkItem.Workspaces["main"].SmartParts.GetEnumerator(); while (enumerator.MoveNext()) { UserControl current; if (enumerator.Current is UserControl) { current = (UserControl)enumerator.Current; if (current.Name.ToLower() == "radnikworkwith") { int x = 0; RowEnumerator enumerator2 = ((RADNIKDataGrid)current.Controls[0].Controls[0]).Selected.Rows.GetEnumerator(); while (enumerator2.MoveNext()) { UltraGridRow row = enumerator2.Current; this.Dodaj_Iz_Zposlenika(string.Format("{0} {1}", RuntimeHelpers.GetObjectValue(row.Cells["prezime"].Value), RuntimeHelpers.GetObjectValue(row.Cells["ime"].Value)), Conversions.ToDecimal(row.Cells["opcinastanovanjaprirez"].Value), x); x++; } } } if (enumerator.Current is UserControl) { current = (UserControl)enumerator.Current; if (current.Name.ToLower() == "obracunsmartpart") { int num2 = 0; RowEnumerator enumerator3 = ((ObracunSmartPart)current).UltraGrid1.Rows.GetEnumerator(); while (enumerator3.MoveNext()) { UltraGridRow row2 = enumerator3.Current; if (Conversions.ToBoolean(Operators.AndObject(this.m_mjesecisplate != null, Operators.CompareObjectEqual(row2.Cells["OZNACEN"].Value, true, false)))) { this.ds.Clear(); this.daPodaci.SelectCommand.Parameters[0].Value = this.m_mjesecisplate; this.daPodaci.SelectCommand.Parameters[1].Value = RuntimeHelpers.GetObjectValue(row2.Cells["idradnik"].Value); this.daPodaci.SelectCommand.Parameters[2].Value = this.m_godinaisplate; Configuration configuration = new Configuration(); SqlConnection connection = new SqlConnection { ConnectionString = Configuration.ConnectionString }; this.daPodaci.SelectCommand.Connection = connection; this.daPodaci.Fill(this.ds); DataRow row3 = this.Baze1.Podaci.NewRow(); row3["pb"] = RuntimeHelpers.GetObjectValue(this.ds.Tables[0].Rows[0][3]); row3["pn"] = RuntimeHelpers.GetObjectValue(this.ds.Tables[0].Rows[0][13]); row3["oo"] = Operators.MultiplyObject(((ObracunSmartPart)current).osnovnioo, row2.Cells["FAKTOO"].Value); row3["prirez"] = RuntimeHelpers.GetObjectValue(row2.Cells["OPCINASTANOVANJAPRIREZ"].Value); row3["trazenineto"] = 0; row3["izracunatibruto"] = 0; row3["prezimeiime"] = string.Format("{0} {1}", RuntimeHelpers.GetObjectValue(row2.Cells["prezime"].Value), RuntimeHelpers.GetObjectValue(row2.Cells["ime"].Value)); row3["NAZIVBAZE"] = num2; this.Baze1.Podaci.Rows.Add(row3); } num2++; } } } } }