Пример #1
0
        private void Popup_ModifierClient_Load(object sender, EventArgs e)
        {
            ISessionFactory sessionFactory = new Configuration().Configure().BuildSessionFactory();
            ISession        session        = sessionFactory.OpenSession();

            using (ITransaction transaction = session.BeginTransaction())
            {
                TypeStructure lesTypeStructure = new TypeStructure();
                comboBoxTS.DataSource             = lesTypeStructure.GetLesTypesStructure();
                comboBoxChoixStructure.DataSource = session.CreateQuery(@"select e from Structure e order by e.denominationSociale asc").List <Structure>();

                if (interlocuteur != null)
                {
                    if (interlocuteur.nomInterlocuteur != null)
                    {
                        textBoxNom.Text = interlocuteur.nomInterlocuteur;
                    }

                    if (interlocuteur.prenomInterlocuteur != null)
                    {
                        textBoxPrenom.Text = interlocuteur.prenomInterlocuteur;
                    }

                    if (interlocuteur.telInterlocuteur != null)
                    {
                        textBoxTel.Text = interlocuteur.telInterlocuteur;
                    }

                    if (interlocuteur.telInterlocuteur != null)
                    {
                        textBoxTel.Text = interlocuteur.telInterlocuteur;
                    }

                    if (interlocuteur.mailInterlocuteur != null)
                    {
                        textBoxMail.Text = interlocuteur.mailInterlocuteur;
                    }

                    // Si l'interlocuteur est un particulier
                    if (isIndividu)
                    {
                        Individu individu = session.CreateQuery("select e from Individu e where e.interlocuteur.idInterlocuteur=:num").SetParameter("num", interlocuteur.idInterlocuteur).UniqueResult <Individu>();

                        if (individu.adresseIndividu != null)
                        {
                            textBoxAdresse.Text = individu.adresseIndividu;
                        }

                        if (individu.cpIndividu != null)
                        {
                            textBoxCp.Text = individu.cpIndividu;
                        }

                        if (individu.villeIndividu != null)
                        {
                            textBoxVille.Text = individu.villeIndividu;
                        }

                        if (individu.distanceSiege != null)
                        {
                            textBoxDistance.Text = individu.distanceSiege.ToString();
                        }

                        if (individu.infosSupplementaire != null)
                        {
                            textBoxIC.Text = individu.infosSupplementaire;
                        }
                    }

                    // Si l'interlocuteur est un interlocuteur_structure
                    if (!isIndividu)
                    {
                        groupBoxParticulier.Visible        = false;
                        groupBoxStructureExistante.Visible = true;

                        InterlocuteurStructure interlocuteurStructure = session.CreateQuery("select e from InterlocuteurStructure e where e.interlocuteur.idInterlocuteur=:num").SetParameter("num", interlocuteur.idInterlocuteur).UniqueResult <InterlocuteurStructure>();

                        if (interlocuteurStructure.structure != null)
                        {
                            foreach (Structure s in comboBoxChoixStructure.Items)
                            {
                                if (s.numStructure == interlocuteurStructure.structure.numStructure)
                                {
                                    comboBoxChoixStructure.SelectedItem = s;
                                }
                            }
                        }
                    }
                }
                session.Dispose();
            }
        }
Пример #2
0
 private string getSourceParameters(MethodStructure methodStructure, TypeStructure x)
 {
     return($"{x.Name}:{(x.Attributes.ContainsKey("FromBodyAttribute") ? "\"BODY\"" : methodStructure.URL.Contains($"{{{x.Name}}}") ? "\"URL\"" : "\"QUERY\"")}");
 public AssignmentFromObj(TypeStructure typeStructure, Types.JSString type) : this(typeStructure) { }
Пример #4
0
 public static ValueStructureSparse Create(TypeStructure valueType)
 {
     return(new ValueStructureSparse(valueType));
 }
Пример #5
0
 public DirectAssignment(TypeStructure typeStructure, Types.JSString type) : this(typeStructure) { }
Пример #6
0
 private void buildConstructorComment(TypeStructure typeStructure)
 {
     childRenderbles.Add((JSRenderble)DI.Get <IClassConstructorComment>(typeStructure));
 }
Пример #7
0
 private string getFromObjectPropertyTagName(TypeStructure typeStructure)
 {
     return(((JSRenderble)DI.Get <IFromObjectAssignmentProperty>(typeStructure, new JSNumber())).Name);
 }
Пример #8
0
 public ArrayTypeStructure(TypeStructure elementType) : base(elementType)
 {
 }
Пример #9
0
 public NullableTypeStructure(TypeStructure elementType) : base(elementType)
 {
 }
Пример #10
0
 public Parameter(TypeStructure type, bool hasModifier)
 {
     Type        = type;
     HasModifier = hasModifier;
 }
