示例#1
0
        /// <summary>
        /// Заполнение свойств компонентов значениями.
        /// </summary>
        private void FillData()
        {
            Obj = new FBA.ObjectRef();
            Obj.SetQueryTable(this, "Main1", "fbaEntity", ID, "ID", "", DirectionQuery.Remote);
            Obj.AddAttr("Main1.EntityID", "1");
            Obj.AddAttr("Main1.Feature");
            if (operation == Operation.AddChild)
            {
                Obj.AddAttr("Main1.ParentID", ParentID);
            }
            if ((operation == Operation.Edit) || (operation == Operation.Del))
            {
                Obj.Read();
            }

            DoChecked = false;
            int val = Obj["Main1.Feature"].ToInt(); //   tbFeature.Text.ToInt();

            cbSystem.Checked   = sys.GetBit(val, 0);
            cbAccObj.Checked   = sys.GetBit(val, 1);
            cbTree.Checked     = sys.GetBit(val, 2);
            cbDiv.Checked      = sys.GetBit(val, 3);
            cbCounter.Checked  = sys.GetBit(val, 4);
            cbProtocol.Checked = sys.GetBit(val, 5);
            DoChecked          = true;
        }
示例#2
0
 /// <summary>
 /// Заполнение свойств компонентов значениями.
 /// </summary>
 private void FillData()
 {
     Obj = new FBA.ObjectRef();
     Obj.SetQueryTable(this, "Main1", "fbaTable", ObjID, "ID", "", DirectionQuery.Remote);
     Obj.AddAttr("Main1.EntityID", "2");
     Obj.AddAttr("Main1.TableEntityID", TableEntityID); //Добавляем сразу значение.
     Obj.AddAttr("Main1.Type");
     Obj.Read();
     if (Obj["Main1.Type"] != "")
     {
         tbTypeStr.SelectedIndex = Obj["Main1.Type"].ToInt() - 1;
     }
     else
     {
         tbTypeStr.Text = "";
     }
 }
