Пример #1
0
 public void compile_view()
 {
     foreach (var fview in middleObjects.views)
     {
         fview.setAppService(this);
         var objCaller = new clsCallObjects();
         objCaller.Add(fview, "get");
         objCaller.path = fview.view + "/get";
         objCaller.compile();
         lstRequest.Add(objCaller);
     }
 }
Пример #2
0
        public void compile_customModules()
        {
            foreach (var fcustomModule in middleObjects.customModules)
            {
                iAPIRequestBase objCustom = g.createObjectFromAssemblyInfo(fcustomModule.assemblyName, fcustomModule.classPath) as iAPIRequestBase;

                objCustom.setAppService(this);
                foreach (string sMethod in fcustomModule.methods)
                {
                    var objCaller = new clsCallObjects();

                    objCaller.Add(objCustom, sMethod);
                    objCaller.path = fcustomModule.name + "/" + sMethod;
                    objCaller.compile();

                    lstRequest.Add(objCaller);
                }
            }
        }
Пример #3
0
        public void compile_table()
        {
            foreach (var fTable in middleObjects.tables)
            {
                fTable.setAppService(this);

                string[] methods = new string[] { "get", "save", "delete", "drp" };

                foreach (string sMethod in methods)
                {
                    var objCaller = new clsCallObjects();
                    objCaller.Add(fTable, sMethod);
                    objCaller.path = fTable.name + "/" + sMethod;

                    if (sMethod == "save")
                    {
                        if (fTable.cols != null && fTable.cols.Count > 0)
                        {
                            foreach (var fCol in fTable.cols)
                            {
                                var objValidateBasic = new middleware.Validations.vField();

                                objValidateBasic.field    = fCol.name;
                                objValidateBasic.title    = fCol.title;
                                objValidateBasic.type     = fCol.dataType;
                                objValidateBasic.size     = fCol.size;
                                objValidateBasic.required = fCol.required;

                                objValidateBasic.setAppService(this);

                                objCaller.Add(objValidateBasic, "call");
                            }
                        }
                        if (fTable.UniqueKeys != null && fTable.UniqueKeys.Count > 0)
                        {
                            foreach (var fUniqueKey in fTable.UniqueKeys)
                            {
                                var objValidateUniqueKey = new middleware.Validations.vUnique();
                                objValidateUniqueKey.setAppService(this);
                                objValidateUniqueKey.name    = fUniqueKey.name;
                                objValidateUniqueKey.idField = fTable.autoIncrementField;
                                objValidateUniqueKey.table   = fTable.name;

                                foreach (var sField in fUniqueKey.cols)
                                {
                                    string sTitle = sField;
                                    if (fTable.cols != null && fTable.cols.Count > 0)
                                    {
                                        var fcol = fTable.cols.Find(p => p.name.ToUpper() == sField.ToUpper());
                                        if (fcol != null)
                                        {
                                            sTitle = fcol.title;
                                        }
                                    }

                                    objValidateUniqueKey.addField(sField, sTitle);
                                }
                                objCaller.Add(objValidateUniqueKey, "call");
                            }
                        }
                    }
                    objCaller.compile();
                    lstRequest.Add(objCaller);
                }
            }
        }