Ejemplo n.º 1
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);
            }
        }
Ejemplo n.º 2
0
 public Update(string server, LoadProgram load)
 {
     try
     {
         _server = server;
         _load   = load;
         ScanFile();
     }
     catch (Exception ex)
     {
         var commandClient = new CommandClient();
         commandClient.WriteFileError(ex, null);
     }
 }
Ejemplo n.º 3
0
        private void radGridView5_Click(object sender, EventArgs e)
        {
            try
            {
                if (radGridView5.CurrentRow.Cells[0].Value != null)
                {
                    _bindingSource_personel_time = new BindingSource {
                        DataSource = new CommandServer().DataGridSet(@"select key_job_spezialist, date_start, date_end
                    from job_spezialist left join speziolist on job_spezialist.fk_spezialist = speziolist.key_speziolist
                    where fk_spezialist = " + radGridView5.CurrentRow.Cells[0].Value).Tables[0]
                    };
                    radGridView6.DataSource = _bindingSource_personel_time;

                    GridViewDateTimeColumn dateS = new GridViewDateTimeColumn("Дата начала");
                    radGridView6.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("Дата конца");
                    radGridView6.Columns[2] = dateE;
                    dateE.Name         = "date_e";
                    dateE.FieldName    = "date_end";
                    dateE.FormatString = "{0:dd/MM/yyyy}";
                    dateE.Format       = DateTimePickerFormat.Custom;
                    dateE.CustomFormat = "d.M.y";

                    radGridView6.Columns[0].IsVisible = false;
                    radGridView6.AutoSizeColumnsMode  = GridViewAutoSizeColumnsMode.Fill;
                    radGridView6.Columns[1].BestFit();
                    radGridView6.Columns[2].BestFit();
                    if (radGridView6.RowCount > 0)
                    {
                        UpdateLoadJobTime();
                    }
                    else
                    {
                        richTextBox1.Text = "";
                    }
                }
            }
            catch (Exception ex)
            {
                CommandClient commandClient = new CommandClient();
                commandClient.WriteFileError(ex, null);
            }
        }
Ejemplo n.º 4
0
        private void AlertOperation(string operation, string[] resultOperation)
        {
            var commandClient = new CommandClient();

            if (resultOperation[1] == "1")
            {
                radDesktopAlert1.ContentText = resultOperation[0];
                radDesktopAlert1.Show();
            }
            else
            {
                radDesktopAlert1.ContentText = resultOperation[0];
                radDesktopAlert1.Show();
            }
        }
Ejemplo n.º 5
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);
                    }
                }
            }
        }
Ejemplo n.º 6
0
        private void ScanFile()
        {
            if (!Directory.Exists("Temp"))
            {
                Directory.CreateDirectory("Temp");
            }
            else
            {
                DirectoryInfo dirInfo = new DirectoryInfo("Temp");
                foreach (FileInfo file in dirInfo.GetFiles())
                {
                    file.Delete();
                }
            }

            var network = new NetworkShareAccesser();

            _load.SetLabel("Проверка доступности локального сервера");
            network.SaveACopy(@"\\S1\Alldoc\Install\Программы\Обновления\Одиноко проживающие\", Path.Combine(Application.StartupPath, "Temp"), 1500);
            Thread.Sleep(2500);

            DirectoryInfo di = new DirectoryInfo(Path.Combine(Application.StartupPath, "Temp"));

            FileInfo[] files = di.GetFiles();
            if (files.Length != 0)
            {
                UpdateProgram();
            }
            else
            {
                try
                {
                    FTPConnect();
                    UpdateProgram();
                }
                catch (Exception ex) {
                    MessageBox.Show(
                        @"Произошла ошибка при обновлении. Обратитесь к разработчику.",
                        @"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    new Configuration().ShowDialog();
                    var commandClient = new CommandClient();
                    commandClient.WriteFileError(ex, "Обновление");
                }
            }
        }
Ejemplo n.º 7
0
        private void fillTheDataGrid()
        {
            var commandServer = new CommandServer();

            try
            {
                radGridView1.Invoke(new MethodInvoker(delegate()
                {
                    loadGridSoc();
                    LoadGridInspector();
                }));
            }
            catch (Exception ex)
            {
                CommandClient commandClient = new CommandClient();
                commandClient.WriteFileError(ex, null);
            }
        }
Ejemplo n.º 8
0
        private void Add(object sender, EventArgs e)
        {
            var commandClient = new CommandClient();

            try
            {
                Hide();
                new Alone(true, 0, null, null).ShowDialog();
            }
            catch (Exception ex)
            {
                commandClient.WriteFileError(ex, null);
            }
            finally
            {
                Show();
                GC.Collect();
                GC.WaitForPendingFinalizers();
            }
        }
Ejemplo n.º 9
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;
        }
Ejemplo n.º 10
0
        private void radGridView2_Click(object sender, EventArgs e)
        {
            try
            {
                if (radGridView2.CurrentRow.Cells[0].Value != null)
                {
                    _bindingSource_off_time = new BindingSource {
                        DataSource = new CommandServer().DataGridSet(@"select key_job_spezialist, date_start, date_end
                    from job_spezialist left join speziolist on job_spezialist.fk_spezialist = speziolist.key_speziolist
                    where fk_spezialist = " + radGridView2.CurrentRow.Cells[0].Value).Tables[0]
                    };
                    radGridView4.DataSource = _bindingSource_off_time;

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

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

                    radGridView4.Columns[0].IsVisible = false;
                    radGridView4.AutoSizeColumnsMode  = GridViewAutoSizeColumnsMode.Fill;
                    radGridView4.Columns[1].BestFit();
                    radGridView4.Columns[2].BestFit();
                }
            }
            catch (Exception ex)
            {
                CommandClient commandClient = new CommandClient();
                commandClient.WriteFileError(ex, null);
            }
        }
Ejemplo n.º 11
0
        private void UpdateProgram()
        {
            Process update = new Process();

            try
            {
                update.StartInfo.UseShellExecute = true;
                update.StartInfo.FileName        = _programName;
                update.Start();
            }
            catch (Exception ex)
            {
                var commandClient = new CommandClient();
                commandClient.WriteFileError(ex, "Обновление");
                MessageBox.Show(
                    @"Произошла ошибка при обновлении. Обратитесь к разработчику.",
                    @"Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            finally
            {
                Process.GetCurrentProcess().Kill();
            }
        }
Ejemplo n.º 12
0
        private void radGridView6_RowsChanging(object sender, GridViewCollectionChangingEventArgs e)
        {
            var  commandServer = new CommandServer();
            var  commandClient = new CommandClient();
            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() + "',";
                        radGridView5.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 = commandServer.ExecReturnServer("job_spezialist_edit", parameters);
                    AlertOperation("job_spezialist_edit " + line.Cells[1].Value, returnSqlServer);
                    if (update)
                    {
                        LoadGridFio();
                        LoadGridFioOff();
                    }
                    else
                    {
                        UpdateLoadJobTime();
                    }
                }
            }
        }