Пример #1
0
        //private static List<string> GetList(string listname)
        //{
        //    List<string> lst = (List<string>)BrokerConnection.InstanceOf().Request(listname, null);
        //    return lst;
        //}

        //private void cmdAdd_Click(object sender, EventArgs e)
        //{
        //    AddSelectedReport();
        //}

        //private void AddSelectedReport()
        //{
        //    selectedReports.Add(selectedReports.Count, this.treeAvailableReports.SelectedNode.Text.Trim());
        //    selectedArgs.Add(selectedArgs.Count, new DataGridViewRow[0]);

        //    RefreshLists();
        //}

        //private void cmdRemove_Click(object sender, EventArgs e)
        //{
        //    selectedReports.Remove(lstSelectedReports.SelectedIndex);
        //    selectedArgs.Remove(lstSelectedReports.SelectedIndex);

        //    RefreshLists();
        //}

        //private void RefreshLists()
        //{
        //    lstSelectedReports.Items.Clear();
        //    foreach (string s in selectedReports.Values)
        //        lstSelectedReports.Items.Add(s);
        //}

        //private void lstAvailableReports_DoubleClick(object sender, EventArgs e)
        //{
        //    AddSelectedReport();
        //}

        //private void lstSelectedReports_SelectedValueChanged(object sender, EventArgs e)
        //{
        //    if (selectedArgs[lstSelectedReports.SelectedIndex].Length == 0)
        //        selectedArgs[lstSelectedReports.SelectedIndex] = GetReport();
        //    else
        //    {
        //        try
        //        {
        //            dgvParameters.Rows.Clear();
        //            foreach (DataGridViewRow dr in selectedArgs[lstSelectedReports.SelectedIndex])
        //            {
        //                Object customCell = null;
        //                DataGridViewRow drc = (DataGridViewRow)dr.Clone();
        //                drc.Cells[0].Value = dr.Cells[0].Value;
        //                switch (dr.Cells[1].GetType().Name)
        //                {
        //                    case "DataGridViewTextBoxCell":
        //                        DataGridViewTextBoxCell newTextCell = new DataGridViewTextBoxCell();
        //                        newTextCell.Value = dr.Cells[1].Value;
        //                        customCell = newTextCell;
        //                        break;

        //                    case "DataGridViewComboBoxCell":
        //                        DataGridViewComboBoxCell newCbCell = new DataGridViewComboBoxCell();
        //                        newCbCell.Value = dr.Cells[1].Value;
        //                        customCell = newCbCell;
        //                        break;

        //                    case "CalendarCell":
        //                        CalendarCell newCalCell = new CalendarCell();
        //                        newCalCell.Value = dr.Cells[1].Value;
        //                        customCell = newCalCell;
        //                        break;
        //                }
        //                drc.Cells[1] = (DataGridViewCell)customCell;
                        
        //                dgvParameters.Rows.Add(drc);
        //            }
        //        }
        //        catch (Exception ex)
        //        {
        //            Console.Write(ex);
        //        }
        //    }

        //    UpdateDates();
        //    UpdateCommandLine();
        //}

        private DataGridViewRow[] DisplayReportArgs(ReportParameterInfoCollection rpic)
        {
            int i = 0;
            dgvParameters.Rows.Clear();
            foreach (ReportParameterInfo rp in rpic)
            {
                try
                {
                    Object customCell = null;

                    if (rp.ValidValues != null)
                    {
                        DataGridViewComboBoxCell cbCell = new DataGridViewComboBoxCell();

                        int ii = 0;
                        string[] vals = new string[rp.ValidValues.Count];
                        foreach (object o in rp.ValidValues)
                            vals[ii++] = ((Microsoft.Reporting.WinForms.ValidValue)o).Value;

                        cbCell.Items.AddRange(vals);
                        customCell = cbCell;
                    }
                    else if (rp.DataType.Equals(ParameterDataType.DateTime))
                    {
                        CalendarCell calCell = new CalendarCell();
                        customCell = calCell;
                    }
                    else
                    {
                        DataGridViewTextBoxCell dgt = new DataGridViewTextBoxCell();
                        customCell = dgt;
                    }

                    dgvParameters.Rows.Add();

                    DataGridViewTextBoxCell dgtLabel = new DataGridViewTextBoxCell();
                    dgtLabel.Value = rp.Name;
                    dgvParameters[0, i] = dgtLabel;
                    dgvParameters[1, i] = (DataGridViewCell)customCell;
                    i++;
                }
                catch (Exception ex)
                {
                    Console.Write(ex);
                }
            }

            DataGridViewRow[] arr = new DataGridViewRow[dgvParameters.Rows.Count];
            dgvParameters.Rows.CopyTo(arr, 0);

            return arr;
        }
Пример #2
0
        private void GetReportArgs(ReportParameterInfoCollection rpic)
        {
            int i = 0;

            dgvParameters.Rows.Clear();
            foreach (ReportParameterInfo rp in rpic)
            {
                try
                {
                    Object customCell = null;

                    if (rp.ValidValues != null)
                    {
                        DataGridViewComboBoxCell cbCell = new DataGridViewComboBoxCell();

                        int ii = 0;
                        string[] vals = new string[rp.ValidValues.Count];
                        foreach (object o in rp.ValidValues)
                            vals[ii++] = ((Microsoft.Reporting.WinForms.ValidValue)o).Value;

                        cbCell.Items.AddRange(vals);
                        customCell = cbCell;
                    }
                    else if (rp.DataType.Equals(ParameterDataType.DateTime))
                    {
                        CalendarCell calCell = new CalendarCell();
                        customCell = calCell;
                    }
                    else
                    {
                        DataGridViewTextBoxCell dgt = new DataGridViewTextBoxCell();
                        customCell = dgt;
                    }

                    if (    !rp.Name.Equals("Portfolio") &&
                            !rp.Name.Equals("Consolidate") &&
                            !rp.Name.Equals("AccountingFilters"))
                        continue;

                    dgvParameters.Rows.Add();

                    DataGridViewTextBoxCell dgtLabel = new DataGridViewTextBoxCell();
                    dgtLabel.Value = rp.Name;
                    dgvParameters[0, i] = dgtLabel;

                    ((DataGridViewCell)customCell).Value = argLookup[rp.Name];
                    dgvParameters[1, i] = (DataGridViewCell)customCell;
                    i++;
                }
                catch (Exception ex)
                {
                    Console.Write(ex);
                }
            }
        }