Exemplo n.º 1
0
        public IHttpActionResult GetProductRangeByRange(int ass = 9)
        {
            try
            {
                var items = productRangeRepository.ListByRange(ass);

                var productRanges = new List <ProductRange>();
                foreach (var item in items)
                {
                    productRanges.Add(new ProductRange()
                    {
                        ASS          = item.ProductRangeIdentifier.ASS,
                        CODE         = item.ProductRangeIdentifier.CODE,
                        OMSCHRIJVING = item.OMSCHRIJVING,
                    });
                }

                logger.Log(ErrorType.INFO, "GetProductRangeByRange(" + ass + ")", RequestContext.Principal.Identity.Name, "Total in query: " + productRanges.Count, "api/woood-assortimenten-view/list/id", startDate);

                return(Ok(productRanges));
            }
            catch (Exception e)
            {
                logger.Log(ErrorType.ERR, "GetProductRangeByRange(" + ass + ")", RequestContext.Principal.Identity.Name, e.Message, "api/woood-assortimenten-view/list/id");

                return(InternalServerError(e));
            }
        }
Exemplo n.º 2
0
        public IHttpActionResult GetSellingPoints()
        {
            try
            {
                var items = sellingPointRepository.List();

                var sellingPoints = new List <SellingPoint>();
                foreach (var item in items)
                {
                    sellingPoints.Add(new SellingPoint()
                    {
                        ARTIKELCODE                = item.SellingPointIdentifier.ARTIKELCODE,
                        FACTUURDEBITEURNR          = item.SellingPointIdentifier.FACTUURDEBITEURNR,
                        FACTUURDEBITEURNAAM        = item.FACTUURDEBITEURNAAM,
                        FACTUURDEBITEUR_NAAM_ALIAS = item.FACTUURDEBITEUR_NAAM_ALIAS,
                        FACTUURDEBITEURWEB         = item.FACTUURDEBITEURWEB,
                        FACTUURDEBITEUR_WEB_ALIAS  = item.FACTUURDEBITEUR_WEB_ALIAS,
                        FACTUURDEBITEURLAND        = item.FACTUURDEBITEURLAND,
                    });
                }

                logger.Log(ErrorType.INFO, "GetSellingPoints()", RequestContext.Principal.Identity.Name, "Total in query: " + items.Count(), "api/woood-verkooppunt-view/list", startDate);

                return(Ok(sellingPoints));
            }
            catch (Exception e)
            {
                logger.Log(ErrorType.ERR, "GetSellingPoints()", RequestContext.Principal.Identity.Name, e.Message, "api/woood-verkooppunt-view/list");

                return(InternalServerError(e));
            }
        }
        public void Log_Verbose_LogData_EmitsExpectedEvent()
        {
            string eventName            = string.Empty;
            string details              = string.Empty;
            string message              = "TestMessage";
            string functionInvocationId = Guid.NewGuid().ToString();
            string activityId           = Guid.NewGuid().ToString();
            var    scopeState           = new Dictionary <string, object>
            {
                [ScriptConstants.LogPropertyFunctionInvocationIdKey] = functionInvocationId
            };

            _mockEventGenerator.Setup(p => p.LogFunctionTraceEvent(LogLevel.Debug, _subscriptionId, _websiteName, _functionName, eventName, _category, details, message, string.Empty, string.Empty, functionInvocationId, _hostInstanceId, activityId));

            var logData = new Dictionary <string, object>
            {
                [ScriptConstants.LogPropertyActivityIdKey] = activityId
            };

            using (_logger.BeginScope(scopeState))
            {
                _logger.Log(LogLevel.Debug, 0, logData, null, (state, ex) => message);
            }

            _mockEventGenerator.VerifyAll();
        }
Exemplo n.º 4
0
        public IHttpActionResult GetPricelists(int page, int limit = 25)
        {
            try
            {
                var result = pricelistRepository.List("DEBITEURNR_ASC", limit, page);

                var pricelists = new List <Pricelist>();
                foreach (var item in result.Results)
                {
                    pricelists.Add(NewPricelist(item));
                }

                var collection = new PagedCollection <Pricelist>()
                {
                    _embedded   = pricelists,
                    page_size   = result.PageSize,
                    page        = result.CurrentPage,
                    total_items = result.RowCount,
                    page_count  = result.PageCount
                };

                logger.Log(ErrorType.INFO, "GetPricelists()", RequestContext.Principal.Identity.Name, "Total in query: " + pricelists.Count(), "api/woood-pricelist/list", startDate);

                return(Ok(collection));
            }
            catch (Exception e)
            {
                logger.Log(ErrorType.ERR, "GetPricelists()", RequestContext.Principal.Identity.Name, e.Message, "api/woood-pricelist/list");

                return(InternalServerError(e));
            }
        }