示例#3
0
        ///Вместо button1.PerformClick();
        private void Action(CommandType commandType)
        {
            if (commandType == CommandType.Ok)
            {
                Close();
            }

            if (commandType == CommandType.Filter)
            {
                if (!FormFilter.Filter(
                        this,
                        listParams.EntityBrief,
                        grid1.Left,
                        grid1.Top,
                        ref filter,
                        listParams.OuterWHERE
                        ))
                {
                    FilterSet = false;
                    return;
                }
                FilterSet = true;
                RefreshGridForm(DirectionQuery.Remote, grid1, filter);
            }

            if (commandType == CommandType.ExecSQL)
            {
                FilterSet           = false;
                filter.FullQuerySQL = listParams.СustomSQLQuery;
                RefreshGridForm(DirectionQuery.Remote, grid1, filter);
            }

            if (commandType == CommandType.ExecMSQL)
            {
                FilterSet           = false;
                filter.FullQuerySQL = sys.Parse(listParams.СustomMSQLQuery);
                RefreshGridForm(DirectionQuery.Remote, grid1, filter);
            }

            if (commandType == CommandType.Refresh)
            {
                RefreshGridForm(DirectionQuery.Remote, grid1, filter);
            }

            if (commandType == CommandType.Add)
            {
                EditObject("");
            }

            if (commandType == CommandType.Edit)
            {
                this.listParams.ObjectID = grid1.Value(0, true);
                if (listParams.DoubleClickReturn)
                {
                    Close();
                }

                //показываем форму свойств выбранного объекта.
                EditObject(this.listParams.ObjectID);
            }

            if (commandType == CommandType.Del)
            {
                int      countDeleted  = 0;
                string   objectCaption = "";
                string[] arrID         = grid1.GetSelectedValues(0, true);
                if (arrID == null)
                {
                    return;
                }
                if (arrID.Length == 0)
                {
                    return;
                }
                string entityName = sys.GetEntityName("", listParams.EntityBrief);

                if (entityName != "")
                {
                    objectCaption = entityName;
                }
                if (arrID.Length == 1)
                {
                    objectCaption = objectCaption + " ИД Объекта " + arrID[0];
                }
                else
                {
                    objectCaption = objectCaption = objectCaption + " Всего объектов " + arrID.Length.ToString();
                }

                if (!sys.SM("Вы действительно ходите удалить " + objectCaption, MessageType.Question))
                {
                    return;
                }


                if (arrID.Length == 1)
                {
                    objectCaption = "'" + entityName + "'. ИД Объекта " + arrID[0];
                    var Obj = new FBA.ObjectRef();
                    if (!Obj.DeleteObject(DirectionQuery.Remote, "Contract", arrID[0]))
                    {
                        return;
                    }
                    countDeleted = 1;
                    sys.SM(objectCaption + " удален", MessageType.Information);
                }

                if (arrID.Length > 1)
                {
                    var progress1 = new FormProgress("Удаление", "Удаление объектов" + entityName, arrID.Length);
                    progress1.Show();
                    for (int i = 0; i < arrID.Length; i++)
                    {
                        objectCaption = "'" + entityName + "'. ИД Объекта " + arrID[i];
                        var Obj = new FBA.ObjectRef();
                        if (!Obj.DeleteObject(DirectionQuery.Remote, "Contract", arrID[i]))
                        {
                            return;
                        }
                        countDeleted++;
                        progress1.Inc();
                    }
                    progress1.Dispose();

                    if (countDeleted == arrID.Length)
                    {
                        objectCaption = "Все объекты " + entityName + " удалены. Всего: " + countDeleted;
                        sys.SM(objectCaption, MessageType.Information);
                    }
                    if (countDeleted < arrID.Length)
                    {
                        objectCaption = "Объекты " + entityName + " удалены. Всего: " + countDeleted + " из " + arrID.Length.ToString();
                        sys.SM(objectCaption, MessageType.Warning);
                    }
                    if (countDeleted == 0)
                    {
                        objectCaption = "Объекты " + entityName + " удалены не были.";
                        sys.SM(objectCaption);
                    }

                    if (countDeleted > 0)
                    {
                        if (sys.SM("Обновить содержимое справочника " + entityName + "?", MessageType.Question))
                        {
                            RefreshGridForm(DirectionQuery.Remote, grid1, filter);
                        }
                    }
                    ;
                }
            }
            if (commandType == CommandType.ShowSQL)
            {
                sys.SM(filter.FullQuerySQL, MessageType.Information);
            }
            if (commandType == CommandType.ShowMSQL)
            {
                sys.SM(filter.FullQueryMSQL, MessageType.Information);
            }
            if (commandType == CommandType.Details)
            {
                grid1.GridInformation();
            }
            if (commandType == CommandType.ExportToExcel)
            {
                grid1.SourceGridToExcel();
            }
            if (commandType == CommandType.ExportToCSV)
            {
                grid1.SourceGridToCSV();
            }
            if (commandType == CommandType.Search)
            {
                dtSearch = FormSearch.FormSearchShow(this.Name, null, grid1);
            }

            if (commandType == CommandType.Copy)
            {
                grid1.CopyRegion(false, false);
            }
            if (commandType == CommandType.CopyAll)
            {
                grid1.CopyRegion(true, true);
            }
            if (commandType == CommandType.CopyWithCaptions)
            {
                grid1.CopyRegion(true, false);
            }

            //if (Operation == "Copy")
            //{
            //    string Value = sys.GetValueByColumnIndex(DG2, -1, true);
            //    Value.CopyToClipboard();
            //}

            if (commandType == CommandType.SelectAll)
            {
                SourceGridSelectAll(grid1);                                              //DG2.SelectAll());
            }
            if (commandType == CommandType.SelectRows)
            {
                SourceGridSelectRows(grid1);
            }
            if (commandType == CommandType.SelectColumns)
            {
                SourceGridSelectColumns(grid1);
            }

            if (commandType == CommandType.SelectionModeCell)
            {
                SetSelectionMode(SourceGrid.GridSelectionMode.Cell);
            }
            if (commandType == CommandType.SelectionModeRow)
            {
                SetSelectionMode(SourceGrid.GridSelectionMode.Row);
            }
            if (commandType == CommandType.SelectionModeColumn)
            {
                SetSelectionMode(SourceGrid.GridSelectionMode.Column);
            }

            if (commandType == CommandType.Cancel)
            {
                this.listParams.ObjectID = "";
                this.Close();
            }

            //Копирование ссылок на выделенные документы.
            if (commandType == CommandType.CopyDocumentLink)
            {
                var      links = new StringBuilder();
                string[] arrID = grid1.GetSelectedValues(0, true);
                if (arrID.Length == 0)
                {
                    return;
                }
                for (int i = 0; i < arrID.Length; i++)
                {
                    links.Append("FBALink.Entity:" + listParams.EntityBrief + ",ObjectID:" + arrID[i] + Var.CR);
                }
                links.ToString().CopyToClipboard();
            }
        }