Пример #1
0
        /// <summary>
        /// Cобытие EditClick.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void HandleEditClick(object sender, EventArgs e)
        {
            if (sys.IsEmpty(EditFormName))
            {
                if (ObjRef != null)
                {
                    string EntityBriefLocal;
                    string EntityBriefLink;
                    string NeedAttr;
                    if (!ObjRef.GetLinkEntityBrief(AttrBrief, out EntityBriefLocal, out EntityBriefLink, out NeedAttr))
                    {
                        return;
                    }
                    if (EntityBriefLink == "")
                    {
                        return;
                    }
                    if (NeedAttr == "")
                    {
                        return;
                    }

                    var Params = new DirectoryParams();
                    Params.EntityBrief     = EntityBriefLink;
                    Params.ObjectID        = ObjectID;
                    Params.Multiselect     = false;
                    Params.showMode        = ShowMode.ExecMSQL;
                    Params.OuterWHERE      = OuterWHERE;
                    Params.СustomMSQLQuery = СustomQuery;
                    Params.ReturnAttrBrief = NeedAttr;
                    //EntityBriefLink, ObjectID, false, true, "Exec", OuterWHERE, СustomQuery, NeedAttr
                    //var F = new FormDirectory(EntityBriefLink, ObjectID, false, true, "Exec", OuterWHERE, СustomQuery, NeedAttr);
                    var F = new FormDirectory(EntityBriefLink, ref Params);
                    if (!F.FilterSet)
                    {
                        return;
                    }
                    F.ShowDialog();
                    if (Params.ReturnObjectID != "")
                    {
                        //Форма закрылась по кнопке Ок.
                        this.ObjectID = Params.ReturnObjectID;
                        if (Params.ReturnAttrValue == "")
                        {
                            string msqlLocal = "SELECT " + NeedAttr + " FROM " + EntityBriefLink + " WHERE " + ParserData.KeyBrief.ObjectID + " = " + Params.ReturnObjectID;
                            string sqlLocal  = sys.Parse(msqlLocal);
                            this.Text = sys.GetValue(DirectionQuery.Remote, sqlLocal);
                        }
                        else
                        {
                            this.Text = Params.ReturnAttrValue;
                        }
                    }
                }
            }
            this.OnEditClick(e); //Пользовательское событие показа формы справочника.
        }