Пример #11
0
 public PointerTypeStructure(TypeStructure elementType) : base(elementType)
 {
 }
Пример #12
0
 protected NodeTypeStructure(TypeStructure elementType) => ElementType = elementType;
Пример #13
0
        public void TestRequestContainer()
        {
            var idParameter = new TypeStructure
            {
                Attributes  = new Dictionary <string, Attribute> {
                },
                IsSytemType = true,
                Name        = "id",
                Type        = typeof(int)
            };
            var classStructure = new ClassStructure
            {
                Attributes = new Dictionary <string, Attribute> {
                },
                Name       = "Person",
                URL        = "API/Person",
                Methods    = new List <MethodStructure>
                {
                    new MethodStructure
                    {
                        Attributes = new Dictionary <string, Attribute> {
                            { "HttpGetAttribute", new IgnoreAttribute() }
                        },
                        Name       = "Get",
                        URL        = "API/Person",
                        IsRPC      = false,
                        Parameters = new List <TypeStructure>
                        {
                        },
                        Result = new TypeStructure
                        {
                            IsArray    = true,
                            Name       = personTypeStructure.Name,
                            Properties = personTypeStructure.Properties,
                            TypeName   = personTypeStructure.TypeName
                        }
                    },
                    new MethodStructure
                    {
                        Attributes = new Dictionary <string, Attribute> {
                            { "HttpGetAttribute", new IgnoreAttribute() }
                        },
                        Name       = "Get",
                        URL        = "API/Person/{id}",
                        IsRPC      = false,
                        Parameters = new List <TypeStructure>
                        {
                            idParameter
                        },
                        Result = personTypeStructure
                    }
                    ,
                    new MethodStructure
                    {
                        Attributes = new Dictionary <string, Attribute> {
                            { "HttpPutAttribute", new IgnoreAttribute() }
                        },
                        Name       = "Put",
                        URL        = "API/Person/{id}",
                        IsRPC      = false,
                        Parameters = new List <TypeStructure>
                        {
                            idParameter,
                            personTypeStructure
                        },
                        Result = successTypeStructure
                    },
                    new MethodStructure
                    {
                        Attributes = new Dictionary <string, Attribute> {
                            { "HttpPostAttribute", new IgnoreAttribute() }
                        },
                        Name       = "Post",
                        URL        = "API/Person",
                        IsRPC      = false,
                        Parameters = new List <TypeStructure>
                        {
                            personTypeStructure
                        },
                        Result = successTypeStructure
                    },
                    new MethodStructure
                    {
                        Attributes = new Dictionary <string, Attribute> {
                            { "HttpDeleteAttribute", new IgnoreAttribute() }
                        },
                        Name       = "Delete",
                        URL        = "API/Person/{id}",
                        IsRPC      = false,
                        Parameters = new List <TypeStructure>
                        {
                            idParameter
                        },
                        Result = successTypeStructure
                    }
                }
            };

            var jsCode = ((JSRenderble)DI.Get <IJSClass>(classStructure)).GetText();

            Assert.AreEqual(jsCode, "import {request,globalTokens} from \"./request/request.js\";\r\nimport {Person} from \"./models/Person.js\";\r\nimport {PersonDetails} from \"./models/PersonDetails.js\";\r\nimport {ResultAction} from \"./models/ResultAction.js\";\r\n\r\nclass PersonRequestContainer \r\n{\r\n     /**\r\n    * PersonRequestContainer. Use instance to make requests to: API/Person\r\n    * @param { String } baseURL\r\n*/\r\n    constructor(baseUrl) \r\n    {\r\n/**\r\n    * @type String\r\n*/\r\nthis.baseUrl = baseUrl;\r\n\r\nthis._Get = new request(this.baseUrl,\"API/Person\",\"GET\",{}, Person);\r\n\r\nthis._GetById = new request(this.baseUrl,\"API/Person/{id}\",\"GET\",{id:\"URL\"}, Person);\r\n\r\nthis._PutById = new request(this.baseUrl,\"API/Person/{id}\",\"PUT\",{id:\"URL\",Person:\"BODY\"}, ResultAction);\r\n\r\nthis._Post = new request(this.baseUrl,\"API/Person\",\"POST\",{Person:\"BODY\"}, ResultAction);\r\n\r\nthis._DeleteById = new request(this.baseUrl,\"API/Person/{id}\",\"DELETE\",{id:\"URL\"}, ResultAction);\r\n\r\n    }\r\n    setHttpHeaders(headerObject)\r\n    {\r\n       for (var key in headerObject){\r\n            globalTokens[key] = headerObject[key];\r\n        }\r\n    }\r\n     /**\r\n    * Method used to invoke request of type: GET to URL: API/Person.\r\n<< ParameterTypeComment >>\r\n    * @return {PromiseLike<Person[]>}\r\n*/\r\n    Get ()\r\n    {\r\n        return this._Get.ExecuteRequest({});\r\n    }\r\n\r\n     /**\r\n    * Method used to invoke request of type: GET to URL: API/Person/{id}.\r\n    * @param { Number } id\r\n    * @return {PromiseLike<Person>}\r\n*/\r\n    GetById (id)\r\n    {\r\n        return this._GetById.ExecuteRequest({id:id});\r\n    }\r\n\r\n     /**\r\n    * Method used to invoke request of type: PUT to URL: API/Person/{id}.\r\n    * @param { Number } id\r\n    * @param { Person } Person\r\n    * @return {PromiseLike<ResultAction>}\r\n*/\r\n    PutById (id,Person)\r\n    {\r\n        return this._PutById.ExecuteRequest({id:id,Person:Person});\r\n    }\r\n\r\n     /**\r\n    * Method used to invoke request of type: POST to URL: API/Person.\r\n    * @param { Person } Person\r\n    * @return {PromiseLike<ResultAction>}\r\n*/\r\n    Post (Person)\r\n    {\r\n        return this._Post.ExecuteRequest({Person:Person});\r\n    }\r\n\r\n     /**\r\n    * Method used to invoke request of type: DELETE to URL: API/Person/{id}.\r\n    * @param { Number } id\r\n    * @return {PromiseLike<ResultAction>}\r\n*/\r\n    DeleteById (id)\r\n    {\r\n        return this._DeleteById.ExecuteRequest({id:id});\r\n    }\r\n\r\n}\r\n\r\nexport {Person,PersonDetails,ResultAction,PersonRequestContainer};");
        }
 public AssignmentFromObj(TypeStructure typeStructure, Types.JSBoolArray type) : this(typeStructure) { }
