Esempio n. 1
0
 public FrmArea()
 {
     InitializeComponent();
     stationDao = new StationDao();
     areaDao    = new AreaDao();
     loungeDao  = new LoungeDao();
 }
Esempio n. 2
0
        private void FrmLoad_Load(object sender, EventArgs e)
        {
            StationDao siteDao = new StationDao();

            lounge_site.DataSource = siteDao.Select("");
            refresh();
        }
Esempio n. 3
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.");
            }
        }
Esempio n. 4
0
        private void FrmAuthenCode_Load(object sender, EventArgs e)
        {
            StationDao siteDao = new StationDao();

            lounge_site.DataSource = siteDao.Select("");
            //initial
            refresh();
        }
Esempio n. 5
0
 public FrmEditProfile(FrmMain main, ModelUser user)
 {
     InitializeComponent();
     userDao   = new UserDao();
     siteDao   = new StationDao();
     roleDao   = new RoleDao();
     this.user = user;
     this.main = main;
 }
Esempio n. 6
0
 public FrmStaff()
 {
     InitializeComponent();
     userDao    = new UserDao();
     staffDao   = new StaffDao();
     stationDao = new StationDao();
     loungeDao  = new LoungeDao();
     roleDao    = new RoleDao();
     areaDao    = new AreaDao();
 }
Esempio n. 7
0
        public void ListStationInfo(string address)
        {
            List <Station> stationList = StationDao.GetStation(address);

            comboSearchStation.Items.Clear();
            foreach (var x in stationList)
            {
                comboSearchStation.Items.Add(x.Name);
            }
        }
Esempio n. 8
0
        public void ListCoordinatesInfo(string station)
        {
            List <StationModel> coordinatesList = StationDao.GetInfo(station);
            double?latitude, longitude;

            foreach (var x in coordinatesList)
            {
                latitude        = x.Latitude;
                longitude       = x.Longitude;
                globalStationId = x.StationId;
                this.bingGeocodeDataProvider.RequestLocationInformation(new GeoPoint((double)latitude, (double)longitude), null);

                MapBubble((double)latitude, (double)longitude);
            }
        }
Esempio n. 9
0
        private void FrmLogin_Load(object sender, EventArgs e)
        {
            StationID = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "StationID");
            String[] userInfo = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "userInfo").Split(',');
            //14,1,26,สนามบินสุวรรณภูมิ Inter,Lounge Inter,Area 1,1,Admin,admin1,admin1

            if (userInfo.Length >= 1)
            {
                staffId = Convert.ToInt32(userInfo[0]);
            }
            if (userInfo.Length >= 2)
            {
                loungeId = Convert.ToInt32(userInfo[1]);
            }
            if (userInfo.Length >= 3)
            {
                areaId = Convert.ToInt32(userInfo[2]);
            }
            if (userInfo.Length >= 4)
            {
                stationName  = userInfo[3];
                station.Text = stationName;
            }
            if (userInfo.Length >= 7)
            {
                roleId = Convert.ToInt32(userInfo[6]);
            }
            if (userInfo.Length >= 8)
            {
                roleName = userInfo[7];
            }
            if (userInfo.Length >= 9)
            {
                username = userInfo[8];
            }
            if (userInfo.Length >= 10)
            {
                password = userInfo[9];
            }

            siteDao   = new StationDao();
            loungeDao = new LoungeDao();
            areaDao   = new AreaDao();
            roleDao   = new RoleDao();

            //Check server is alive
            status = Connection.IsServerConnected();
            //station.DataSource = (status) ? siteDao.Select(" Where id=" + StationID) : siteDao.SelectOffine(" Where id=" + StationID);

            List <ModelLounge> lounges = (status) ? loungeDao.Select(" where l.lounge_station=" + StationID) : loungeDao.SelectOffline(" where l.lounge_station=" + StationID);

            lounge.DataSource = lounges;
            try
            {
                bool bIsLoungeChild = false;
                foreach (ModelLounge l in lounges)
                {
                    if (l.id == loungeId)
                    {
                        bIsLoungeChild = true;
                        break;
                    }
                }
                if (bIsLoungeChild)
                {
                    if (loungeId > 0)
                    {
                        lounge.SelectedValue = loungeId;
                    }
                    else
                    {
                        lounge.SelectedIndex = 0;
                    }
                }
                else
                {
                    lounge.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                //lounge.SelectedIndex = 0;
            }

            List <ModelArea> areas = (status) ? areaDao.Select(" where a.area_station=" + StationID + " and a.area_lounge=" + lounge.SelectedValue) : areaDao.SelectOffine(" where a.area_station=" + StationID + " and a.area_lounge=" + lounge.SelectedValue);

            area.DataSource = areas;
            try
            {
                bool bIsAreaChild = false;
                foreach (ModelArea a in areas)
                {
                    if (a.id == areaId)
                    {
                        bIsAreaChild = true;
                        break;
                    }
                }
                if (bIsAreaChild)
                {
                    if (areaId > 0)
                    {
                        area.SelectedValue = areaId;
                    }
                    else
                    {
                        area.SelectedIndex = 0;
                    }
                }
                else
                {
                    area.SelectedIndex = 0;
                }
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
                //area.SelectedIndex = 0;
            }
            LAPPTITLE.Text    = Application.ProductName;
            LAPPCOMPANY.Text  = Application.CompanyName;
            LUPDATE_DATE.Text = "Version " + Application.ProductVersion;
            UsernameTextBox.Focus();

            if (!status)
            {
                UsernameTextBox.Text = username;
                PasswordTextBox.Text = password;
            }
            lSupport.Text = String.Format(lSupport.Text, ManageLOG.getValueFromRegistry(Configurations.AppRegName, "SupportCATInternet"), "");
        }
Esempio n. 10
0
 public FrmLounge()
 {
     InitializeComponent();
     loungeDao = new LoungeDao();
     siteDao   = new StationDao();
 }
Esempio n. 11
0
 public void ListAddressInfo()
 {
     comboSearchAddress.DataSource = StationDao.GetAddress();
 }
Esempio n. 12
0
        private void initial()
        {
            if (ManageLOG.getValueFromRegistry(Configurations.AppRegName, "userInfo") != null)
            {
                StationDao siteDao   = new StationDao();
                String[]   userInfo  = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "userInfo").Split(',');
                String     StationID = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "StationID");
                if (userInfo[6].Equals("9"))
                {
                    lounge_site.DataSource = siteDao.Select("");
                    lounge_site.Enabled    = true;
                    lounge_site.Text       = userInfo[3];
                }
                else
                {
                    if (!String.IsNullOrEmpty(StationID))
                    {
                        lounge_site.DataSource = siteDao.Select(" where id=" + StationID);
                    }
                }
            }


            String[] conStr = ManageLOG.deCode(ManageLOG.getValueFromRegistry(Configurations.AppRegName, "CON")).Split(';');
            if (conStr.Length == 5)
            {
                SIP.Text  = conStr[0].Split('=')[1];
                DBN.Text  = conStr[1].Split('=')[1];
                UN.Text   = conStr[2].Split('=')[1];
                PASS.Text = conStr[3].Split('=')[1];

                if (ManageLOG.getValueFromRegistry(Configurations.AppRegName, "AutoPrint") != null)
                {
                    if (!ManageLOG.getValueFromRegistry(Configurations.AppRegName, "AutoPrint").Equals(""))
                    {
                        cbPrintAuto.Checked = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "AutoPrint").Equals("False") ? false : true;
                    }
                }
                if (ManageLOG.getValueFromRegistry(Configurations.AppRegName, "AutoGenAutoPrint") != null)
                {
                    if (!ManageLOG.getValueFromRegistry(Configurations.AppRegName, "AutoGenAutoPrint").Equals(""))
                    {
                        cbAutoGenPrintAuto.Checked = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "AutoGenAutoPrint").Equals("False") ? false : true;
                    }
                }
                if (ManageLOG.getValueFromRegistry(Configurations.AppRegName, "ManualGenAutoPrint") != null)
                {
                    if (!ManageLOG.getValueFromRegistry(Configurations.AppRegName, "ManualGenAutoPrint").Equals(""))
                    {
                        cbManualGenPrintAuto.Checked = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "ManualGenAutoPrint").Equals("False") ? false : true;
                    }
                }

                if (ManageLOG.getValueFromRegistry(Configurations.AppRegName, "SupportCATInternet") != null)
                {
                    if (!ManageLOG.getValueFromRegistry(Configurations.AppRegName, "SupportCATInternet").Equals(""))
                    {
                        txtInternetSupport.Text = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "SupportCATInternet");
                    }
                }
                if (ManageLOG.getValueFromRegistry(Configurations.AppRegName, "SupportCATApplication") != null)
                {
                    if (!ManageLOG.getValueFromRegistry(Configurations.AppRegName, "SupportCATApplication").Equals(""))
                    {
                        txtAppSupport.Text = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "SupportCATApplication");
                    }
                }

                if (ManageLOG.getValueFromRegistry(Configurations.AppRegName, "txtWiFiExpire") != null)
                {
                    if (!ManageLOG.getValueFromRegistry(Configurations.AppRegName, "txtWiFiExpire").Equals(""))
                    {
                        txtWiFiExpire.Text = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "txtWiFiExpire");
                    }
                }

                String interval = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "Interval");
                if (interval != null)
                {
                    if (!interval.Equals(""))
                    {
                        txtInterval.Text = interval;
                    }
                }
                String SSIDName = ManageLOG.getValueFromRegistry(Configurations.AppRegName, "SSIDName");
                if (SSIDName != null)
                {
                    txtSSidName.Text = SSIDName;
                }
                groupBox2.Enabled = true;
            }
            else
            {
                groupBox2.Enabled = false;
            }
        }
