public ActionResult GetIcon256(Guid?id)
        {
            if (!id.HasValue)
            {
                return(File(Url.Content("~/Content/Image/none.jpg"), "image/jpeg"));
            }

            PortalServiceProxy proxy = new PortalServiceProxy();

            ActionResult result;

            byte[] image;

            try
            {
                image = proxy.GetApp256Icon(id.Value);
            }
            catch
            {
                image = null;
            }

            if (image != null)
            {
                result = new FileContentResult(image, "image/jpeg");
            }
            else
            {
                result = File(Url.Content("~/Content/Image/none.jpg"), "image/jpeg");
            }

            return(result);
        }
        public ActionResult Index()
        {
            PortalServiceProxy proxy = new PortalServiceProxy();

            var viewModel = new IndexPageViewModel()
            {
                MostPopularApps = proxy.GetMostPopularApps(),
                SpecialApps     = proxy.GetSpecialApps(),
                ChosenApps      = proxy.GetChosenApps(),
                NewApps         = proxy.GetNewApps(),
                RisingApps      = proxy.GetNewApps(),
                SpecialGames    = proxy.GetSpecialGames()
            };

            return(PartialView(viewModel));
        }
Beispiel #3
0
    /// <summary>
    /// Creates list of offices and shows it.
    /// </summary>
    private void FillOfficesList()
    {
        try
        {
            Office[] offices = Office.GetOffices();
            if (offices == null)
                return;

            //// Create object for work with proxy.
            //WebProxy proxy = null;
            //if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["ProxyURL"]))
            //{
            //   proxy = new WebProxy(ConfigurationManager.AppSettings["ProxyURL"]);
            //   string proxyDomain = ConfigurationManager.AppSettings["ProxyUserDomain"];
            //   string proxyUser = ConfigurationManager.AppSettings["ProxyUserLogin"];
            //   string proxyPassword = ConfigurationManager.AppSettings["ProxyUserPassword"];

            //   if (!string.IsNullOrEmpty(proxyUser))
            //   {
            //      NetworkCredential netCred = new NetworkCredential();
            //      netCred.UserName = proxyUser;

            //      if (!string.IsNullOrEmpty(proxyDomain))
            //         netCred.Domain = proxyDomain;

            //      if (!string.IsNullOrEmpty(proxyPassword))
            //         netCred.Password = proxyPassword;

            //      proxy.Credentials = netCred;
            //   }
            //}

            List<OfficeDescription> coll = new List<OfficeDescription>();
            foreach (Office office in offices)
            {
                OfficeDescription officeDescr = new OfficeDescription();
                try
                {
                    if (!String.IsNullOrEmpty(office.StatusesServiceURL))
                    {
                        PortalServiceProxy wcfClient = new PortalServiceProxy(
                            office.StatusesServiceURL,
                            office.StatusesServiceUserName,
                            office.StatusesServicePassword);
                        officeDescr.OfficeName = wcfClient.GetOfficeName();

                        wcfClient.Close();
                    }
                }
                catch (Exception ex)
                {
                    Logger.Log.Error(ex.Message, ex);
                }

                if (String.IsNullOrEmpty(officeDescr.OfficeName))
                    officeDescr.OfficeName = office.OfficeName;

                officeDescr.ServiceURL = office.StatusesServiceURL;
                officeDescr.ServiceUserName = office.StatusesServiceUserName;
                officeDescr.ServicePassword = office.StatusesServicePassword;
                officeDescr.MeteoInformer = office.MeteoInformer;
                officeDescr.ClockInformer = office.ClockInformer;
                officeDescr.DigitalClockInformer = office.DigitalClockInformer;

                coll.Add(officeDescr);
            }

            repOffices.DataSource = coll;
            repOffices.DataBind();
        }
        catch (Exception ex)
        { Logger.Log.Error(ex.Message, ex); }
    }
    /// <summary>
    /// Updates data of users.
    /// </summary>
    public void UpdateUsersData()
    {
        try
        {
            if (string.IsNullOrEmpty(ServiceURL))
                return;

            try
            {
                //// Create object for work with proxy.
                //WebProxy proxy = null;
                //if (!string.IsNullOrEmpty(ConfigurationManager.AppSettings["ProxyURL"]))
                //{
                //    proxy = new WebProxy(ConfigurationManager.AppSettings["ProxyURL"]);
                //    string proxyDomain = ConfigurationManager.AppSettings["ProxyUserDomain"];
                //    string proxyUser = ConfigurationManager.AppSettings["ProxyUserLogin"];
                //    string proxyPassword = ConfigurationManager.AppSettings["ProxyUserPassword"];
                //    if (!string.IsNullOrEmpty(proxyUser))
                //    {
                //        NetworkCredential netCred = new NetworkCredential();
                //        netCred.UserName = proxyUser;
                //        if (!string.IsNullOrEmpty(proxyDomain))
                //            netCred.Domain = proxyDomain;

                //        if (!string.IsNullOrEmpty(proxyPassword))
                //            netCred.Password = proxyPassword;

                //        proxy.Credentials = netCred;
                //    }
                //}

                // Create service wrapper.
                List<XMLSerializableUserStatusInfo> coll = new List<XMLSerializableUserStatusInfo>();

                PortalServiceProxy wcfClient = new PortalServiceProxy(ServiceURL, ServiceUserName, ServicePassword);
                IEnumerable<XMLSerializableUserStatusInfo> statuses = wcfClient.GetUserStatuses();

                wcfClient.Close();

                if (statuses != null)
                    coll.AddRange(statuses);

                grdUsersList.DataSource = coll.ToArray();
                grdUsersList.DataBind();
            }
            catch (Exception ex)
            {
                Logger.Log.Error(ex.Message, ex);
            }
        }
        finally
        {}
    }