Пример #15
0
 private bool shouldProcessParameter(Models.ItemType objectType, TypeStructure parameterStructure)
 {
     return(!parameterStructure.IsSytemType && AppDomain.CurrentDomain.GetAssemblies().Contains(objectType.Type.Assembly));
 }
Пример #16
0
 public QualifiedNameStructure(TypeStructure left, SimpleNameStructure right)
 {
     Left  = left;
     Right = right;
 }
Пример #17
0
 private void buildExport(TypeStructure typeStructure)
 {
     childRenderbles.Add((JSRenderble)DI.Get <IExport>(typeStructure));
 }
Пример #18
0
        protected ValueStructure(TypeStructure valueType, Dictionary <string, ILanguageValue> value)
        {
            ValueStructureType = valueType;

            Value = value;
        }
Пример #19
0
 private void buildFromObjectAssignmentProperties(TypeStructure typeStructure)
 {
     multiplyTags(typeStructure.Properties.Count, getFromObjectPropertyTagName(typeStructure));
     childRenderbles.AddRange(typeStructure.Properties.Select(property => (JSRenderble)DI.Get <IFromObjectAssignmentProperty>(property, JSTypeMapping.GetJSType(property))));
 }
Пример #20
0
        protected ValueStructure(TypeStructure valueType)
        {
            ValueStructureType = valueType;

            Value = new Dictionary <string, ILanguageValue>();
        }
Пример #21
0
 protected ValueStructureSparse(TypeStructure valueType)
 {
     ValueStructureType = valueType;
 }
Пример #22
0
        //public static ValueStructure Create(TypeStructure value_type)
        //{
        //    return new ValueStructure(value_type);
        //}

        public static ValueStructure Create(TypeStructure valueType, Dictionary <string, ILanguageValue> value)
        {
            return(new ValueStructure(valueType, value));
        }
Пример #23
0
 public DirectAssignment(TypeStructure typeStructure, Types.JSNumber type) : this(typeStructure) { }
Пример #24
0
 public JSFunction(TypeStructure typeStructure) : base(Resources.functionPOKO)
 {
     assignLocalProperties(typeStructure);
     createPOCOClassConstructorComment();
     createPOCOClassProperties(typeStructure);
 }
Пример #25
0
 public DirectAssignment(TypeStructure typeStructure, Types.JSBoolArray type) : this(typeStructure) { }
 public static bool CompareTypes(TypeStructure first, TypeStructure second)
 => Compare(first, second);
Пример #27
0
 public ExportPOCO(TypeStructure typeStructure) : base("ExportPOCO")
 {
     tagValues = new Dictionary <string, string> {
         { typesTag, Configuration.Instance.ModelsNameFactory(typeStructure.TypeName) }
     };
 }
 public AssignmentFromObj(TypeStructure typeStructure, Types.JSNumber type) : this(typeStructure) { }