Exemplo n.º 1
0
        public static void AssignDescriptionToAttribute(object[] parameters, int descriptionToSet)
        {
            foreach (object o in parameters)
            {
                Dictionary <string, string> dic = (Dictionary <string, string>)o;
                int cant = 0;

                string            attName = "";
                string            mensaje = "";
                PromptDescription pd;
                DialogResult      dr;

                foreach (string s in dic.Values)
                {
                    if (cant == 1)
                    {
                        attName = s;
                        switch (descriptionToSet)
                        {
                        case 0:
                            mensaje = "Insert description for attribute " + attName;
                            break;

                        case 1:
                            mensaje = "Insert title for attribute " + attName;
                            break;

                        case 2:
                            mensaje = "Insert column title for attribute " + attName;
                            break;
                        }

                        pd = new PromptDescription(mensaje);
                        dr = pd.ShowDialog();

                        if (dr == DialogResult.OK)
                        {
                            Artech.Genexus.Common.Objects.Attribute a = Artech.Genexus.Common.Objects.Attribute.Get(UIServices.KB.CurrentModel, attName);
                            switch (descriptionToSet)
                            {
                            case 0:
                                a.Description = pd.Description;
                                break;

                            case 1:
                                a.Title = pd.Description;
                                break;

                            case 2:
                                a.ColumnTitle = pd.Description;
                                break;
                            }
                            a.Save();
                        }
                    }

                    cant++;
                }
            }
        }
Exemplo n.º 2
0
        public static void ReplaceDomain()
        {
            IKBService kbserv = UIServices.KB;

            bool           success = true;
            string         title   = "KBDoctor - Replace domain ";
            IOutputService output  = CommonServices.Output;


            ReplaceDomain rd = new ReplaceDomain();
            DialogResult  dr = new DialogResult();

            dr = rd.ShowDialog();

            if (dr == DialogResult.OK)
            {
                output.StartSection(title);

                Domain od = Functions.DomainByName(rd.originalDomainName);
                Domain ud = Functions.DomainByName(rd.destDomainName);

                if (od != null && ud != null)
                {
                    foreach (EntityReference reference in od.GetReferencesTo()) // LinkType.UsedObject))
                    {
                        KBObject objRef = KBObject.Get(UIServices.KB.CurrentModel, reference.From);
                        output.AddLine("Procesing " + objRef.Name);
                        if (objRef is Artech.Genexus.Common.Objects.Attribute)
                        {
                            Artech.Genexus.Common.Objects.Attribute att = (Artech.Genexus.Common.Objects.Attribute)objRef;
                            att.DomainBasedOn = ud;
                            att.Save();
                        }
                        else
                        {
                            VariablesPart vp = objRef.Parts.Get <VariablesPart>();
                            if (vp != null)
                            {
                                foreach (Variable v in vp.Variables)
                                {
                                    if (v.DomainBasedOn == od && !v.IsStandard)
                                    {
                                        v.DomainBasedOn = ud;
                                    }
                                }
                                objRef.Save();
                            }
                            else
                            {
                                output.AddLine("Replace " + od.Name + " domain manually in object " + objRef.Name);
                                success = false;
                            }
                        }
                    }
                }
                output.EndSection(title, success);
            }
        }
Exemplo n.º 3
0
        public static void AssignDomainToAttribute(object[] parameters)
        {
            foreach (object o in parameters)
            {
                Dictionary <string, string> dic = (Dictionary <string, string>)o;
                int cant = 0;

                string attName    = "";
                string domainName = "";

                foreach (string s in dic.Values)
                {
                    switch (cant)
                    {
                    case 1:
                        attName = s;
                        break;

                    case 2:
                        domainName = s;
                        break;

                    default:
                        break;
                    }
                    cant++;

                    if ((attName != "") && (domainName != ""))
                    {
                        Artech.Genexus.Common.Objects.Attribute a = Artech.Genexus.Common.Objects.Attribute.Get(UIServices.KB.CurrentModel, attName);

                        Domain d = Functions.DomainByName(domainName);

                        a.DomainBasedOn = d;
                        a.Save();
                    }
                }
            }
        }