Exemplo n.º 5
0
        public IHttpActionResult GetPagedDebtorOrders(int page, int limit = 25)
        {
            try
            {
                var items = debtorOrderRepository.List("DEBITEURNR_ASC", limit, page);

                var orders = new List <DebtorOrder>();
                foreach (var order in items.Results)
                {
                    orders.Add(new DebtorOrder()
                    {
                        ORDERNR         = order.ORDERNR,
                        DEBNR           = order.DEBNR,
                        FAKDEBNR        = order.FAKDEBNR,
                        REFERENTIE      = order.REFERENTIE,
                        OMSCHRIJVING    = order.OMSCHRIJVING,
                        ORDDAT          = order.ORDDAT.ToString("yyyy-MM-dd HH:mm:ss"),
                        AANTAL_BESTELD  = order.AANTAL_BESTELD,
                        ITEMCODE        = order.ITEMCODE,
                        AFLEVERDATUM    = order.AFLEVERDATUM.ToString("yyyy-MM-dd HH:mm:ss"),
                        OMSCHRIJVING_NL = order.OMSCHRIJVING_NL,
                        OMSCHRIJVING_EN = order.OMSCHRIJVING_EN,
                        OMSCHRIJVING_DE = order.OMSCHRIJVING_DE,
                        AANTAL_GELEV    = order.AANT_GELEV,
                        STATUS          = order.STATUS,
                        DEL_LANDCODE    = order.DEL_LANDCODE.Trim(),
                        SELCODE         = order.SELCODE,
                        PRIJS_PER_STUK  = order.PRIJS_PER_STUK,
                        SUBTOTAAL       = order.SUBTOTAAL
                    });
                }

                var collection = new PagedCollection <DebtorOrder>()
                {
                    _embedded   = orders,
                    page_size   = items.PageSize,
                    page        = items.CurrentPage,
                    total_items = items.RowCount,
                    page_count  = items.PageCount
                };

                logger.Log(ErrorType.INFO, "GetPagedDebtorOrders()", RequestContext.Principal.Identity.Name, "Total in query: " + items.Results.Count, "api/woood-deb-order-info/list", startDate);

                return(Ok(collection));
            }
            catch (Exception e)
            {
                logger.Log(ErrorType.ERR, "GetPagedDebtorOrders()", RequestContext.Principal.Identity.Name, e.Message, "api/woood-deb-order-info/list");

                return(InternalServerError(e));
            }
        }
Exemplo n.º 6
0
        private UILocalNotification PrepareLocalNotification(NotificationData notification)
        {
            if (notification != null)
            {
                UILocalNotification localNotification = new UILocalNotification();
                localNotification.AlertBody = notification.AlertMessage;
                localNotification.ApplicationIconBadgeNumber = notification.Badge;
                localNotification.SoundName = UILocalNotification.DefaultSoundName;                 // defaults
                if (notification.Sound != null && notification.Sound.Length > 0 && !notification.Sound.Equals("default"))
                {
                    // for sounds different from the default one
                    localNotification.SoundName = notification.Sound;
                }
                if (notification.CustomDataJsonString != null && notification.CustomDataJsonString.Length > 0)
                {
                    SystemLogger.Log(SystemLogger.Module.PLATFORM, "Custom Json String received: " + notification.CustomDataJsonString);

                    Dictionary <String, Object> userDictionary = (Dictionary <String, Object>)IPhoneUtils.GetInstance().JSONDeserialize <Dictionary <String, Object> >(notification.CustomDataJsonString);
                    localNotification.UserInfo = IPhoneUtils.GetInstance().ConvertToNSDictionary(userDictionary);
                }
                return(localNotification);
            }
            else
            {
                return(null);
            }
        }
