Пример #1
0
        public void OnFilterChangeEvent(object sender, FilterChangeEventArgs e)
        {
            //update this form, using information from e.Param
            ///for example:
            //tableView.Text += e.Param;
            switch (e.Enum)
            {
            case "Клиент":
                bindingSource.Filter = "[last_name_user] LIKE'" + e.Param + "%'";
                break;

            case "Тренер":
                bindingSource.Filter = "[last_name_coach] LIKE'" + e.Param + "%'";
                break;

            case "Вид занятия":
                bindingSource.Filter = "[type_name] LIKE'" + e.Param + "%'";
                break;

            case "Дата начала":
                bindingSource.Filter = "[start_date] LIKE'" + e.Param + "%'";
                break;

            default:
                bindingSource.RemoveFilter();
                break;
            }
            Console.WriteLine("{0}:{1}", e.Param, e.Enum);
        }
Пример #2
0
 /// <summary>
 /// Notify clients that the clerk has changed the filter.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Clerk_FilterChangedByClerk(object sender, FilterChangeEventArgs e)
 {
     m_fHandlingFilterChangedByClerk = true;
     // Let the client(s) know about the change.
     m_browseViewer.UpdateFilterBar(Clerk.Filter);
     m_fHandlingFilterChangedByClerk = false;
 }
Пример #3
0
        public void OnFilterChangeEvent(object sender, FilterChangeEventArgs e)
        {
            tracks = from t in doc.Root.Elements("disc")
                     orderby t.Attribute("disc_id").Value
                     select t;

            if (e.Name == "btn_surname")
            {
                tracks = doc.Root.Descendants("disc").Where(
                    t => t.Attribute("surname").Value == e.Param).ToList();
                WriteText(tracks);
            }

            if (e.Name == "btn_gr_code")
            {
                tracks = doc.Root.Descendants("disc").Where(
                    t => t.Element("gr_code").Value == e.Param).ToList();
                WriteText(tracks);
            }

            if (e.Name == "btn_coursework")
            {
                tracks = doc.Root.Descendants("disc").Where(
                    t => t.Element("coursework").Value == e.Param).ToList();
                WriteText(tracks);
            }
            if (e.Name == "btn_cu")
            {
                tracks = doc.Root.Descendants("disc").Where(
                    t => t.Element("cu").Value == e.Param).ToList();
                WriteText(tracks);
            }
        }
        public void OnFilterChangeEvent(object sender, FilterChangeEventArgs e)
        {
            //update this form, using information from e.Param
            //for example:
            // tableView.Text += e.Param;
            // Console.WriteLine(e.Name);
            // XDocument doc = XDocument.Load("base.xml");
            tracks = from t in doc.Root.Elements("toy")
                     orderby t.Attribute("id").Value
                     select t;

            if (e.Name == "btnAge")
            {
                tracks = doc.Root.Descendants("toy").Where(
                    t => t.Element("age").Value == e.Param).ToList();

                WriteText(tracks);
            }

            if (e.Name == "btnDateOfOrder")
            {
                tracks = doc.Root.Descendants("toy").Where(
                    t => t.Element("dataoforder").Value == e.Param).ToList();

                WriteText(tracks);
            }

            if (e.Name == "btnProvider")
            {
                tracks = doc.Root.Descendants("toy").Where(
                    t => t.Element("provider").Value == e.Param).ToList();
                WriteText(tracks);
            }
        }
