SQLJSON

 

I. User Authentication and Authorization.

New registration will also create a new workgroup. By default you will have a "DIRECTOR" roles of the group.

You can add a new user to your workgroup, and customize the user roles of your workgroup. To manages Workgroup and Authoziation, you need to have a "ADMINISTRATOR" role, and by default you will have it on your new application.

1. Workgroup.

 

2. User Workgroups.

3. User Workgroup Roles.


 

4. Add new user to Workgroup.

a. Click Plus button.

 

II. Create New Backend Service.

Create Project.

  1. After Login, go to dashboard https://app.ardvro.com. Then click Projects.
  2. Create "plus" button to create new project.
  3. Input the project information, then click Save button.
    Project Type:
                    Public -> You can share your project to others.
                    Private -> Only your workgroups members can access the project.
    Hosting Type: You have to Select "AppHosting".
  4. After you saved, the project items will be appear.
    1. Published Template Setup Items.
      1. Published Template.
        1. You can create an application template.
        2. If you set public the others member can use your template.
      2. Project Setup Items.
        1. Setting that can be input by the users.
        2. You can set the any input variables, rules and type.
    2. SQL Web API Data Schema.
      1. Data Source.
        1. Table. You can create a database table, create on the Data source tree to create new.  After you click save, refresh the Tree, then the new item named Data Source Item will appear under your table name.
          1. Data Source Item (table columns). You need to defined the columns. To create the columns of the table click on the Data Source Item node.
          2. Data Source Roles. You can define what type of roles that has the access right to the table of each of CRUD operation.
        2. Procedure.  You can create a database store procedure, create on the Data source tree to create new.  On the content, type the SQL Store procedure code.
          1. Data Source Item (Store procedure arguments). You need to defined the columns. To create the columns of the table click on the Data Source Item node.
          2. Data Source Roles. You can define what type of roles that has the access right to the access the Store Procedure.
      2. Database script.
        You can use any database query when deploying a project. When you deploy a project, a new database will be created, and all Database script will be executed in the database. You can write table, store procedure, Initinial on this item. But if you create table and procedure in this item, you need to define the access roles later after your project have been deployed.

         

 

III. Publish Project.

 

You can modify your project, tables, store procedures, roles. If you modify your project you need to redeploy your  project.

 

1. On the top left menu button, Click "Create Subscription" on the menu.

 

2. Select your Project.

3. Select your hosting package options.

  1. If you select FREE package, then just klik "Submit and Deploy".
    WebAppGear select free package

     
  2. If you select Lite Package, then fill your domain, subscription duration, and voucher code if you have. We highly recommended this options for non-IT background Note new domain will take approximately upto 48 hours to be redirected to ARDVRO Server, as well as existing or transfered domain. You can manage the domain on the Domain menu in the Dashboard https://app.ardvro.com. The domain will remain yours as long as you pay the registration fee to the Domain registrar, can be through us or others.
    WebAppGear lite package

     
  3. If you select Pro Package, you need to fill up your CPanel username with 8 characters length. Note: if you are Advanced User with some basic IT background, you can choose the Pro Package. But if you want the simplest one, you can also choose the Lite Package. if you are a non-technical user without any IT background, we highly recommend choosing the Lite Package.
    WebAppGear Pro

     
  4. Payments. The payment will depend on your country, and it will display an information on how to pay, and follow the instruction.
    WebAppGear Payments

     
  5. Deployment. After we received your payment, our system will automatically deploy your website. Note: for new domain it will takes approximately between 3 to 48 hours to redirected to ARDVRO Server, as well as for transfer domain or exsiting domain that not point to ARDVRO name server yet. ARDVRO NameServer ns1.ardvro.org ns2.ardvro.org

 

Modify and Redeploy Project.

  1. Go to ARDVRO Dashboard https://app.ardvro.com
    WebApggear select template
  2. Click website menu on the dashboard
    WebApggear select template

     
  3. Click an child web application (subdomain application)
    WebApggear select template

     
  4. Click setting, then modify your website content, type like you type in Ms.Word application
    WebApggear select template

 

 

 

V. Javascript Client SDK.

The Javascript Client SDK work with Event Driven Programming and fully asyncronous.

1.  Initialize Connection.

Basic Initialization.

Put on head of index.html

    <script type="text/javascript" src="https://[DOMAINNAME]/res/js/production/app.res.js.production.js"></script>

    <script type="text/javascript" src="https://cdn.ardvro.com/ardvro/ardvro.js"></script>

    <script type="text/javascript">

        const WEBSOCKETURL = "ardvro.com";

        const WEBBASEURL = "https://[DOMAINNAME]";

        const CDNURL = "https://cdn.ardvro.com";

        window.onload = function ()

        {

            Loader.Start(listeners);

        };

        (function ()

        {

            Loader.InitDependencies(WEBBASEURL, CDNURL, dependencies);

        })();

    </script>

 

Custom initialization.

You can create any custom initialization logic, but you need to call Loader.Start(...) first. You can also custommize the dependencies.

Example custom Initalization:


 

var Cms = (function ()

{

       let cms = {};

 

       let _profileController;

       let _contentController;

 

       let _profile = {};

       function getProfile()

       {

              return _profile;

       }

       function setProfile(profile)

       {

              _profile = profile;

       }

 

       cms.GetProfile = function ()

       {

              return getProfile();

       };

 

       cms.InitMenu = function (websiteStartuper, usr)

       {

              _profileController = new ProfileController({

                     Connector: websiteStartuper.GetConnector(),

                     GetServerTime: websiteStartuper.GetServerTimeFunction(),

                     OnLoad: function (profileCtrl)

                     {

                           _contentController = new ContentController({

                                  Connector: websiteStartuper.GetConnector(),

                                  GetServerTime: websiteStartuper.GetServerTimeFunction(),

                                  OnLoad: function (ctrl)

                                  {

                                         if (websiteStartuper.GetUser() != null && usr != null)

                                         {

                                                registerProfile(ctrl, profileCtrl, websiteStartuper.GetUser(), websiteStartuper.GetAppName(), websiteStartuper.GetServerTimeFunction(),

                                                       function (profileResult)

                                                       {

                                                              reinitMenuItems(ctrl, profileCtrl, websiteStartuper, profileResult);

                                                              setProfile(profileResult);

                                                       }

                                                );

                                         }

                                         else

                                         {

                                                reinitMenuItems(ctrl, profileCtrl, websiteStartuper, {});

 

                                                let chatContentField = Object.keys(websiteStartuper.GetWebsiteSetting()).find(x => x.includes(CONTENT_CHAT_ID));

                                                if (chatContentField != null)

                                                {

                                                       let chatContentId = websiteStartuper.GetWebsiteSetting()[chatContentField];

                                                       if (chatContentId != null && !isNaN(chatContentId))

                                                       {

                                                              let wigChat = new ChatWidget({

                                                                     Id: "chatWidget",

                                                                     Label: "Chat Widget",

                                                                     cmsContentId: Number(chatContentId),

                                                                     CdnUrl: websiteStartuper.GetCdnUrl(),

                                                                     Theme: websiteStartuper.GetTheme(),

                                                                     Connector: websiteStartuper.GetConnector(),

                                                                     Authenticator: websiteStartuper.GetAuthenticator(),

                                                                     GetServerTime: websiteStartuper.GetServerTimeFunction(),

                                                                     AppName: websiteStartuper.GetAppName(),

                                                                     NotificationListeners: websiteStartuper.GetNotificationListeners()

                                                              });

                                                              wigChat.Tonggle();

                                                       }

                                                }

                                         }

                                  }

                           });

                     }

              });

       };

 

 

2. Initalized DB Context.

After Websocket connection establish, next it need to initialize the DBContext. The DBContext object will be retrived base on the Authorization configuration.

let dbcontext = new SqlJson({ Connector: cfg.Connector });

3. Get Data.

dbcontext.Customer.Where("Name like (?) and status in (?)", name, [1,2,3]).OrderBy("Name ASC").Limit(0, 10).PagingJsons("*").Send(function(results){ let list = JSON.parse(results); });

 

4. Upsert.

        let data = {};
        data.Id = 0;
        data.Status = 1;
        data.Updated = cfg.GetServerTime().Format('yyyy-MM-dd HH:mm:ss');
        data.Updater = "";
        data.VoteType = voteType;
        data.Value = voteValue;
        data.pfeProfileId = profileId;
        data.cmsContentId = contentId;

        dbcontext.cmsContentVote.Save(data).Send(function (result)
        {
            if (callback != null)
            {
                callback(result);
            }
        });
 

5. Delete.

        dbcontext.cmsContentVote.Delete(data).Send(function (result)
        {
            if (callback != null)
            {
                callback(result);
            }
        });
 

6. Call Store Procedure.

        dbcontext.sp_cmsContentTags.ProcedureJsons(pageIndex, rows, orderMode).Send(function (jsons)
        {
            if (callback != null)
            {
                let list = [];
                if (jsons != null && jsons != "")
                {
                    list = JSON.parse(jsons);
                }
                callback(list);
            }
        });

7. More example, visit: https://github.com/ardvro