Example #1
0
        public void LoadGrid(int key)
        {
            var commandServer = new CommandServer();

            _bindingSourceExit = new BindingSource {
                DataSource = commandServer.DataGridSet(@"select date_start as [Выезд], date_stop as [Возврат]
                from alone_time inner join every_set on fk_every_set_operation = key_every
                where fk_alone = " + key + " and name = 'exit' order by date_start").Tables[0]
            };

            _bindingSourceCategory = new BindingSource {
                DataSource = commandServer.DataGridSet(@"select date_start as [Установление], date_stop as [Снятие], category as [Категория]
                from category_time
                where fk_alone = " + key + " order by date_start").Tables[0]
            };

            category_grid.AutoSizeRows            = true;
            category_grid.DataSource              = _bindingSourceCategory;
            category_grid.Columns[0].FormatString = "{0:dd/MM/yyyy}";
            category_grid.Columns[1].FormatString = "{0:dd/MM/yyyy}";
            category_grid.Columns[2].WrapText     = true;
            category_grid.AutoSizeColumnsMode     = GridViewAutoSizeColumnsMode.Fill;

            exit_grid.AutoSizeRows            = true;
            exit_grid.DataSource              = _bindingSourceExit;
            exit_grid.Columns[0].FormatString = "{0:dd/MM/yyyy}";
            exit_grid.Columns[1].FormatString = "{0:dd/MM/yyyy}";
            exit_grid.AutoSizeColumnsMode     = GridViewAutoSizeColumnsMode.Fill;
        }
Example #2
0
        private void radGridView3_UserAddingRow(object sender, GridViewRowCancelEventArgs e)
        {
            if (e.Rows[0].Cells[1].Value == null)
            {
                AlertOperation("job_soc_rabotnik_add", new string[] { "Не указана дата начала.", "1" });
                e.Cancel = true;
                return;
            }
            _status = true;
            var commandServer = new CommandServer();
            var line          = radGridViewSoc.CurrentRow.Cells[0].Value + ",'" + e.Rows[0].Cells[1].Value + "',";

            radGridViewSoc.CurrentRow.Cells[2].Value = e.Rows[0].Cells[1].Value;

            if (e.Rows[0].Cells[2].Value != null)
            {
                line += "'" + e.Rows[0].Cells[2].Value + "'";
                radGridViewSoc.CurrentRow.Cells[3].Value = e.Rows[0].Cells[2].Value;
            }
            else
            {
                line += "null";
            }

            var returnSqlServer = commandServer.ExecReturnServer("job_soc_rabotnik_add", line);

            UpdateLoadJobTime();
            AlertOperation("job_soc_rabotnik_add " + line, returnSqlServer);
        }
Example #3
0
        private void radGridView4_UserAddingRow(object sender, GridViewRowCancelEventArgs e)
        {
            if (e.Rows[0].Cells[1].Value == null)
            {
                AlertOperation("job_spezialist_add", new string[] { "Не указана дата начала.", "1" });
                e.Cancel = true;
                return;
            }
            _status = true;
            var commandServer = new CommandServer();
            var line          = radGridView2.CurrentRow.Cells[0].Value + ",'" + e.Rows[0].Cells[1].Value + "',";

            if (e.Rows[0].Cells[2].Value != null)
            {
                line += "'" + e.Rows[0].Cells[2].Value + "'";
            }
            else
            {
                line += "null";
            }

            var returnSqlServer = commandServer.ExecReturnServer("job_spezialist_add", line);

            if (returnSqlServer[1] == "1")
            {
                LoadGridFio();
                LoadGridFioOff();
            }
            AlertOperation("job_spezialist_add " + line, returnSqlServer);
        }
Example #4
0
        public void LoadGridFioOff()
        {
            var commandServer = new CommandServer();

            try
            {
                radGridView2.Invoke(new MethodInvoker(delegate()
                {
                    radGridView2.EnablePaging = true;
                    _bindingSource_off        = new BindingSource {
                        DataSource = commandServer.DataGridSet(@"select *
                        from spezialistViewColor('0') 
                        where date_end is not null
                        order by [ФИО]").Tables[0]
                    };
                    radGridView2.DataSource = _bindingSource_off;

                    if (radGridView2.Columns.Count > 0)
                    {
                        radGridView2.Columns[0].IsVisible = false;
                        radGridView2.Columns[2].IsVisible = false;
                        radGridView2.Columns[3].IsVisible = false;
                        radGridView2.AutoSizeColumnsMode  = GridViewAutoSizeColumnsMode.Fill;
                    }
                }));
            }
            catch (Exception ex)
            {
                CommandClient commandClient = new CommandClient();
                commandClient.WriteFileError(ex, null);
            }
        }
Example #5
0
        private void loadGridSoc()
        {
            var commandServer = new CommandServer();

            try
            {
                radGridViewSoc.Invoke(new MethodInvoker(delegate()
                {
                    radGridViewSoc.EnablePaging = true;
                    _bindingSource_soc          = new BindingSource {
                        DataSource = commandServer.DataGridSet(@"select *
                from socPersonelViewColor()  order by [ФИО]").Tables[0]
                    };
                    radGridViewSoc.DataSource = _bindingSource_soc;

                    if (radGridViewSoc.Columns.Count > 0)
                    {
                        radGridViewSoc.Columns[0].IsVisible = false;
                        radGridViewSoc.Columns[2].IsVisible = false;
                        radGridViewSoc.Columns[3].IsVisible = false;
                        radGridViewSoc.AutoSizeColumnsMode  = GridViewAutoSizeColumnsMode.Fill;
                    }
                }));
            }
            catch (Exception ex)
            {
                CommandClient commandClient = new CommandClient();
                commandClient.WriteFileError(ex, null);
            }
        }
Example #6
0
        private void UpdateComboBoxSelsovet()
        {
            var commandServer = new CommandServer();

            comboBox1.Items.Clear();
            comboBox1.DataSource = commandServer.ComboBoxList(@"select Selsovet from Selsovet order by Selsovet", true);
        }
Example #7
0
        private void radGridView1_Click(object sender, EventArgs e)
        {
            var commandServer = new CommandServer();

            try
            {
                if (radGridViewSoc.CurrentRow.Cells[0].Value != null)
                {
                    _bindingSource_join = new BindingSource {
                        DataSource = commandServer.DataGridSet(@"select keys, fio as [ФИО], joi
                    from InspectorJoinSocView(" + radGridView1.CurrentRow.Cells[0].Value + ")").Tables[0]
                    };

                    radGridView2.DataSource = _bindingSource_join;

                    GridViewCheckBoxColumn date_join = new GridViewCheckBoxColumn("Привязка");
                    radGridView2.Columns[2] = date_join;
                    date_join.Name          = "date_j";
                    date_join.FieldName     = "joi";

                    radGridView2.Columns[0].IsVisible = false;
                    radGridView2.Columns[1].ReadOnly  = true;
                    radGridView2.AutoSizeColumnsMode  = GridViewAutoSizeColumnsMode.Fill;
                    radGridView2.Columns[1].BestFit();
                    radGridView2.Columns[2].BestFit();
                }
            }
            catch (Exception ex)
            {
                CommandClient commandClient = new CommandClient();
                commandClient.WriteFileError(ex, null);
            }
        }
Example #8
0
        public void LoadGridFio(object sender, DoWorkEventArgs e)
        {
            var commandServer = new CommandServer();

            try
            {
                radGridView5.Invoke(new MethodInvoker(delegate()
                {
                    radGridView5.EnablePaging = true;
                    _bindingSource_personel   = new BindingSource {
                        DataSource = commandServer.DataGridSet(@"select *
                        from spezialistView(0,0)
                        order by [ФИО]").Tables[0]
                    };
                    radGridView5.DataSource = _bindingSource_personel;

                    radGridView5.Columns[0].IsVisible = false;
                    GridViewCommandColumn command     = new GridViewCommandColumn();
                    command.Name           = "commandDelYes";
                    command.UseDefaultText = true;
                    command.DefaultText    = "Удалить";
                    command.FieldName      = "delete";
                    command.HeaderText     = "Операция";
                    radGridView5.MasterTemplate.Columns.Add(command);
                    radGridView5.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
                    radGridView5.CommandCellClick   += new CommandCellClickEventHandler(radGridViewButton_Click);
                }));
            }
            catch (Exception ex)
            {
                CommandClient commandClient = new CommandClient();
                commandClient.WriteFileError(ex, null);
            }
        }
Example #9
0
        public void LoadDrop()
        {
            var commandServer = new CommandServer();

            radDropDownList1.DataSource = commandServer.ComboBoxList(@"select convert(nvarchar, dat, 20) 
                from One_soc order by dat desc", false);
        }
Example #10
0
        private void UpdateLoadJobTime()
        {
            var     commandServer = new CommandServer();
            DataSet val           = commandServer.DataGridSet("select * from CalcStagResultSoc(" + radGridViewSoc.CurrentRow.Cells[0].Value + ")");

            richTextBox1.Text = "";
            if (val != null)
            {
                if (val.Tables[0].Rows.Count > 0)
                {
                    if (val.Tables[0].Rows[0][1].ToString() != "0" && val.Tables[0].Rows[0][1].ToString() != "")
                    {
                        richTextBox1.Text = val.Tables[0].Rows[0][1].ToString() + " лет\n";
                    }
                    if (val.Tables[0].Rows[0][2].ToString() != "0" && val.Tables[0].Rows[0][2].ToString() != "")
                    {
                        richTextBox1.Text += val.Tables[0].Rows[0][2].ToString() + " месяцев\n";
                    }
                    if (val.Tables[0].Rows[0][3].ToString() != "0" && val.Tables[0].Rows[0][3].ToString() != "")
                    {
                        richTextBox1.Text += val.Tables[0].Rows[0][3].ToString() + " дней\n";
                    }
                }
            }
        }
Example #11
0
        public void ReadFileError()
        {
            try
            {
                string textAll = null;
                using (StreamReader sr = new StreamReader("messageError.txt", Encoding.Default))
                {
                    textAll = sr.ReadToEnd();
                }

                if (string.IsNullOrEmpty(textAll))
                {
                    return;
                }

                string[] textSplit = textAll.Split(new[] { "================================" }, StringSplitOptions.None);

                var command = new CommandServer();

                for (int i = 0; i < textSplit.Length - 1; i++)
                {
                    if (!string.IsNullOrEmpty(textSplit[i]))
                    {
                        command.ExecNoReturnServer("ErrorsAdd", "'" + textSplit[i].Replace("'", @"-") + "','user'");
                    }
                }

                File.Create("messageError.txt").Close();
            }
            catch (Exception ex)
            {
                WriteFileError(ex, "ReadFileError");
            }
        }
Example #12
0
        private void radGridView3_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            var commandServer = new CommandServer();
            var commandClient = new CommandClient();

            if (e.Action == NotifyCollectionChangedAction.ItemChanging)
            {
                var line = (GridViewRowInfo)e.NewItems[0];

                if (line.Cells[0].Value != null)
                {
                    _status = true;
                    var parameters = "'" + line.Cells[0].Value.ToString() + "','";
                    if (e.PropertyName == "date_start")
                    {
                        parameters += e.NewValue.ToString() + "',";
                        radGridViewSoc.CurrentRow.Cells[2].Value = e.NewValue;
                    }
                    else
                    {
                        parameters += line.Cells[1].Value.ToString() + "',";
                    }
                    if (e.PropertyName == "date_end")
                    {
                        if (e.NewValue == null)
                        {
                            parameters += "null";
                        }
                        else
                        {
                            parameters += "'" + e.NewValue.ToString() + "'";
                            radGridViewSoc.CurrentRow.Cells[3].Value = e.NewValue;
                        }
                    }
                    else
                    {
                        if (line.Cells[2].Value == null)
                        {
                            parameters += "null";
                        }
                        else
                        {
                            parameters += "'" + line.Cells[2].Value.ToString() + "'";
                        }
                    }

                    var returnSqlServer = commandServer.ExecReturnServer("job_soc_rabotnik_edit", parameters);
                    UpdateLoadJobTime();
                    AlertOperation("job_soc_rabotnik_edit " + line.Cells[1].Value, returnSqlServer);
                    //radGridViewSoc.Invoke(new MethodInvoker(delegate ()
                    //{
                    //    radGridViewSoc.DataSource = _bindingSource_soc;
                    //}));

                    //loadGridSoc();
                    //LoadGridSoc();
                }
            }
        }
Example #13
0
        private void radGridView6_UserDeletingRow(object sender, GridViewRowCancelEventArgs e)
        {
            var commandServer = new CommandServer();

            commandServer.ExecNoReturnServer("job_spezialist_delete", e.Rows[0].Cells[0].Value.ToString());
            LoadGridFio();
            LoadGridFioOff();
        }
Example #14
0
        private void UpdateGridView()
        {
            var commandServer = new CommandServer();

            dataGridView1.MultiSelect   = false;
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dataGridView1.DataSource    = commandServer.DataGridSet(@"select * from ListCountry()").Tables[0];
        }
Example #15
0
        private void UpdateGridView()
        {
            dataGridView1.MultiSelect   = false;
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            var commandServer = new CommandServer();

            dataGridView1.DataSource = commandServer.DataGridSet(@"select Selsovet as [Сельсовет] from Selsovet").Tables[0];
        }
Example #16
0
        private void radGridView3_UserDeletingRow(object sender, GridViewRowCancelEventArgs e)
        {
            var commandServer = new CommandServer();

            commandServer.ExecNoReturnServer("job_soc_rabotnik_delete", e.Rows[0].Cells[0].Value.ToString());
            UpdateLoadJobTime();
            //loadGridSoc();
            //LoadGridSoc();
        }
Example #17
0
        private void radGridView4_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            bool update = false;

            if (e.Action == NotifyCollectionChangedAction.ItemChanging)
            {
                var line = (GridViewRowInfo)e.NewItems[0];

                if (line.Cells[0].Value != null)
                {
                    _status = true;
                    var parameters = "'" + line.Cells[0].Value.ToString() + "','";
                    if (e.PropertyName == "date_start")
                    {
                        parameters += e.NewValue.ToString() + "',";
                        radGridView4.CurrentRow.Cells[2].Value = e.NewValue;
                    }
                    else
                    {
                        parameters += line.Cells[1].Value.ToString() + "',";
                    }
                    if (e.PropertyName == "date_end")
                    {
                        if (e.NewValue == null)
                        {
                            parameters += "null";
                        }
                        else
                        {
                            parameters += "'" + e.NewValue.ToString() + "'";
                            radGridView5.CurrentRow.Cells[3].Value = e.NewValue;
                            update = true;
                        }
                    }
                    else
                    {
                        if (line.Cells[2].Value == null || line.Cells[2].Value.ToString() == "")
                        {
                            parameters += "null";
                        }
                        else
                        {
                            parameters += "'" + line.Cells[2].Value.ToString() + "'";
                        }
                    }

                    var returnSqlServer = new CommandServer().ExecReturnServer("job_spezialist_edit", parameters);
                    AlertOperation("job_spezialist_edit " + line.Cells[1].Value, returnSqlServer);
                    if (update)
                    {
                        LoadGridFio();
                        LoadGridFioOff();
                    }
                }
            }
        }
Example #18
0
        private void UpdateGridViewKanal()
        {
            dataGridView2.MultiSelect   = false;
            dataGridView2.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            var commandServer = new CommandServer();

            dataGridView2.DataSource = commandServer.DataGridSet(@"select statusKanal as [Канализация]
                from statusKanal
                order by statusKanal").Tables[0];
        }
Example #19
0
 private void radGridView1_UserAddingRow(object sender, GridViewRowCancelEventArgs e)
 {
     if (e.Rows[0].Cells[1].Value == null || e.Rows[0].Cells[1].Value.ToString() == "")
     {
         RadMessageBox.Show("Не заполнено поле. Добавление отменено.", "Ошибка", MessageBoxButtons.OKCancel, RadMessageIcon.Info);
         e.Cancel = true;
         return;
     }
     var returnSqlServer = new CommandServer().ExecReturnServer("TypeHelpAdd", "'" + e.Rows[0].Cells[1].Value.ToString() + "'");
 }
Example #20
0
        private void UpdateGridViewPlita()
        {
            dataGridView3.MultiSelect   = false;
            dataGridView3.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            var commandServer = new CommandServer();

            dataGridView3.DataSource = commandServer.DataGridSet(@"select statusPlita as [Плита]
                from statusPlita
                order by statusPlita").Tables[0];
        }
Example #21
0
        private void UpdateGridViewOtopl()
        {
            dataGridView4.MultiSelect   = false;
            dataGridView4.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            var commandServer = new CommandServer();

            dataGridView4.DataSource = commandServer.DataGridSet(@"select statusOtopl as [Отопление]
                from statusOtopl
                order by statusOtopl").Tables[0];
        }
Example #22
0
        private void UpdateGridViewWoter()
        {
            dataGridView1.MultiSelect   = false;
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            var commandServer = new CommandServer();

            dataGridView1.DataSource = commandServer.DataGridSet(@"select statusWoter as [Водоснобжение]
                from statusWoter
                order by statusWoter").Tables[0];
        }
Example #23
0
        private void radButton3_Click(object sender, EventArgs e)
        {
            var commandServer = new CommandServer();

            _bindingSource = new BindingSource {
                DataSource = commandServer.DataGridSet(@"select * from One_soc_visible_table('" + radDropDownList1.Text + "')").Tables[0]
            };
            Print print = new Print();

            print.ExcelOneSoc(_bindingSource);
        }
Example #24
0
        private void UpdateGridView()
        {
            dataGridView1.MultiSelect   = false;
            dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;

            var commandServer = new CommandServer();

            dataGridView1.DataSource = commandServer.DataGridSet(@"select sem_pol as [Сем. пол.]
                from sem_pol
                order by sem_pol").Tables[0];
        }
Example #25
0
        private void ClickSOCTime(object sender, EventArgs e)
        {
            var commandServer = new CommandServer();

            try
            {
                if (radGridViewSoc.CurrentRow.Cells[0].Value != null)
                {
                    _bindingSource_soc = new BindingSource {
                        DataSource = commandServer.DataGridSet(@"select key_job_soc_rabotnik, date_start, date_end
                    from job_soc_rabotnik left join socRabotnik on job_soc_rabotnik.fk_soc_rabotnik = socRabotnik.key_socRabotnik
                    where fk_soc_rabotnik = " + radGridViewSoc.CurrentRow.Cells[0].Value).Tables[0]
                    };
                    radGridViewSocTime.DataSource = _bindingSource_soc;

                    GridViewDateTimeColumn dateS = new GridViewDateTimeColumn("Дата начала");
                    radGridViewSocTime.Columns[1] = dateS;
                    dateS.Name         = "date_s";
                    dateS.FieldName    = "date_start";
                    dateS.FormatString = "{0:dd/MM/yyyy}";
                    dateS.Format       = DateTimePickerFormat.Custom;
                    dateS.CustomFormat = "dd.MM.yyyy";

                    GridViewDateTimeColumn dateE = new GridViewDateTimeColumn("Дата конца");
                    radGridViewSocTime.Columns[2] = dateE;
                    dateE.Name         = "date_e";
                    dateE.FieldName    = "date_end";
                    dateE.FormatString = "{0:dd/MM/yyyy}";
                    dateE.Format       = DateTimePickerFormat.Custom;
                    dateE.CustomFormat = "dd.MM.yyyy";

                    radGridViewSocTime.Columns[0].IsVisible = false;
                    radGridViewSocTime.AutoSizeColumnsMode  = GridViewAutoSizeColumnsMode.Fill;
                    radGridViewSocTime.Columns[1].BestFit();
                    radGridViewSocTime.Columns[2].BestFit();

                    if (radGridViewSocTime.Columns.Count > 0)
                    {
                        UpdateLoadJobTime();
                    }
                    else
                    {
                        richTextBox1.Text = "";
                    }
                }
            }
            catch (Exception ex)
            {
                CommandClient commandClient = new CommandClient();
                commandClient.WriteFileError(ex, null);
            }
        }
Example #26
0
        private void radGridView1_UserAddedRow(object sender, GridViewRowEventArgs e)
        {
            var commandServer = new CommandServer();

            _bindingSource = new BindingSource {
                DataSource = commandServer.DataGridSet(@"select key_typeHelp, typeHelp as [Тип помощи] from typeHelp order by typeHelp").Tables[0]
            };

            radGridView1.Invoke(new MethodInvoker(delegate()
            {
                radGridView1.DataSource = _bindingSource.DataSource;
            }));
        }
Example #27
0
        //обновление таблицы
        private void radGridViewSoc_UserAddedRow(object sender, GridViewRowEventArgs e)
        {
            var commandServer = new CommandServer();

            _bindingSource_soc = new BindingSource {
                DataSource = commandServer.DataGridSet(@"select *
                from socPersonelViewColor() order by [ФИО]").Tables[0]
            };

            radGridViewSoc.Invoke(new MethodInvoker(delegate()
            {
                radGridViewSoc.DataSource = _bindingSource_soc;
            }));
        }
Example #28
0
        private void radGridView5_UserAddedRow(object sender, GridViewRowEventArgs e)
        {
            var commandServer = new CommandServer();

            _bindingSource_personel = new BindingSource {
                DataSource = commandServer.DataGridSet(@"select *
                        from spezialistView(0, 0) 
                        order by [ФИО]").Tables[0]
            };

            radGridView5.Invoke(new MethodInvoker(delegate()
            {
                radGridView5.DataSource = _bindingSource_personel;
            }));
        }
Example #29
0
        private void comboBox()
        {
            var commandServer = new CommandServer();

            radDropDownList1.Invoke(new MethodInvoker(delegate()
            {
                radDropDownList1.DataSource = commandServer.ComboBoxList(@"select ФИО
                        from spezialistView(2,0)  order by [ФИО]", true);
            }));

            radDropDownList2.Invoke(new MethodInvoker(delegate()
            {
                radDropDownList2.DataSource = commandServer.ComboBoxList(@"select ФИО
                        from spezialistView(2,0)  order by [ФИО]", true);
            }));
        }
Example #30
0
        //редактирование
        private void radGridView1_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            if (_status)
            {
                _status = false;
                return;
            }
            var commandServer = new CommandServer();
            var commandClient = new CommandClient();

            if (e.Action == NotifyCollectionChangedAction.ItemChanging)
            {
                var line = (GridViewRowInfo)e.NewItems[0];

                if (line.Cells[0].Value != null)
                {
                    if (e.PropertyName == "ФИО")
                    {
                        var    parameters = "'" + line.Cells[1].Value.ToString() + "','";
                        string text       = null;

                        if (e.NewValue.ToString().Split(' ').Length == 3)
                        {
                            text = commandClient.CharTo(e.NewValue.ToString().Split(' ')[0]) + " " +
                                   commandClient.CharTo(e.NewValue.ToString().Split(' ')[1]) + " " +
                                   commandClient.CharTo(e.NewValue.ToString().Split(' ')[2]);
                        }
                        else
                        {
                            text = e.NewValue.ToString();
                        }
                        parameters += text + "'";

                        var returnSqlServer = commandServer.ExecReturnServer("socRabotnik_edit", parameters);
                        if (returnSqlServer[1] == "0")
                        {
                            e.Cancel = true;
                        }
                        //loadGridSoc();
                        //LoadGridSoc();
                        AlertOperation("socRabotnik_edit " + line.Cells[1].Value, returnSqlServer);
                    }
                }
            }
        }