Exemplo n.º 7
0
 public override void CancelLocalNotification(DateTime fireDate)
 {
     UIApplication.SharedApplication.InvokeOnMainThread(delegate {
         int numScheduledLocalNotifications = this.GetCurrentScheduledLocalNotifications();
         if (numScheduledLocalNotifications <= 0)
         {
             SystemLogger.Log(SystemLogger.Module.PLATFORM, "No scheduled local notifications found. It is not possible to cancel the one requested");
         }
         else
         {
             SystemLogger.Log(SystemLogger.Module.PLATFORM, "(1) Current scheduled #num of local notifications: " + numScheduledLocalNotifications);
             NSDate fireDateNS = IPhoneUtils.DateTimeToNSDate(DateTime.SpecifyKind(fireDate, DateTimeKind.Local));
             SystemLogger.Log(SystemLogger.Module.PLATFORM, "Checking local notification to be cancelled, scheduled at " + fireDateNS.ToString());
             foreach (UILocalNotification notification in UIApplication.SharedApplication.ScheduledLocalNotifications)
             {
                 if (notification.FireDate.SecondsSinceReferenceDate == fireDateNS.SecondsSinceReferenceDate)
                 {
                     SystemLogger.Log(SystemLogger.Module.PLATFORM, "Cancelling notification scheduled at: " + notification.FireDate.ToString());
                     UIApplication.SharedApplication.CancelLocalNotification(notification);
                     SystemLogger.Log(SystemLogger.Module.PLATFORM, "Cancelled");
                 }
             }
             SystemLogger.Log(SystemLogger.Module.PLATFORM, "(2) Current scheduled #num of local notifications: " + this.GetCurrentScheduledLocalNotifications());
         }
     });
 }
Exemplo n.º 8
0
        private byte[] GetResourceAsBinaryFromFile(string resourcePath)
        {
            SystemLogger.Log(SystemLogger.Module.PLATFORM, "# Loading resource from file: " + resourcePath);

            try {
                //Stopwatch stopwatch = new Stopwatch();
                //stopwatch.Start();

                NSData data = NSData.FromFile(resourcePath);

                if (data == null)
                {
                    SystemLogger.Log(SystemLogger.Module.PLATFORM, "File not available at path: " + resourcePath);
                }
                else
                {
                    byte[] buffer = new byte[data.Length];
                    Marshal.Copy(data.Bytes, buffer, 0, buffer.Length);

                    return(buffer);
                }

                //stopwatch.Stop();
                //SystemLogger.Log(SystemLogger.Module.PLATFORM, "CSV not-zipped," + resourcePath + ","+ stopwatch.ElapsedMilliseconds);
            } catch (Exception ex) {
                SystemLogger.Log(SystemLogger.Module.PLATFORM, "Error trying to get file binary data [" + resourcePath + "]", ex);
            }

            return(new byte[0]);
        }
Exemplo n.º 9
0
        private NSUrl GetNSUrlFromPath(string path, bool localPath)
        {
            NSUrl nsUrl = null;

            SystemLogger.Log(SystemLogger.Module.PLATFORM, "Getting nsurl from path: " + path);
            try {
                if (localPath)
                {
                    // check resource from local file system
                    //nsUrl = NSUrl.FromFilename(path);
                    nsUrl = IPhoneUtils.GetInstance().GetNSUrlFromPath(path);
                }
                else
                {
                    // check remote resource.
                    // remote paths should be escaped using Uri format
                    path  = Uri.EscapeUriString(path);
                    nsUrl = NSUrl.FromString(path);
                    SystemLogger.Log(SystemLogger.Module.PLATFORM, "nsUrl from remote string: " + nsUrl);
                }
            } catch (Exception) {
                SystemLogger.Log(SystemLogger.Module.PLATFORM, "Error trying to get media file [" + path + "]");
            }

            return(nsUrl);
        }
Exemplo n.º 10
0
 public void log(string message)
 {
     if (IsLogging)
     {
         SystemLogger.Log(SystemLogger.Module.GUI, "ViewController: " + message);
     }
 }