Пример #5
0
 /// <summary>
 /// Signal the clerk to change its filter to the user selected value.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="args"></param>
 private void FilterChangedHandler(object sender, FilterChangeEventArgs args)
 {
     // If we're in the process of notifying clients that the clerk has changed
     // the filter, we don't need to tell the clerk to change the filter (again)!
     if (m_fHandlingFilterChangedByClerk)
     {
         return;
     }
     Clerk.OnChangeFilter(args);
 }
 private void button1_Click(object sender, EventArgs e)
 {
     if (FilterUpdateEventHendler != null)
     {
         FilterChangeEventArgs Args = new FilterChangeEventArgs();
         Args.Black = BlackList_Textbox.Text;
         Args.White = WhiteList_Textbox.Text;
         FilterUpdateEventHendler(this, Args);
     }
     this.Close();
 }
        public void OnFilterChangeEvent(object sender, FilterChangeEventArgs e)
        {
            tableView.Text = "";
            parametres     = e.Param.Split('§');

            var filename = "computers.xml";

            XDocument xdoc = XDocument.Load(filename);

            items = from xe in xdoc.Element("ArrayOfComputer").Elements("Computer")
                    where ((parametres[0] == "Null" || xe.Element("ProcessorType").Value == parametres[0]) &&
                           (parametres[1] == "Null" || xe.Element("RAMSize").Value == parametres[1]) &&
                           (parametres[2] == "Null" || xe.Element("VideoCardMemory").Value == parametres[2]) &&
                           (parametres[3] == "Null" || xe.Element("HardDriveCapacity").Value == parametres[3]))
                    select new Computer
            {
                Id                = int.Parse(xe.Element("Id").Value),
                Model             = xe.Element("Model").Value,
                ProcessorType     = xe.Element("ProcessorType").Value,
                ProcessorSpeed    = uint.Parse(xe.Element("ProcessorSpeed").Value),
                RAMSize           = uint.Parse(xe.Element("RAMSize").Value),
                HardDriveCapacity = uint.Parse(xe.Element("HardDriveCapacity").Value),
                VideoCardMemory   = uint.Parse(xe.Element("VideoCardMemory").Value),
                Price             = uint.Parse(xe.Element("Price").Value),
                CopiesAvailable   = uint.Parse(xe.Element("CopiesAvailable").Value),
            };

            tableView.Text += "id " +
                              "Марка".PadRight(10, ' ') +
                              "Тип ЦП".PadRight(15, ' ') +
                              "Частота ЦП".PadRight(12, ' ') +
                              "Объём ОЗУ".PadRight(12, ' ') +
                              "Объём SSD".PadRight(12, ' ') +
                              "Видеопамять".PadRight(12, ' ') +
                              "Цена".PadRight(13, ' ') +
                              "В наличии".PadRight(12, ' ') + Environment.NewLine;

            foreach (var item in items)
            {
                tableView.Text += $"{item.Id.ToString().PadLeft(2, '0')} " +
                                  $"{item.Model}".PadRight(10, ' ') +
                                  $"{item.ProcessorType} ".PadRight(15, ' ') +
                                  $"{item.ProcessorSpeed} МГц".PadRight(12, ' ') +
                                  $"{item.RAMSize} Гб".PadRight(12, ' ') +
                                  $"{item.HardDriveCapacity} Гб".PadRight(12, ' ') +
                                  $"{item.VideoCardMemory} Гб".PadRight(12, ' ') +
                                  $"{item.Price} у.е.".PadRight(13, ' ') +
                                  $"{item.CopiesAvailable} шт.{Environment.NewLine}";
            }
        }
Пример #8
0
        public FilterWindow(IEnumerable <string> departments, FilterChangeEventArgs previousFilterSettings)
        {
            InitializeComponent();

            departmentIDFilterField.Items.Clear();
            foreach (string dptID in departments)
            {
                if (!departmentIDFilterField.Items.Contains(dptID))
                {
                    departmentIDFilterField.Items.Add(dptID);
                }
            }

            RestoreFilterSettings(previousFilterSettings);
        }
Пример #9
0
        public void OnFilterChangeEvent(object sender, FilterChangeEventArgs e)
        {
            XElement abonents = XElement.Load(Path.Combine(Directory.GetCurrentDirectory(), "abonents.xml"));

            abonentInfoFiltered = (from abonent in abonents.Descendants("AbonentInfo")
                                   where ((string)abonent.Element("Name") == e.Name ||
                                          (string)abonent.Element("Location") == e.Location ||
                                          (string)abonent.Element("StartDate") == e.StartDate ||
                                          (string)abonent.Element("LastPayment") == e.LastPayment ||
                                          e.Name == "" && e.Location == "" && e.StartDate == "" && e.LastPayment == "")
                                   select abonent).ToList();
            tableView.Text += "Name".PadRight(10) +
                              "Location".PadRight(10) +
                              "Address".PadRight(20) +
                              "Phone".PadRight(10) +
                              "ID".PadRight(10) +
                              "StartDate".PadRight(15) +
                              "LastPayment".PadRight(15) + Environment.NewLine;
            Save();
            Print();
        }
