private void fillTheDataGrid() { var commandServer = new CommandServer(); try { radGridView1.Invoke(new MethodInvoker(delegate() { radGridView1.EnablePaging = true; if (dateS == null) { _bindingSource = new BindingSource { DataSource = commandServer.DataGridSet(@"select * from ListSurvey() order by [Дата] desc").Tables[0] } } ; else { _bindingSource = new BindingSource { DataSource = commandServer.DataGridSet(@"select * from ListSurvey() where [Дата] between '" + dateS.Value + "' and '" + dateE.Value + "'order by [Дата] desc").Tables[0] } }; radGridView1.DataSource = _bindingSource; if (radGridView1.Columns.Count > 0) { radGridView1.Columns[0].IsVisible = false; radGridView1.Columns[6].FormatString = "{0:dd/MM/yyyy}"; radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView1.Columns[1].BestFit(); radGridView1.Columns[6].BestFit(); radGridView1.EnableFiltering = true; radGridView1.MasterTemplate.ShowHeaderCellButtons = true; radGridView1.MasterTemplate.ShowFilteringRow = false; radGridView1.Columns["Адрес"].AllowFiltering = false; radGridView1.Columns["ФИО"].AllowFiltering = false; radGridView1.Columns[6].AllowFiltering = false; radGridView1.Columns["Результат"].AllowFiltering = false; } radLabelElement1.Text = @"Записей: " + radGridView1.MasterTemplate.DataView.ItemCount; })); } catch (Exception ex) { CommandClient commandClient = new CommandClient(); radLabelElement1.Text = @"Произошла ошибка при загрузке данных. Сообщите разработчику."; commandClient.WriteFileError(ex, "select * from ListSurvey() order by [Дата] desc"); } }
private void StartDataGrid() { var commandServer = new CommandServer(); try { radGridView1.Invoke(new MethodInvoker(delegate() { radGridView1.EnablePaging = true; _bindingSource = new BindingSource { DataSource = commandServer.DataGridSet(@"select (family.family + ' ' + family.name + ' ' + family.surname) as [ФИО], count(*) as [кол.] from dublicate inner join alone on dublicate.fk_alone = alone.key_alone inner join family on family.fk_alone = alone.key_alone group by family.family, family.name, family.surname").Tables[0] }; _bindingSourcePol = new BindingSource { DataSource = commandServer.DataGridSet(@"--вычисление женщин select alone.key_alone, family + ' ' + name + ' ' + surname as [ФИО], case pol when 1 then 'муж' when 0 then 'жен' end as [пол] from alone inner join family on alone.key_alone = family.fk_alone where alone.pol = 0 and (family.surname not like '%на' and family.surname not like '%зы' and family.surname not like '%ва') union all select alone.key_alone, family + ' ' + name + ' ' + surname as [ФИО], case pol when 1 then 'муж' when 0 then 'жен' end as [пол] from alone inner join family on alone.key_alone = family.fk_alone where alone.pol = 1 and (family.surname not like '%ич' and family.surname not like '%лы')").Tables[0] }; radGridView1.DataSource = _bindingSource; radGridView4.DataSource = _bindingSourcePol; if (radGridView1.Columns.Count > 0) { radGridView1.Columns[0].BestFit(); radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; } if (radGridView4.Columns.Count > 0) { radGridView4.Columns[0].IsVisible = false; radGridView4.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; } })); } catch (Exception ex) { CommandClient commandClient = new CommandClient(); commandClient.WriteFileError(ex, null); } }
private void radGridView1_DoubleClick(object sender, EventArgs e) { Hide(); try { new Alone(false, Convert.ToInt32(radGridView1.CurrentRow.Cells[0].Value), null, null).ShowDialog(); }catch (Exception ex) { var commandClient = new CommandClient(); commandClient.WriteFileError(ex, null); } Show(); }
private void radButton1_Click(object sender, EventArgs e) { Hide(); try { new Alone(false, Convert.ToInt32(textBox1.Text), null, null).ShowDialog(); } catch (Exception ex) { var commandClient = new CommandClient(); commandClient.WriteFileError(ex, null); } Show(); }
private void radGridView3_CellDoubleClick(object sender, GridViewCellEventArgs e) { if (e.RowIndex > -1) { Hide(); try { new Alone(false, Convert.ToInt32(radGridView2.CurrentRow.Cells[0].Value), "sm " + radGridView2.CurrentRow.Cells["Дата смерти"].Value, null).ShowDialog(); UpdateGrid(); } catch (Exception ex) { var commandClient = new CommandClient(); commandClient.WriteFileError(ex, null); } Show(); } }
private void SearchWork() { var commandServer = new CommandServer(); try { Cursor.Current = Cursors.AppStarting; if (!string.IsNullOrEmpty(_fun)) { switch (_fun) { case "SearchFamily": _bindingSource = new BindingSource { DataSource = commandServer.DataGridSet(@"select * from " + _fun + "(" + _fam + _name + _surname + _close + ") order by [ФИО]").Tables[0] }; break; case "ListSojitel": _bindingSource = new BindingSource { DataSource = commandServer.DataGridSet("select * from " + _fun + "(" + _fam + _name + _surname + "'" + _country + "') order by [ФИО]").Tables[0] }; break; default: _bindingSource = new BindingSource { DataSource = commandServer.DataGridSet(_fun).Tables[0] }; break; } } else { if (_bindingSourceParam != null) { _bindingSource = _bindingSourceParam; } } radGridView1.Invoke(new MethodInvoker(delegate() { radGridView1.DataSource = _bindingSource; })); if (radGridView1.Columns.Count > 0) { radGridView1.Invoke(new MethodInvoker(delegate() { radGridView1.EnablePaging = true; radGridView1.Columns[0].IsVisible = false; radGridView1.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; radGridView1.EnableFiltering = true; radGridView1.MasterTemplate.ShowHeaderCellButtons = true; radGridView1.MasterTemplate.ShowFilteringRow = false; if (radGridView1.Columns["ФИО"] != null) { radGridView1.Columns["ФИО"].AllowFiltering = false; radGridView1.Columns["ФИО"].BestFit(); } if (radGridView1.Columns["Дата рождения"] != null) { radGridView1.Columns["Дата рождения"].AllowFiltering = false; radGridView1.Columns["Дата рождения"].FormatString = "{0:dd/MM/yyyy}"; } if (radGridView1.Columns["Адрес"] != null) { radGridView1.Columns["Адрес"].BestFit(); radGridView1.Columns["Адрес"].AllowFiltering = false; } if (radGridView1.Columns["Дата над. обсл."] != null) { radGridView1.Columns["Дата над. обсл."].AllowFiltering = false; radGridView1.Columns["Дата над. обсл."].FormatString = "{0:dd/MM/yyyy}"; } if (radGridView1.Columns["Выезд"] != null) { if (_close != 0) { ConditionalFormattingObject obj2 = new ConditionalFormattingObject("DateCondition1", ConditionTypes.NotEqual, null, null, true); obj2.RowBackColor = Color.Goldenrod; radGridView1.Columns["Выезд"].ConditionalFormattingObjectList.Add(obj2); radGridView1.Columns["Выезд"].FormatString = "{0:dd/MM/yyyy}"; } else { radGridView1.Columns["Выезд"].IsVisible = false; } } if (radGridView1.Columns["Смерть"] != null) { if (_close != 0) { ConditionalFormattingObject obj = new ConditionalFormattingObject("DateCondition", ConditionTypes.NotEqual, null, null, true); obj.RowBackColor = Color.LightCoral; radGridView1.Columns["Смерть"].ConditionalFormattingObjectList.Add(obj); radGridView1.Columns["Смерть"].FormatString = "{0:dd/MM/yyyy}"; } else { radGridView1.Columns["Смерть"].IsVisible = false; } } })); radLabelElement1.Text = @"Записей: " + radGridView1.MasterTemplate.DataView.ItemCount; } if (radGridView1.RowCount == 0) { if (_message) { MessageBox.Show("По данному поиску ничего не найдено.", "Результат", MessageBoxButtons.OK, MessageBoxIcon.Information); } if (_fun == "SearchFamily") { if (_close != 2) { if (MessageBox.Show("Вы хотите произвести поиск во всех делах (активные, выехавшие, умершие)?", "Результат", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK) { _close = 2; SearchWork(); } else { Close(); } } else { Close(); } } else { Close(); } } } catch (Exception ex) { CommandClient commandClient = new CommandClient(); radLabelElement1.Text = @"Произошла ошибка при загрузке данных. Сообщите разработчику."; commandClient.WriteFileError(ex, _fun); }finally { Cursor.Current = Cursors.Default; } }