Exemplo n.º 11
0
        public DataSet WcsProcedureCallGetDataSet(string procedureName, List <OracleParameter> listParams, string[] args)
        {
            DataSet dsResult = null;

            try
            {
                using (OracleConnection oracleConnection = new OracleConnection(connectionString))
                {
                    DateTime fromdt = DateTime.Now;
                    oracleConnection.Open();

                    OracleDataAdapter oracleDataAdapter = new OracleDataAdapter();
                    OracleCommand     oracleCommand     = new OracleCommand(procedureName, oracleConnection);
                    oracleCommand.CommandType = CommandType.StoredProcedure;
                    oracleCommand.Parameters.Clear();
                    oracleCommand.CommandTimeout = 60;

                    string parameterLog = string.Empty;

                    foreach (OracleParameter para in listParams)
                    {
                        oracleCommand.Parameters.Add(para);
                        parameterLog += " /" + para.Value;
                    }
                    SystemLogger.Log(Level.Info, string.Format("[{0}] Parameter Values {1}", procedureName, parameterLog), "DB");

                    oracleDataAdapter.SelectCommand = oracleCommand;
                    dsResult = new DataSet();
                    oracleDataAdapter.Fill(dsResult);

                    DataTable dt = new DataTable("table");
                    for (int i = 0; i < args.Length; i++)
                    {
                        dt.Columns.Add(args[i]);
                    }

                    // 라벨러 용
                    dt.Rows.Add(oracleCommand.Parameters[args[0]].Value.ToString()
                                , oracleCommand.Parameters[args[1]].Value.ToString()
                                , oracleCommand.Parameters[args[2]].Value.ToString());

                    dsResult.Tables.Add(dt);

                    oracleConnection.Close();

                    DateTime todt = DateTime.Now;
                    TimeSpan ddd  = todt - fromdt;
                    if (ddd.Seconds > 1)
                    {
                        SystemLogger.Log(Level.Verbose, string.Format("{0} - Dely Time : {1}", procedureName, ddd.TotalMilliseconds), "DB_Warning");
                    }
                }
                return(dsResult);
            }
            catch (Exception ex)
            {
                SystemLogger.Log(Level.Exception, ex.Message, "DB_Exception");
                return(null);
            }
        }
        public override void RegisterForRemoteNotifications(string senderId, RemoteNotificationType[] types)
        {
            SystemLogger.Log(SystemLogger.Module.PLATFORM, "Registering senderId [" + senderId + "] for receiving  push notifications");

            UIApplication.SharedApplication.InvokeOnMainThread(delegate {
                UIRemoteNotificationType notificationTypes = UIRemoteNotificationType.None;
                try {
                    if (types != null)
                    {
                        SystemLogger.Log(SystemLogger.Module.PLATFORM, "Remote Notifications types enabled #num : " + types.Length);
                        foreach (RemoteNotificationType notificationType in types)
                        {
                            notificationTypes = notificationTypes | rnTypes[notificationType];
                        }
                    }

                    SystemLogger.Log(SystemLogger.Module.PLATFORM, "Remote Notifications types enabled: " + notificationTypes);

                    //This tells our app to go ahead and ask the user for permission to use Push Notifications
                    // You have to specify which types you want to ask permission for
                    // Most apps just ask for them all and if they don't use one type, who cares
                    UIApplication.SharedApplication.RegisterForRemoteNotificationTypes(notificationTypes);
                } catch (Exception e) {
                    SystemLogger.Log(SystemLogger.Module.PLATFORM, "Exception ocurred: " + e.Message);
                }
            });
        }
Exemplo n.º 13
0
        public override void GetStoredKeyValuePairs(string[] keynames)
        {
            UIApplication.SharedApplication.InvokeOnMainThread(delegate {
                string sAccessGroup          = KeyChainAccessGroup;
                List <KeyPair> foundKeyPairs = new List <KeyPair>();
                foreach (string key in keynames)
                {
                    SecRecord srSearchCriteria = new SecRecord(SecKind.GenericPassword)
                    {
                        Account = key
                    };

                    if (sAccessGroup != null)
                    {
                        srSearchCriteria.AccessGroup = sAccessGroup;
                    }

                    SecStatusCode keyResult;
                    SecRecord srFoundKey = SecKeyChain.QueryAsRecord(srSearchCriteria, out keyResult);
                    if (keyResult == SecStatusCode.Success)
                    {
                        if (srFoundKey != null)
                        {
                            foundKeyPairs.Add(SecRecordToKeyPair(srFoundKey));
                        }
                    }
                }

                SystemLogger.Log(SystemLogger.Module.PLATFORM, "GetStoredKeyValuePairs - Found: " + foundKeyPairs.Count);

                IPhoneUtils.GetInstance().FireUnityJavascriptEvent("Appverse.OnKeyValuePairsFound", foundKeyPairs);
            });
        }
Exemplo n.º 14
0
        /// <summary>
        /// Loads the module (try to update it first if 'autUpdate' argument is set to true). Update is "silent", no event listener is called.
        /// </summary>
        /// <param name="module">Module to be loaded.</param>
        /// <param name="moduleParams">Module parameters.</param>
        /// <param name="autoUpdate">True to first update the module, prior to be loaded. False is the default value.</param>
        public override void LoadModule(Module module, ModuleParam[] moduleParams, bool autoUpdate)
        {
            if (autoUpdate)
            {
                // show activity indicator
                this.GetNotificationService().StartNotifyActivity();
                this.GetNotificationService().StartNotifyLoading(this.GetLocalizedMessage(DEFAULT_LOADING_MESSAGE_UPDATE_MODULE));

                if (module != null)
                {
                    bool success = this.UpdateOrInstallModule(module);
                    if (success)
                    {
                        SystemLogger.Log(SystemLogger.Module.PLATFORM, "[LoadModule#autoUpdate] The module [ " + module.Id + "] was successfully updated");
                    }
                    else
                    {
                        SystemLogger.Log(SystemLogger.Module.PLATFORM, "[LoadModule#autoUpdate] The module [ " + module.Id + "] was NOT successfully updated");
                    }
                }

                // hide activity indicator
                this.GetNotificationService().StopNotifyActivity();
                this.GetNotificationService().StopNotifyLoading();
            }

            // Load the just updated (or not) module.
            this.LoadModule(module, moduleParams);
        }
Exemplo n.º 15
0
        /// <summary>
        /// Lists the installed modules.
        /// </summary>
        /// <returns>The installed modules.</returns>
        public override Module[] ListInstalledModules()
        {
            List <Module> list = new List <Module> ();

            string ModulesPath = this.GetModulesRootPath();

            SystemLogger.Log(SystemLogger.Module.PLATFORM, "Listing installed modules under path: " + ModulesPath);

            DirectoryData modulesDirectory = new DirectoryData(ModulesPath);

            if (this.GetFileSystemService().ExistsDirectory(modulesDirectory))
            {
                DirectoryData[] apps = this.GetFileSystemService().ListDirectories(modulesDirectory);
                foreach (DirectoryData app in apps)
                {
                    SystemLogger.Log(SystemLogger.Module.PLATFORM, "directory: " + app.FullName);
                    DirectoryData[] versions = this.GetFileSystemService().ListDirectories(app);

                    foreach (DirectoryData version in versions)
                    {
                        SystemLogger.Log(SystemLogger.Module.PLATFORM, "version: " + version.FullName);
                        Module module = new Module();
                        module.Id      = Path.GetFileName(app.FullName);
                        module.Version = this.ParseModuleVersion(Path.GetFileName(version.FullName));
                        list.Add(module);
                    }
                }
            }
            else
            {
                SystemLogger.Log(SystemLogger.Module.PLATFORM, "Modules directory does not exists: " + ModulesPath);
            }

            return(list.ToArray());
        }
Exemplo n.º 16
0
        /// <summary>
        /// Updates the module.
        /// </summary>
        /// <param name="module">Module.</param>
        /// <param name="callbackId">An identifier to be returned on the event listener in order to identify this request.</param>
        public override void UpdateModule(Module module, string callbackId)
        {
            List <Module> successlist = new List <Module> ();
            List <Module> failedlist  = new List <Module> ();

            // show activity indicator
            this.GetNotificationService().StartNotifyActivity();
            this.GetNotificationService().StartNotifyLoading(this.GetLocalizedMessage(DEFAULT_LOADING_MESSAGE_UPDATE_MODULE));

            if (module != null)
            {
                bool success = this.UpdateOrInstallModule(module);
                if (success)
                {
                    SystemLogger.Log(SystemLogger.Module.PLATFORM, "The module [ " + module.Id + "] was successfully updated");
                    successlist.Add(module);
                }
                else
                {
                    SystemLogger.Log(SystemLogger.Module.PLATFORM, "The module [ " + module.Id + "] was NOT successfully updated");
                    failedlist.Add(module);
                }
            }

            UIApplication.SharedApplication.InvokeOnMainThread(delegate {
                IPhoneUtils.GetInstance().FireUnityJavascriptEvent("Appverse.AppLoader.onUpdateModulesFinished",
                                                                   new object [] { successlist.ToArray(), failedlist.ToArray(), callbackId });
            });

            // hide activity indicator
            this.GetNotificationService().StopNotifyActivity();
            this.GetNotificationService().StopNotifyLoading();
        }
        /// <summary>
        /// Invokes the given service method, by using an array of invocation params.
        /// </summary>
        /// <param name="service">Service bean.</param>
        /// <param name="methodName">Method to be invoeked.</param>
        /// <param name="invokeParams">Invocation params (array)</param>
        /// <returns>Result in byte array.</returns>
        public override byte[] InvokeService(Object service, string methodName, object[] invokeParams)
        {
            byte[] result = null;

            object retObj = null;

            try {
                retObj = InvokeServiceMethod(service, methodName, invokeParams);
            } catch (Exception ex) {
                SystemLogger.Log(SystemLogger.Module.CORE, "ServiceInvocationManager - Exception invoking method [" + methodName + "]. Exception message: " + ex.Message);
            }

            _latestCacheControlHeader = null;

            if (service != null && typeof(IIo).IsAssignableFrom(service.GetType()))
            {
                SystemLogger.Log(SystemLogger.Module.CORE, "For I/O Services, check cache control header from remote server");
                _latestCacheControlHeader = GetCacheControlHeaderFromObject(retObj);
            }

            if (retObj != null)
            {
                result = Encoding.UTF8.GetBytes(ToJSONString(retObj));
            }

            return(result);
        }
Exemplo n.º 18
0
        public void ExecuteJavascriptCallback(string callbackFunction, string id, string jsonResultString)
        {
            string jsCallbackFunction = "try{if(" + callbackFunction + "){" + callbackFunction + "(" + jsonResultString + ", '" + id + "');}}catch(e) {console.log('error executing javascript callback: ' + e)}";

            SystemLogger.Log(SystemLogger.Module.PLATFORM, "ExecuteJavascriptCallback: " + callbackFunction);
            IPhoneServiceLocator.CurrentDelegate.EvaluateJavascript(jsCallbackFunction);
        }
Exemplo n.º 19
0
        public int ExecuteNonQuerywithParam(string sp_procedure, List <SqlParameter> listParam)
        {
            int result = -1;

            try
            {
                using (SqlConnection connection = new SqlConnection(connectionString))
                {
                    using (SqlCommand command = new SqlCommand())
                    {
                        command.Connection  = connection;
                        command.CommandType = CommandType.StoredProcedure;
                        command.CommandText = sp_procedure;

                        foreach (SqlParameter item in listParam)
                        {
                            command.Parameters.Add(item);
                        }

                        command.Parameters.Add("@ErrorMessage", SqlDbType.VarChar, 200);
                        command.Parameters["@ErrorMessage"].Direction = ParameterDirection.Output;

                        connection.Open();
                        result = command.ExecuteNonQuery();
                        connection.Close();
                    }
                }
                return(result);
            }
            catch (Exception ex)
            {
                SystemLogger.Log(Level.Exception, ex.Message);
                return(result);
            }
        }
Exemplo n.º 20
0
        public override NetworkData GetNetworkData()
        {
            try{
                NetworkInterface intf = NetworkInterface.GetAllNetworkInterfaces().First(x => x.Name.ToLower().Equals(NETWORKINTERFACE_WIFI)) as NetworkInterface;
                intf = (intf == null || (intf != null && intf.GetIPProperties().UnicastAddresses.Count == 0) ? NetworkInterface.GetAllNetworkInterfaces().First(x => x.Name.ToLower().Equals(NETWORKINTERFACE_3G)) as NetworkInterface : intf);
                if (intf != null && intf.GetIPProperties().UnicastAddresses.Count > 0)
                {
                    NetworkData returnData = new NetworkData();
                    foreach (var addrInfo in intf.GetIPProperties().UnicastAddresses)
                    {
                        switch (addrInfo.Address.AddressFamily)
                        {
                        case System.Net.Sockets.AddressFamily.InterNetwork:
                            //IPv4
                            returnData.IPv4 = addrInfo.Address.ToString();
                            break;

                        case System.Net.Sockets.AddressFamily.InterNetworkV6:
                            //IPv6
                            returnData.IPv6 = addrInfo.Address.ToString();
                            if (returnData.IPv6.Contains("%"))
                            {
                                returnData.IPv6 = returnData.IPv6.Split('%')[0];
                            }
                            break;

                        default:
                            break;
                        }
                    }
                    return(returnData);
                }
            }catch (Exception ex) { SystemLogger.Log(SystemLogger.Module.PLATFORM, "Error found while retrieving NetworkData", ex); }
            return(null);
        }
Exemplo n.º 21
0
        public override bool CopyFromRemote(string url, string toPath)
        {
            try {
                // delete file if already exists
                string path = Path.Combine(this.GetDirectoryRoot().FullName, toPath);
                //TODO Review
                if (!CheckSecurePath(path))
                {
                    return(false);
                }
                NSUrl  nsurl = new NSUrl(url);
                NSData data  = NSData.FromUrl(nsurl);
                if (data != null)
                {
                    // remove previous existing file
                    if (File.Exists(path))
                    {
                        this.DeleteFile(new FileData(path));
                    }
                    // create an empty file
                    FileData toFile = this.CreateFile(toPath);

                    byte[] buffer = new byte[data.Length];
                    Marshal.Copy(data.Bytes, buffer, 0, buffer.Length);
                    // write contents and return result
                    return(this.WriteFile(toFile, buffer, false));
                }
                // don't create/replace any file if NSData couldn't be obtained from remote path
            } catch (Exception ex) {
                SystemLogger.Log(SystemLogger.Module.PLATFORM, "Error copying from [" + url + "] to file [" + toPath + "]", ex);
            }
            return(false);
        }