Пример #10
0
 /// <summary>
 /// Restores filter window state to the currently applied filter
 /// </summary>
 /// <param name="filterArgs">settings of currently applied filter</param>
 private void RestoreFilterSettings(FilterChangeEventArgs filterArgs)
 {
     if (filterArgs.DepartmentID != string.Empty)
     {
         departmentIDFilter.Checked           = true;
         departmentIDFilterField.SelectedItem = filterArgs.DepartmentID;
     }
     if (filterArgs.LastName != string.Empty)
     {
         lastNameFilter.Checked   = true;
         lastNameFilterField.Text = filterArgs.LastName;
     }
     if (filterArgs.Sex != string.Empty)
     {
         sexFilter.Checked           = true;
         sexFilterField.SelectedItem = filterArgs.Sex;
     }
     if (filterArgs.HireDate != string.Empty)
     {
         hireDateFilter.Checked   = true;
         hireDateFilterField.Text = filterArgs.HireDate;
     }
 }
Пример #11
0
 public void OnFilterChangeEvent(object sender, FilterChangeEventArgs e)
 {
     RedrawTree(crt.Filter(e.Name, e.Param));
 }
 public override void OnChangeFilter(FilterChangeEventArgs args)
 {
     RequestRefresh();
     base.OnChangeFilter(args);
 }
Пример #13
0
 public void OnThreadChangeEvent(object sender, FilterChangeEventArgs e)
 {
     main(Convert.ToInt32(e.Param), 12);
 }
Пример #14
0
 /// <summary>
 /// React to event from filter menu
 /// </summary>
 private void OnFilterChange(object sender, FilterChangeEventArgs e)
 {
     _currentFilterArgs = e;
     ApplyFilter();
 }
Пример #15
0
 public void OnFilterChangeEvent(object sender, FilterChangeEventArgs e)
 {
     //update this form, using information from e.Param
     //for example:
     tableView.Text += e.Param;
 }
Пример #16
0
        /// <summary>
        /// event for getting data from FilterProperties form
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public async void OnFilterChangeEvent(object sender, FilterChangeEventArgs e)
        {
            try
            {
                switch (e.Param)
                {
                case "Select cars":
                    dataSet = await DBUtils.GetDataSetAsync($"SELECT * from CarView"
                                                            , sqlConnection, "Car");

                    break;

                case "Select repairmans":
                    dataSet = await DBUtils.GetDataSetAsync($"SELECT * from RepairmanView"
                                                            , sqlConnection, "Repairman");

                    break;

                case "Select clients":
                    dataSet = await DBUtils.GetDataSetAsync($"SELECT * from ClientView"
                                                            , sqlConnection, "Client");

                    break;

                case "Select tasks":
                    if (e.IsPct)
                    {
                        dataSet = await DBUtils.GetDataSetAsync($"SELECT * from func_GetTaskWithPct('{e.DateStart}', '{e.DateEnd}')"
                                                                , sqlConnection, "TaskForCar");
                    }
                    else
                    {
                        dataSet = await DBUtils.GetDataSetAsync($"SELECT * from func_GetTask('{e.DateStart}', '{e.DateEnd}')"
                                                                , sqlConnection, "TaskForCar");
                    }
                    break;

                default:
                    if (e.IsPct)
                    {
                        dataSet = await DBUtils.GetDataSetAsync($"SELECT * from func_GetTaskWithPct('{e.DateStart}', '{e.DateEnd}')"
                                                                , sqlConnection, "TaskForCar");
                    }
                    else
                    {
                        dataSet = await DBUtils.GetDataSetAsync($"SELECT * from func_GetTask('{e.DateStart}', '{e.DateEnd}')"
                                                                , sqlConnection, "TaskForCar");
                    }
                    break;
                }
                bindingSource.DataSource           = dataSet.Tables[0];
                bindingNavigator.BindingSource     = bindingSource;
                dataGridView.DataSource            = bindingSource;
                dataGridView.Columns[0].Visible    = false;
                saveAsToolStripMenuItem.Enabled    = true;
                bindingNavigatorDeleteItem.Enabled = true;
                bindingNavigatorAddNewItem.Enabled = true;
            }
            catch (Exception ex)
            {
                log.Error("Error: " + ex.Message);
                MessageBox.Show("Error: " + ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }