Exemplo n.º 1
0
        public static void init()
        {
            Constants.oldVersion = Constants.getDefaultVersion();
            Constants.newVersion = Constants.getDefaultNewVersion();

            SessionTable version = App.Database.GetItem(DBConstants.ID_APP_VERSION);

            if (version != null)
            {
                Constants.oldVersion = JObject.Parse(version.JSON_DATA).ToObject <AppVersion>();
            }
            GetAppVersionRs res = MetaDataService.getInstance().CallGetAppVersion();

            if (res != null)
            {
                Constants.newVersion = res.appVersion;
            }

            TempDB.setCodeDescriptions();
            init_Member();
            init_User();
            init_Branch();
            Constants.APPLICATION_LANGUAGE = getLanguageFromDB();

            if (TempDB.flagUpdateAppVersion)
            {
                App.Database.SaveItem(DBConstants.ID_APP_VERSION, JsonConvert.SerializeObject(Constants.newVersion));
            }
            Constants.setUIReturn();
        }
Exemplo n.º 2
0
        public int SaveItem(String ID, String JSON_DATA)
        {
            SessionTable tempSave = new SessionTable();

            tempSave.ID        = ID;
            tempSave.JSON_DATA = JSON_DATA;
            return(SaveItem(tempSave));
        }
Exemplo n.º 3
0
        private static void changeAppLanguage(String language)
        {
            Constants.APPLICATION_LANGUAGE = language;
            SessionTable temp = new SessionTable();

            temp.ID        = DBConstants.ID_LANGUAGE_MEMBER;
            temp.JSON_DATA = language;
            App.Database.SaveItem(temp);
        }
Exemplo n.º 4
0
 public int SaveItem(SessionTable item)
 {
     if (GetItem(item.ID) != null)
     {
         return(database.Update(item));
     }
     else
     {
         return(database.Insert(item));
     }
 }
Exemplo n.º 5
0
        private static String getLanguageFromDB()
        {
            String ID = "";

            if (Constants.isAppForMember())
            {
                ID = DBConstants.ID_LANGUAGE_MEMBER;
            }
            else if (Constants.isAppForUser())
            {
                ID = DBConstants.ID_LANGUAGE_USER;
            }
            else if (Constants.isAppForBranch())
            {
                ID = DBConstants.ID_LANGUAGE_BRANCH;
            }
            SessionTable temp = App.Database.GetItem(ID);

            return((temp == null) ? Constants.APPLICATION_LANGUAGE_DEFAULT : temp.JSON_DATA);
        }
Exemplo n.º 6
0
 public static void setDistrict()
 {
     if (Constants.isSameVersion())
     {
         SessionTable temp = App.Database.GetItem(DBConstants.ID_DISTRICTS);
         if (temp != null)
         {
             districts = JArray.Parse(temp.JSON_DATA).ToObject <List <District> >();
         }
     }
     else
     {
         districts = MetaDataService.getInstance().CallGetDistricts().districts;
         if (districts == null)
         {
             flagUpdateAppVersion = flagUpdateAppVersion & false;
         }
         else
         {
             saveDistricts();
         }
     }
     districts = (districts == null) ? new List <District>() : districts;
 }
Exemplo n.º 7
0
 public static void setProvinces()
 {
     if (Constants.isSameVersion())
     {
         SessionTable temp = App.Database.GetItem(DBConstants.ID_PROVINCES);
         if (temp != null)
         {
             provinces = JArray.Parse(temp.JSON_DATA).ToObject <List <Province> >();
         }
     }
     else
     {
         provinces = MetaDataService.getInstance().CallGetProvices().provinces;
         if (provinces == null)
         {
             flagUpdateAppVersion = flagUpdateAppVersion & false;
         }
         else
         {
             saveProvinces();
         }
     }
     provinces = (provinces == null) ? new List <Province>() : provinces;
 }
Exemplo n.º 8
0
 public static void setCodeDescriptions()
 {
     if (Constants.isSameVersion())
     {
         SessionTable temp = App.Database.GetItem(DBConstants.ID_CODE_DESCRIPTIONS);
         if (temp != null)
         {
             codeDescriptions = JArray.Parse(temp.JSON_DATA).ToObject <List <CodeDescription> >();
         }
     }
     else
     {
         codeDescriptions = MetaDataService.getInstance().CallGetCodeDescription().codeDescriptions;
         if (codeDescriptions == null)
         {
             flagUpdateAppVersion = flagUpdateAppVersion & false;
         }
         else
         {
             saveCodeDescription();
         }
     }
     codeDescriptions = (codeDescriptions == null) ? new List <CodeDescription>() : codeDescriptions;
 }
Exemplo n.º 9
0
 public static void setServices()
 {
     if (Constants.isSameVersion())
     {
         SessionTable temp = App.Database.GetItem(DBConstants.ID_SERVICES);
         if (temp != null)
         {
             services = JArray.Parse(temp.JSON_DATA).ToObject <List <Service> >();
         }
     }
     else
     {
         services = MetaDataService.getInstance().CallGetBranchServices().services;
         if (services == null)
         {
             flagUpdateAppVersion = flagUpdateAppVersion & false;
         }
         else
         {
             saveServices();
         }
     }
     services = (services == null) ? new List <Service>() : services;
 }
Exemplo n.º 10
0
 public static void setBranches()
 {
     if (Constants.isSameVersion())
     {
         SessionTable temp = App.Database.GetItem(DBConstants.ID_BRANCHES);
         if (temp != null)
         {
             branches = JArray.Parse(temp.JSON_DATA).ToObject <List <Branch> >();
         }
     }
     else
     {
         branches = MetaDataService.getInstance().CallGetBranches().branches;
         if (branches == null)
         {
             flagUpdateAppVersion = flagUpdateAppVersion & false;
         }
         else
         {
             saveBranches();
         }
     }
     branches = (branches == null) ? new List <Branch>() : branches;
 }
Exemplo n.º 11
0
        private static String getUserAppIP()
        {
            SessionTable temp = App.Database.GetItem(DBConstants.ID_IP_USER);

            return((temp == null) ? "" : temp.JSON_DATA);
        }
Exemplo n.º 12
0
        private static Branch getBranchLoginFormDB()
        {
            SessionTable temp = App.Database.GetItem(DBConstants.ID_LOGIN_BRANCH);

            return((temp == null) ? null : JObject.Parse(temp.JSON_DATA).ToObject <Branch>());
        }
Exemplo n.º 13
0
        private static User getUserFormDB()
        {
            SessionTable temp = App.Database.GetItem(DBConstants.ID_LOGIN_USER);

            return((temp == null) ? null : JObject.Parse(temp.JSON_DATA).ToObject <User>());
        }