Ejemplo n.º 1
0
        public static List<OrganizationExt> GetOrganizExt(DateTime dateFrom, DateTime dateTo)
        {
            List<OrganizationExt> orgList = new List<OrganizationExt>();
            try
            {
                SqlConnection connection = OpenConnection();
                if ((connection == null) || (connection.State == ConnectionState.Closed))
                    return null;

                SqlCommand ngCommand = connection.CreateCommand();
                ngCommand.CommandType = CommandType.StoredProcedure;
                ngCommand.CommandText = GET_ORGANIZATIONSEXT_REGISRTY;
                ngCommand.Parameters.AddWithValue("@dateFrom", dateFrom);
                ngCommand.Parameters.AddWithValue("@dateTo", dateTo);
                // ngCommand.CommandTimeout = CommandTimeOut > 2 * connection.ConnectionTimeout ? CommandTimeOut : 2 * connection.ConnectionTimeout;

                ngCommand.ExecuteNonQuery();
                SqlDataReader reader = null;
                if (connection != null)
                {

                    reader = ngCommand.ExecuteReader();
                    while (reader.Read())
                    {
                        OrganizationExt newOrg = new OrganizationExt();

                        newOrg.OrganizationName = (string)reader["Name"];
                        newOrg.OrganizationDescription = (string)reader["Description"];
                        newOrg.Adress = (string)reader["Adress"];
                        newOrg.Phone = (string)reader["Phone"];
                        newOrg.ID = (int)reader["ID"];
                        orgList.Add(newOrg);

                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CloseConnection();
                return null;
            }
            CloseConnection();
            return orgList;
        }
Ejemplo n.º 2
0
        private void repositoryItemButtonEditInfo_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            Cursor current = this.Cursor;
            this.Cursor = Cursors.WaitCursor;
            StatisticOrganizationForm form = new StatisticOrganizationForm();

            List<OrganizationExt> journaitems = new List<OrganizationExt>();
            Organization item = null;
            OrganizationExt itemExt = null;
            int[] selected = gridViewOrganizMain.GetSelectedRows();
            if (selected.Length == 1)
            {
                item = ((Organization)gridViewOrganizMain.GetRow(selected[0]));
                itemExt = new OrganizationExt(item);
            }
            if (item != null)
            {
                List<JournalItem> journalitems = DataProvider.DataProvider.GetJournalItemOrganizationExt(item.ID);
                foreach (JournalItem itemjournal in journalitems)
                {
                    List<JournalUslugiItem> journaluslugiitems = DataProvider.DataProvider.GetJournalUslugiItems(itemjournal.ID);
                    itemjournal.listUslugiJournal = journaluslugiitems;
                }
                itemExt.listJournal = journalitems;
                journaitems.Add(itemExt);
            }

            form.SetBindItems(journaitems);
            this.Cursor = current;
            form.ShowDialog();
        }