Exemplo n.º 22
0
        protected override byte[] GetRawContentFromFileStream(string filePath)
        {
            SystemLogger.Log(SystemLogger.Module.PLATFORM, "# IPhoneResourceHandler. Getting Raw Content From FileStream on file path: " + filePath);

            // assuming that this method is just called for accessing web resources
            return(IPhoneUtils.GetInstance().GetResourceAsBinary(filePath, true));
        }
Exemplo n.º 23
0
        public override void RemoveStoredKeyValuePairs(string[] keynames)
        {
            string        sAccessGroup        = KeyChainAccessGroup;
            List <string> successfullKeyPairs = new List <string>();
            List <string> failedKeyPairs      = new List <string>();

            UIApplication.SharedApplication.InvokeOnMainThread(delegate {
                foreach (string keyname in keynames)
                {
                    SecRecord srDeleteEntry = new SecRecord(SecKind.GenericPassword)
                    {
                        Account = keyname
                    };

                    if (sAccessGroup != null)
                    {
                        srDeleteEntry.AccessGroup = sAccessGroup;
                    }

                    SecStatusCode code = SecKeyChain.Remove(srDeleteEntry);
                    if (code == SecStatusCode.Success)
                    {
                        successfullKeyPairs.Add(keyname);
                    }
                    else
                    {
                        failedKeyPairs.Add(keyname);
                    }
                }
                SystemLogger.Log(SystemLogger.Module.PLATFORM, "RemoveStoredKeyValuePair - Success: " + successfullKeyPairs.Count + ", Failed: " + failedKeyPairs.Count);

                IPhoneUtils.GetInstance().FireUnityJavascriptEvent("Appverse.OnKeyValuePairsRemoveCompleted", new object[] { successfullKeyPairs, failedKeyPairs });
            });
        }
Exemplo n.º 24
0
        private string evalDefaultLanguageCountry()
        {
            bool   isFound = false;
            string languageAndCountryId = string.Empty;

            if (File.Exists(I18NConfigFile))
            {
                try {
                    XmlTextReader reader = new XmlTextReader(I18NConfigFile);
                    try {
                        while ((reader.Read() && !isFound))
                        {
                            XmlNodeType nodeType = reader.NodeType;
                            if ((nodeType == XmlNodeType.Element) && (reader.Name == DEFAULT_TAG))
                            {
                                languageAndCountryId = readAttribute(reader, ID_TAG);
                                isFound = true;
                            }
                        }
                    } finally {
                        reader.Close();
                    }
                } catch (UriFormatException e) {
#if DEBUG
                    SystemLogger.Log(SystemLogger.Module.CORE, "# loadSettings. Getting Content From XmlReader on file path: " + I18NConfigFile + ":" + e.Message);
#endif
                }
            }
            return(languageAndCountryId);
        }
Exemplo n.º 25
0
            public ILogger CreateLogger()
            {
                SystemLogger systemLogger = new SystemLogger();

                systemLogger.Log();
                return(systemLogger);
            }
Exemplo n.º 26
0
        public override bool Play(string filePath)
        {
            // File path is relative path.
            string absolutePath = IPhoneUtils.GetInstance().GetFileFullPath(filePath);

            if (!File.Exists(absolutePath))
            {
                // file path was not under application bundle path
                // try to find it under Documents folder
                if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0))
                {
                    var documents = NSFileManager.DefaultManager.GetUrls(NSSearchPathDirectory.DocumentDirectory, NSSearchPathDomain.User) [0].Path;
                    absolutePath = Path.Combine(documents, filePath);
                }
                else
                {
                    var documents = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                    absolutePath = Path.Combine(documents, filePath);
                };
                //absolutePath = Path.Combine(IPhoneFileSystem.DEFAULT_ROOT_PATH, filePath);
                SystemLogger.Log(SystemLogger.Module.PLATFORM, "Media file does not exist on bundle path, checking under application documents: " + absolutePath);
            }

            NSUrl nsUrl = this.GetNSUrlFromPath(absolutePath, true);

            return(this.PlayNSUrl(nsUrl));
        }
Exemplo n.º 27
0
        // 시뮬레이션 테이블을 이용하지 않고 tb_srt_box_rslt 테이블을 이용한다.      CP, BC 같이 사용한다면, 같은 바코드가 동시에 들어온다면 틀릴 가능성이 존재, 프로시져로 작성해서  회사, 센터 코드 를 이용할 필요 있음  (리팩토링 필요)
        public DataSet GetRecentDestination(string bcd_info)
        {
            DataSet dsResult;
            string  dbQuery =
                "SELECT pid, plan_cd, box_bcd, rgn_bcd, bcd_info, plan_chute_id1, plan_chute_id2, plan_chute_id3, scan_dt, rslt_chute_id, srt_wrk_stat_cd, srt_wrk_cmpt_dt, srt_err_cd, srt_rsn_cd" +
                "  FROM   (SELECT * " +
                "            FROM tb_srt_box_rslt " +
                "           WHERE bcd_info = : P_BCD_INFO " +
                "           ORDER BY upd_dt desc ) a" +
                " WHERE rownum = 1";

            try
            {
                OracleParameter[] oracleParameters = new OracleParameter[1];
                oracleParameters[0] = new OracleParameter("P_BCD_INFO", OracleDbType.Varchar2, bcd_info, ParameterDirection.Input);

                dsResult = ExecuteQuery(dbQuery, "tb_srt_box_rslt", oracleParameters);
            }
            catch (Exception ex)
            {
                SystemLogger.Log(Level.Exception, ex.Message, "GetRecentDestination");
                MessageBox.Show("조회하는데 Error가 생겼습니다.");
                // getLog를 실행시키기 위함
                throw ex;
            }
            return(dsResult);
        }
Exemplo n.º 28
0
        private byte[] GetResourceAsBinaryFromZipped(string resourcePath)
        {
            if (_zipFile != null)
            {
                SystemLogger.Log(SystemLogger.Module.PLATFORM, "# Loading resource from zipped file: " + resourcePath);
                //Stopwatch stopwatch = new Stopwatch();
                //stopwatch.Start();

                ZipEntry entry = this.GetZipEntry(resourcePath);                  // getting the entry from the _zipFile.GetEntry() method is less efficient
                if (entry != null)
                {
                    //SystemLogger.Log(SystemLogger.Module.PLATFORM, "# entry found [" + entry.Name + "]: " + entry.Size);

                    //long et1 = stopwatch.ElapsedMilliseconds;
                    Stream entryStream = _zipFile.GetInputStream(entry);

                    //long et2 = stopwatch.ElapsedMilliseconds;

                    // entryStream is not seekable, it should be first readed
                    byte[] data = IPhoneUtils.ConvertNonSeekableStreamToByteArray(entryStream);                     //, entry.Size
                    //SystemLogger.Log(SystemLogger.Module.PLATFORM, "# entry found [" + entry.Name + "], data byte array size:" + data.Length);

                    //long et3 = stopwatch.ElapsedMilliseconds;
                    //SystemLogger.Log(SystemLogger.Module.PLATFORM, "CSV," + resourcePath + "," + entry.Size + "," + entry.CompressedSize + ","+ et1 +","+(et2-et1)+","+(et3-et2)+","+(et3));
                    //stopwatch.Stop();
                    return(data);
                }

                //stopwatch.Stop();
            }

            return(null);
        }
        protected object InvokeServiceMethod(Object service, string methodName, object[] invokeParams)
        {
            object result = null;

            if (service != null)
            {
                Type type = service.GetType();
                SystemLogger.Log(SystemLogger.Module.CORE, "### Service to Invoke: " + type);
                SystemLogger.Log(SystemLogger.Module.CORE, "### Invocation method: " + methodName);
                try {
                    // Get method invocation parameters, if any.
                    object[] methodParams = GetMethodParameters(type, methodName, invokeParams);
                    SystemLogger.Log(SystemLogger.Module.CORE, "### Invocation method params length: " + ((methodParams != null) ? methodParams.Length : 0));

                    // Invoke service.
                    result = type.InvokeMember(methodName, BindingFlags.InvokeMethod, Type.DefaultBinder, service, methodParams);
                } catch (Exception e) {
                    SystemLogger.Log(SystemLogger.Module.CORE, "Exception invoking method [" + methodName + "]", e);
                    // Throw exception up (to be catched at service handler level).
                    throw e;
                }
            }
            else
            {
                SystemLogger.Log(SystemLogger.Module.CORE, "No service object received to invoke.");
            }

            return(result);
        }
Exemplo n.º 30
0
 void HandleImagePickerControllerFinishedPickingImage(object sender, UIImagePickerImagePickedEventArgs e)
 {
     UIApplication.SharedApplication.InvokeOnMainThread(delegate {
         SystemLogger.Log(SystemLogger.Module.PLATFORM, "FinishedPickingImage " + e.Image);
         IPhoneServiceLocator.CurrentDelegate.MainUIViewController().DismissModalViewController(true);
     });
 }