Example #1
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 #2
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 #3
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 #4
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 + "','0'";

                        var returnSqlServer = commandServer.ExecNoReturnServer("speziolist_edit", parameters);
                        if (returnSqlServer[1] == "0")
                        {
                            e.Cancel = true;
                        }

                        AlertOperation("speziolist_edit " + line.Cells[1].Value, returnSqlServer);
                    }
                }
            }
        }
Example #5
0
 private void button3_Click(object sender, EventArgs e)
 {
     if (dataGridView1.SelectedRows.Count > 0)
     {
         if (
             MessageBox.Show(@"Вы точно хотите удалить запись?", @"Внимание", MessageBoxButtons.OKCancel,
                             MessageBoxIcon.Warning) == DialogResult.OK)
         {
             var commandServer = new CommandServer();
             if (dataGridView1.CurrentRow == null)
             {
                 return;
             }
             var returnOperation = commandServer.ExecNoReturnServer("deleteCountry", "'" + dataGridView1.CurrentRow.Cells[1].Value + "'");
             if (returnOperation[1] == "Ошибка")
             {
                 MessageBox.Show(@"Запись не была удалена.", @"Ошибка", MessageBoxButtons.OK,
                                 MessageBoxIcon.Warning);
             }
             else
             {
                 if (
                     MessageBox.Show(@"Запись была удалена. Хотите закрыть текущее окно?", @"Операция",
                                     MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.Cancel)
                 {
                     UpdateGridView();
                 }
                 else
                 {
                     Close();
                 }
             }
         }
         else
         {
             button5.Refresh();
         }
     }
     else
     {
         MessageBox.Show(@"Выделите запись для удаления.", @"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }
Example #6
0
        private void radGridView5_UserAddingRow(object sender, GridViewRowCancelEventArgs e)
        {
            if (_status)
            {
                _status = false;
                return;
            }

            if (e.Rows[0].Cells[1].Value == null || e.Rows[0].Cells[1].Value.ToString() == "")
            {
                AlertOperation("speziolist_add", new string[] { "Не указано ФИО.", "1" });
                e.Cancel = true;
                return;
            }
            var    commandServer = new CommandServer();
            var    commandClient = new CommandClient();
            string fio;
            var    line = e.Rows[0].Cells[1].Value.ToString();

            if (e.Rows[0].Cells[1].Value.ToString().Split(' ').Length == 3)
            {
                fio = commandClient.CharTo(e.Rows[0].Cells[1].Value.ToString().Split(' ')[0]) + " " +
                      commandClient.CharTo(e.Rows[0].Cells[1].Value.ToString().Split(' ')[1]) + " " +
                      commandClient.CharTo(e.Rows[0].Cells[1].Value.ToString().Split(' ')[2]);
            }
            else
            {
                fio = e.Rows[0].Cells[1].Value.ToString();
            }

            var parameters      = "'" + fio + "','0'";
            var returnSqlServer = commandServer.ExecNoReturnServer("speziolist_add", parameters);

            if (returnSqlServer[1] == "0")
            {
                e.Cancel = true;
            }

            AlertOperation("socRabotnik_add " + parameters, returnSqlServer);
            radGridView5.DataSource = _bindingSource_personel;
        }
Example #7
0
        private void button4_Click(object sender, EventArgs e)
        {
            var commandServer = new CommandServer();

            if (!string.IsNullOrEmpty(textBox1.Text))
            {
                if (_statusOperation)
                {
                    var returnOperation = commandServer.ExecNoReturnServer("addSemPol", "'" + textBox1.Text + "'");
                    if (returnOperation[1] == "Ошибка")
                    {
                        MessageBox.Show(@"Запись не была добавленна.", @"Ошибка", MessageBoxButtons.OK,
                                        MessageBoxIcon.Warning);
                    }
                    else
                    {
                        if (
                            MessageBox.Show(@"Запись была добавленна. Вы хотите добавить еще одну запись?", @"Операция",
                                            MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                        {
                            UpdateGridView();
                            button5.PerformClick();
                        }
                        else
                        {
                            Close();
                        }
                    }
                }
                else
                {
                    dataGridView1.Visible = false;
                    if (dataGridView1.CurrentRow == null)
                    {
                        return;
                    }
                    var returnOperation = commandServer.ExecNoReturnServer("editSemPol", "'" + dataGridView1.CurrentRow.Cells[0].Value + "','" + textBox1.Text + "'");
                    dataGridView1.Visible = true;
                    if (returnOperation[1] == "Ошибка")
                    {
                        MessageBox.Show(@"Запись не была изменена.", @"Ошибка", MessageBoxButtons.OK,
                                        MessageBoxIcon.Warning);
                    }
                    else
                    {
                        if (
                            MessageBox.Show(@"Запись была изменена. Вы хотите изменить еще одну запись?", @"Операция",
                                            MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.OK)
                        {
                            UpdateGridView();
                            button5.PerformClick();
                        }
                        else
                        {
                            Close();
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show(@"Заполните поле.", @"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }