Example #1
0
        public static void downloadStation()
        {
            String              StationID = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "StationID");
            int                 total     = 0;
            int                 success   = 0;
            StationDao          dao       = new StationDao();
            List <ModelStation> lists     = dao.Select("");

            if (lists != null)
            {
                total = lists.Count;
                logger.Debug("# Start download [STATION] from server.");

                foreach (ModelStation model in lists)
                {
                    List <ModelStation> tmp = dao.SelectOffine(" Where id='" + model.id + "'");
                    if (tmp != null)
                    {
                        if (tmp.Count > 0)
                        {
                        }
                        else
                        {
                            if (dao.InsertOffine(model))
                            {
                                success++;
                            }
                        }
                    }
                }
                logger.Debug("# Summary=> Total Download total: " + total + " success: " + success + " fail: " + (total - success));
                logger.Debug("# End Download data from server.");
            }
        }
Example #2
0
        private void FrmMain_Load(object sender, EventArgs e)
        {
            //check offine mode
            #region Initial variable
            StationID = Convert.ToInt16(ManageLOG.getValueFromRegistry(Configurations.AppRegName, "StationID"));
            if (ManageLOG.getValueFromRegistry(Configurations.AppRegName, "userInfo") != null)
            {
                String[] userInfo = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "userInfo").Split(',');
                staffId     = Convert.ToInt16(userInfo[0]);
                lounge      = Convert.ToInt16(userInfo[1]);
                area        = Convert.ToInt16(userInfo[2]);
                stationName = userInfo[3];
                loungeName  = userInfo[4];
                areaName    = userInfo[5];
            }
            if (ManageLOG.getValueFromRegistry(Configurations.AppRegName, "OnlineStatus") != null)
            {
                onlineStatus = (ManageLOG.getValueFromRegistry(Configurations.AppRegName, "OnlineStatus").Equals("1")) ? true : false;
            }
            #endregion

            lSupport.Text = String.Format(lSupport.Text, ManageLOG.getValueFromRegistry(Configurations.AppRegName, "SupportCATInternet"), "");

            switch (staffModel.user_role)
            {
            case 9:
                lounge_site.Enabled    = true;
                lounge_site.DataSource = (onlineStatus) ? siteDao.Select("") : siteDao.SelectOffine("");
                break;

            default:
                lounge_site.Enabled    = false;
                lounge_site.DataSource = (onlineStatus) ? siteDao.Select(" Where id='" + StationID + "'") : siteDao.SelectOffine(" Where id='" + StationID + "'");
                break;
            }

            L_SITE_DESC.Text = loungeName + "-" + areaName;

            group_id.DataSource = (onlineStatus) ? groupDao.Select("") : groupDao.SelectOffine("");

            if (lounge > 0)
            {
                comboLounge.SelectedValue = lounge;
            }
            if (area > 0)
            {
                comboArea.SelectedValue = area;
            }

            //List<ModelLounge> listLounge = (onlineStatus) ? loungeDao.Select(" Where area_station ='" + StationID + "' and area_lounge='" + lounge + "'") : loungeDao.SelectOffine(" Where area_station ='" + StationID + "' and area_lounge='" + lounge + "'");
            //if (listLounge.Count > 0)
            //{
            //    ModelLounge model1 = new ModelLounge();
            //    model1.id = -1;
            //    //model1.id = "";
            //    model1.lounge_name = "";
            //    listLounge.Insert(0, model1);
            //}
            //comboLounge.DataSource = listLounge;
            //List<ModelArea> listArea = (onlineStatus) ? areaDao.Select(" Where area_station ='" + StationID + "' and area_lounge='" + lounge + "'") : areaDao.SelectOffine(" Where area_station ='" + StationID + "' and area_lounge='" + lounge + "'");
            //if (listArea.Count > 0)
            //{
            //    ModelArea model1 = new ModelArea();
            //    model1.id = -1;
            //    model1.area_code = "";
            //    model1.area_name = "";
            //    listArea.Insert(0, model1);
            //}
            //comboArea.DataSource = listArea;



            refreshData();
        }