public void ViewDOKUMENT(DataRow row) { DOKUMENTSelectionListWorkItem item = this.WorkItem.Items.AddNew <DOKUMENTSelectionListWorkItem>(); item.ShowModal(false, "FillByIDTIPDOKUMENTA", row); item.Terminate(); this.WorkItem.Activate(); }
public void SaldiranjeCommand(object sender, EventArgs e) { if (Interaction.MsgBox("Želite li stvarno izvršiti saldiranje kartica???", MsgBoxStyle.YesNo, null) != MsgBoxResult.No) { DOKUMENTSelectionListWorkItem item = this.WorkItem.Items.AddNew <DOKUMENTSelectionListWorkItem>("test"); DataRow row = item.ShowModal(true, "", null); item.Terminate(); if (row != null) { int activeYear = mipsed.application.framework.Application.ActiveYear; DateTime time = DateTime.Parse("31.12." + activeYear.ToString()); SqlParameter[] parameterArray = new SqlParameter[10]; SqlConnection connection = new SqlConnection { ConnectionString = Mipsed7.Core.ApplicationDatabaseInformation.ConnectionString }; parameterArray[0] = new SqlParameter("@GODINA", SqlDbType.Int); parameterArray[0].Value = activeYear; parameterArray[1] = new SqlParameter("@DAT", SqlDbType.Date); parameterArray[1].Value = time; parameterArray[2] = new SqlParameter("@iddokument", SqlDbType.Int); parameterArray[2].Value = RuntimeHelpers.GetObjectValue(row["IDDOKUMENT"]); SqlCommand command = new SqlCommand { CommandText = "S_FIN_SALDIRANJE", CommandType = CommandType.StoredProcedure }; try { int index = 0; do { command.Parameters.AddWithValue(parameterArray[index].ToString(), RuntimeHelpers.GetObjectValue(parameterArray[index].Value)); index++; }while (index <= 2); command.Connection = connection; connection.Open(); int num2 = command.ExecuteNonQuery(); } catch (System.Exception exception1) { throw exception1; } Interaction.MsgBox("Pod šifrom dokumenta " + row["IDDOKUMENT"].ToString() + " kreirana je nova temeljnica! Provjerite temeljnicu i proknjižite!", MsgBoxStyle.OkOnly, null); connection.Close(); } } }