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

                        var returnSqlServer = commandServer.ExecReturnServer("socRabotnik_edit", parameters);
                        if (returnSqlServer[1] == "0")
                        {
                            e.Cancel = true;
                        }
                        //loadGridSoc();
                        //LoadGridSoc();
                        AlertOperation("socRabotnik_edit " + line.Cells[1].Value, returnSqlServer);
                    }
                }
            }
        }
Example #5
0
        //добавление
        private void radGridView1_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("addSocRabotnik", 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 + "'";
            var returnSqlServer = commandServer.ExecReturnServer("socRabotnik_add", parameters);

            if (returnSqlServer[1] == "0")
            {
                e.Cancel = true;
            }
            //loadGridSoc();
            //LoadGridSoc();
            AlertOperation("socRabotnik_add " + parameters, returnSqlServer);
        }
Example #6
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();
                    }
                }
            }
        }