Example #1
0
        public HttpResponseMessage GetMobileProcesses()
        {
            ATISMobileWebApi WebAPi = new ATISMobileWebApi();

            try
            {
                //تایید اعتبار کلاینت
                WebAPi.AuthenticateClientApikeyNonce(Request, ATISMobileWebApiLogTypes.WebApiClientMobileProccessesRequest);

                var NSSSoftwareuser = WebAPi.GetNSSSoftwareUser(Request);
                R2CoreInstanceMobileProcessesManager InstanceMobileProcesses = new R2CoreInstanceMobileProcessesManager();
                List <MobileProcess> _MobileProcesses = new List <MobileProcess>();
                var Lst = InstanceMobileProcesses.GetMobileProcesses(NSSSoftwareuser);
                for (int Loopx = 0; Loopx <= Lst.Count - 1; Loopx++)
                {
                    var Item = new MobileProcess();
                    Item.PId              = Lst[Loopx].PId;
                    Item.PName            = Lst[Loopx].PName;
                    Item.PTitle           = Lst[Loopx].PTitle;
                    Item.TargetMobilePage = Lst[Loopx].TargetMobilePageDelegate;
                    Item.Description      = Lst[Loopx].Description;
                    Item.PForeColor       = Lst[Loopx].PForeColor;
                    Item.PBackColor       = Lst[Loopx].PBackColor;
                    _MobileProcesses.Add(Item);
                }
                HttpResponseMessage response = Request.CreateResponse(HttpStatusCode.OK);
                response.Content = new StringContent(JsonConvert.SerializeObject(_MobileProcesses), Encoding.UTF8, "application/json");
                return(response);
            }
            catch (SoftwareUserHasNotAnyMobileProcessPermissionException ex)
            { return(WebAPi.CreateSuccessContentMessage(string.Empty)); }
            catch (UserNotExistByMobileNumberException ex)
            { return(WebAPi.CreateSuccessContentMessage(string.Empty)); }
            catch (WebApiClientSoftwareUserAPIKeyExpiredException ex)
            { return(WebAPi.CreateAPIKeyExpirationContentMessage(ex.Message)); }
            catch (Exception ex)
            { return(WebAPi.CreateErrorContentMessage(ex)); }
        }