Esempio n. 13
0
        public static void Main(string[] args)
        {
            //Boolean closeFtp = false;
            //String xx = Configurations.deCode("U0VSVkVSPTIwMi40Ny4yNTAuMjAzO0RBVEFCQVNFPWF1dGhlbmNvZGVkYjtVSUQ9YzExO1BBU1NXT1JEPVBAc3N3MHJkOw==");
            //Console.WriteLine();
            //
            //String xxx = ManageLOG.deCode("U0VSVkVSPTIwMi40Ny4yNTAuMjAzO0RBVEFCQVNFPWF1dGhlbmNvZGVkYjtVSUQ9Y2F0MDE7UEFTU1dPUkQ9UEBzc3cwcmQ7");
            //Console.WriteLine("");
            try
            {
                RadDao radDao = new RadDao();
                // radDao.getAthCodeInfo("628821");
                //Console.WriteLine();

                /*
                 * 0 = Run all station.
                 * format : ????.exe {station} {yyyyMMdd}
                 */
                String _station = args.Length > 0 ? (args[0].Equals("0") ? "" : String.IsNullOrEmpty(args[0]) ? "" : " Where id=" + args[0]) : "";
                Sftp   sftp     = new Sftp("sftp.bangkokair.net", "cat2gos", "C@t2g0s");
                Console.WriteLine("sftp.bangkokair.net Connected. " + DateTime.Now);
                //if (!closeFtp)
                //{
                sftp.Connect(22);
                //}


                DateTime       runDate = args.Length > 0 ? (String.IsNullOrEmpty(args[1]) ? DateTime.Now.AddDays(-1) : new DateTime(Convert.ToInt16(args[1].Substring(0, 4)), Convert.ToInt16(args[1].Substring(4, 2)), Convert.ToInt16(args[1].Substring(6, 2)), 0, 0, 0)) : DateTime.Now.AddDays(-1);//Run pevios day
                TransactionDao tranDao = new TransactionDao();

                StationDao stationDao = new StationDao();
                LoungeDao  loungeDao  = new LoungeDao();
                AreaDao    areaDao    = new AreaDao();

                List <ModelStation> stations = stationDao.Select("" + _station);
                if (stations.Count > 0)
                {
                    foreach (ModelStation station in stations)
                    {
                        if (station.id != 99)
                        {
                            List <ModelLounge> lounges = loungeDao.Select(" Where lounge_station=" + station.id);
                            if (lounges.Count > 0)
                            {
                                foreach (ModelLounge lounge in lounges)
                                {
                                    List <ModelArea> areas = areaDao.Select(" Where area_station=" + station.id + " and area_lounge=" + lounge.id);
                                    if (areas.Count > 0)
                                    {
                                        foreach (ModelArea area in areas)
                                        {
                                            String        PATH_LOCAL = String.Format(@"{0}{1}\Gen log\Log {2} {3}", Configurations.DailyTransactionLogsPath, station.site_code, lounge.lounge_name, area.area_name);
                                            String        PATH_FTP   = String.Format("{0}/Gen log/Log {1} {2}", station.site_code, lounge.lounge_name, area.area_name);
                                            DirectoryInfo di         = new DirectoryInfo(@"" + PATH_LOCAL);
                                            //if (!closeFtp)
                                            //{
                                            if (!di.Exists)
                                            {
                                                di.Create();
                                            }
                                            //Create path on server
                                            sftp.Mkdir(PATH_FTP);
                                            //}

                                            //ignore group_id=32 ==> cat test group.
                                            String cri = "where date(create_date) = date('" + runDate.ToString("yyyy-MM-dd") + "') and LoungePlace=" + station.id + " and LoungeType=" + lounge.id + " and LoungeArea=" + area.id + " and group_id <> 32  order by LoungePlace asc,LoungeType asc,LoungeArea asc,update_date desc";
                                            List <ModelTransaction> lists = tranDao.Select(cri, station.id);

                                            ManageLOG mangeLog = new ManageLOG();
                                            if (lists.Count > 0)
                                            {
                                                mangeLog.fileName   = String.Format(@"{0}\export_{1}.csv", PATH_LOCAL, runDate.ToString("yyyy-MM-dd"));
                                                mangeLog.folderName = PATH_LOCAL;
                                                String header = "No,Username,Type,GenDate,GroupName,Duration,PassengerName,FromCity,ToCity,AirlineCode,FlightNo,DateOfFlight,SeatNo,LoungePlace,LoungeType,LoungeArea,Owner,Begin_Date,Status,Remark,AccessCode,Remark2,LastUpdate,LastUpdateBy";
                                                mangeLog.WriteLog(header);
                                                int seq = 1;
                                                foreach (ModelTransaction transaction in lists)
                                                {
                                                    String athCodeBeginUse = transaction.begin_date.ToString("yyyy-MM-dd HH:mm:ss");
                                                    try
                                                    {
                                                        athCodeBeginUse = radDao.getAthCodeInfo(transaction.ath_id);
                                                    }
                                                    catch (Exception ex)
                                                    {
                                                        logger.Debug("* Skip get begindate of " + station.site_code + ">>" + lounge.lounge_name + ">>" + area.area_name + " ::ID::" + transaction.id);
                                                        logger.Error("*  " + ex.InnerException.Message);
                                                    }


                                                    mangeLog.WriteLog(
                                                        seq + "," +                                                                   //No
                                                        Utils.CustomUtils.RemoveSpecialCharacters(transaction.passenger_name + "" + transaction.flight_no + "" + transaction.seat_no) + "," +
                                                        transaction.type + "," +                                                      //Type
                                                        transaction.create_date.ToString("yyyy-MM-dd HH:mm:ss") + "," +
                                                        transaction.group_idName + "," +                                              //GroupName
                                                        transaction.duration + "," +                                                  //Duration
                                                        Utils.CustomUtils.RemoveSpecialCharacters(transaction.passenger_name) + "," + //PassengerName
                                                        Utils.CustomUtils.RemoveSpecialCharacters(transaction.from_city) + "," +      //FromCity
                                                        Utils.CustomUtils.RemoveSpecialCharacters(transaction.to_city) + "," +        //ToCity
                                                        Utils.CustomUtils.RemoveSpecialCharacters(transaction.airline_code) + "," +   //AirlineCode
                                                        Utils.CustomUtils.RemoveSpecialCharacters(transaction.flight_no) + "," +      //FlightNo
                                                        transaction.date_of_flight.ToString("yyyy-MM-dd HH:mm:ss") + "," +
                                                        Utils.CustomUtils.RemoveSpecialCharacters(transaction.seat_no) + "," +        //SeatNo
                                                        transaction.LoungeSiteCode + "," +                                            //LoungePlace
                                                        transaction.LoungeName + "," +                                                //LoungeType
                                                        transaction.LoungeAreaName + "," +                                            //LoungeArea
                                                        transaction.create_byName + "," +                                             //Owner
                                                        athCodeBeginUse + "," +
                                                        transaction.status + "," +                                                    //Status
                                                        Utils.CustomUtils.RemoveSpecialCharacters(transaction.remark) + "," +         //Remark
                                                        transaction.ath_id + "," +                                                    //AccessCode
                                                        Utils.CustomUtils.RemoveSpecialCharacters(transaction.remakr2) + "," +        //Remark2
                                                        transaction.update_date.ToString("yyyy-MM-dd HH:mm:ss") + "," +
                                                        transaction.update_byName                                                     //LastUpdateBy
                                                        );
                                                    //Update begindate
                                                    tranDao.UpdateBeginDate(transaction, station.id);
                                                    seq++;
                                                }
                                            }
                                            else
                                            {
                                                mangeLog.fileName   = String.Format(@"{0}\export_{1} No data.csv", PATH_LOCAL, runDate.ToString("yyyy-MM-dd"));
                                                mangeLog.folderName = PATH_LOCAL;
                                                mangeLog.WriteLog("");
                                                logger.Debug("Transaction of " + station.site_code + ">>" + lounge.lounge_name + ">>" + area.area_name + " is empty");
                                            }

                                            /*
                                             * TRANSFER FILE TO SERVER.
                                             */
                                            //if (!closeFtp)
                                            //{
                                            sftp.Put(mangeLog.fileName, PATH_FTP);
                                            //}
                                        }
                                    }
                                    else
                                    {
                                        logger.Debug("Area of " + station.site_code + ">>" + lounge.lounge_name + " is empty.");
                                    }
                                }
                            }
                            else
                            {
                                logger.Debug("Lounge of " + station.site_code + " is empty.");
                            }
                        }
                    }
                }
                else
                {
                    logger.Debug("Station is empty.");
                }

                /*
                 * CLOSE FTP
                 */
                sftp.Close();
            }
            catch (Exception ex)
            {
                logger.Error(ex.Message);
            }
        }
Esempio n. 14
0
 public FrmSite()
 {
     InitializeComponent();
     siteDao = new StationDao();
 }