コード例 #1
0
ファイル: ClientMainPanel.cs プロジェクト: iucalyptus/fox
        private void repositoryItemButtonEditPlus_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            StatisticClientForm form = new StatisticClientForm();

            List<ClientExt> journaitems = new List<ClientExt>();
            Client item = null;
            ClientExt itemExt = null;
            int[] selected = gridViewClientMain.GetSelectedRows();
            if (selected.Length == 1)
            {
                item = ((Client)gridViewClientMain.GetRow(selected[0]));
                itemExt = new ClientExt(item);
            }
            if (item != null)
            {
                    List<JournalItem> journalitems = DataProvider.DataProvider.GetJournalItemClientsExt(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);
            form.ShowDialog();
        }
コード例 #2
0
ファイル: DataProvider.cs プロジェクト: iucalyptus/fox
        public static List<ClientExt> GetClientsExt(DateTime dateFrom, DateTime dateTo, bool isAll)
        {
            List<ClientExt> clientList = new List<ClientExt>();
            try
            {
                SqlConnection connection = OpenConnection();
                if ((connection == null) || (connection.State == ConnectionState.Closed))
                    return null;

                SqlCommand ngCommand = connection.CreateCommand();
                ngCommand.CommandType = CommandType.StoredProcedure;
                ngCommand.CommandText = GET_CLIENTSEXT_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())
                    {
                        ClientExt newClient = new ClientExt();

                        newClient.Name = (string)reader["Name"];
                        newClient.SurName = (string)reader["Surname"];
                        newClient.SecondName = (string)reader["SecondName"];
                        newClient.Phone = (string)reader["Phone"];
                        newClient.ID = (int)reader["ID"];
                        clientList.Add(newClient);

                    }

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                CloseConnection();
                return null;
            }
            CloseConnection();
            return clientList;
        }