コード例 #1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            BLClient client = null;

            try
            {
                client = new BLClient();

                Streams.DataSource = client.GetChannelsByUserID(((User)Session["User"]).UserID);
            }
            finally
            {
                client.Dispose();
            }

            Streams.DataBind();
        }
コード例 #2
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["channelID"] == null)
            {
                Response.Redirect("~AllChannels.aspx");
            }

            int userID = -1;
            int channelID;


            if (!int.TryParse(Request.Params["channelID"], out channelID))
            {
                Response.Redirect("~AllChannels.aspx");
            }

            if (Session["User"] != null)
            {
                userID = ((User)Session["User"]).UserID;
            }

            BLClient client = null;


            try
            {
                client = new BLClient();

                _channel = client.GetChannelToDownload(userID, channelID);
            }
            finally
            {
                client.Dispose();
            }

            if (Request.QueryString["a"] != "v")
            {
                var installerSetup = new InstallerSetup();
                installerSetup.Add(channelID, _channel.ChannelGUID, _channel.ChannelName, 10);
                Response.RedirectPermanent(Url.For(installerSetup), true);
                return;
            }

            StreamName.Text = _channel.ChannelName;
            URL.Text        = System.Configuration.ConfigurationSettings.AppSettings["streamDetailsURL"] + channelID;
        }
コード例 #3
0
        internal override string Execute(string[] parameters)
        {
            int userID;
            int folderID;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                return(String.Empty);
            }

            if (parameters.Length < 2)
            {
                return(ErrorWrapper.SendError("Command parameters missing."));
            }

            if (!int.TryParse(parameters[1], out folderID))
            {
                return(ErrorWrapper.SendError("Cannot parse folder ID."));
            }

            BLClient client     = null;
            bool     bCanRemove = false;

            try
            {
                client = new BLClient();

                bCanRemove = client.RemoveSlideFolder(userID, folderID);
            }
            catch (Exception ex)
            {
                return(ErrorWrapper.SendError(ex.Message));
            }
            finally
            {
                client.Dispose();
            }

            if (!bCanRemove)
            {
                return("-1");
            }

            return("1");
        }
コード例 #4
0
        internal override string Execute(string[] parameters)
        {
            int userID;
            int channelID;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                return(String.Empty);
            }

            if (parameters.Length < 3)
            {
                return(ErrorWrapper.SendError("Command parameters missing."));
            }

            if (!int.TryParse(parameters[1], out channelID))
            {
                return(ErrorWrapper.SendError("Cannot parse channel ID."));
            }

            string thumbnailSlideRelativePath       = System.Configuration.ConfigurationSettings.AppSettings["thumbnailSlideRelativePath"];
            int    thumbnailSlideRelativePathLength = thumbnailSlideRelativePath.Length;

            string imagePath = parameters[2].Substring(thumbnailSlideRelativePathLength, parameters[2].Length - thumbnailSlideRelativePathLength);

            BLClient client = null;

            try
            {
                client = new BLClient();

                client.EditChannelThumbnail(userID, channelID, imagePath);
            }
            catch (Exception ex)
            {
                return(ErrorWrapper.SendError(ex.Message));
            }
            finally
            {
                client.Dispose();
            }

            return("1");
        }
コード例 #5
0
        internal override string Execute(string[] parameters)
        {
            int userID;
            int streamID;
            int categoryID;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                return(String.Empty);
            }

            if (!int.TryParse(parameters[1], out streamID))
            {
                return(ErrorWrapper.SendError("Parsing Stream ID"));
            }

            if (!int.TryParse(parameters[2], out categoryID))
            {
                return(ErrorWrapper.SendError("Parsing Category ID"));
            }

            BLClient client = null;

            try
            {
                client = new BLClient();

                client.SetCategory(userID, streamID, categoryID);
            }
            catch (Exception exception)
            {
                return(ErrorWrapper.SendError(exception.Message));
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            return("1");
        }
コード例 #6
0
        internal override string Execute(NameValueCollection commandParameters)
        {
            int    userID         = -1;
            string pcProfileToken = null;

            Helper.TryGetUserID(_session, out userID);

            if (userID == -1 && _session["PcProfileToken"] == null)
            {
                pcProfileToken = System.Guid.NewGuid().ToString();

                _session.Add("PcProfileToken", pcProfileToken);
            }
            else
            {
                pcProfileToken = (string)_session["PcProfileToken"];
            }

            List <PC> endUserMachineList;

            BLClient client = null;

            try
            {
                client = new BLClient();

                endUserMachineList = client.GetPcList(userID, pcProfileToken);
            }
            catch (Exception exception)
            {
                return(ErrorWrapper.SendError(exception.Message));
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            return(Flatten(endUserMachineList));
        }
コード例 #7
0
        internal override string Execute(string[] parameters)
        {
            int userID;
            int folderID;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                return(String.Empty);
            }

            if (parameters.Length < 2)
            {
                return(ErrorWrapper.SendError("Command parameters missing."));
            }

            if (!int.TryParse(parameters[1], out folderID))
            {
                return(ErrorWrapper.SendError("Cannot parse folder ID."));
            }

            BLClient client      = null;
            int      filesLength = -1;

            try
            {
                client = new BLClient();

                filesLength = client.RemoveAssetContentFolder(userID, folderID);
            }
            catch (Exception ex)
            {
                return(ErrorWrapper.SendError(ex.Message));
            }
            finally
            {
                client.Dispose();
            }

            ((User)_session["User"]).UsedBytes -= filesLength;

            return("1");
        }
コード例 #8
0
ファイル: SearchProcessor.cs プロジェクト: Oxigen2/Oxigen
        internal override string Execute(NameValueCollection commandParameters)
        {
            string keyword;
            int    userID;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                userID = -1;
            }

            string error = ValidateStringParameter(commandParameters, "keyword", out keyword);

            if (error != String.Empty)
            {
                return(error);
            }

            List <ChannelListChannel> channelList;

            BLClient client = null;

            // call WCF BLL Method
            try
            {
                client = new BLClient();

                channelList = client.Search(userID, keyword);
            }
            catch (Exception exception)
            {
                return(ErrorWrapper.SendError(exception.Message));
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            return(Flatten(channelList));
        }
コード例 #9
0
        internal override string Execute(System.Collections.Specialized.NameValueCollection commandParameters)
        {
            int userID;
            int folderID;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                return(String.Empty);
            }

            string error = ValidateIntParameter(commandParameters, "folderID", out folderID);

            if (error != String.Empty)
            {
                return(error);
            }

            PageAssetContentData contentList;

            BLClient client = null;

            // call WCF BLL Method
            try
            {
                client = new BLClient();

                contentList = client.GetRawContent(userID, folderID);
            }
            catch (Exception exception)
            {
                return(ErrorWrapper.SendError(exception.Message));
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            return(Flatten(contentList));
        }
コード例 #10
0
        internal override string Execute(NameValueCollection commandParameters)
        {
            int folderID;
            int userID;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                return(String.Empty);
            }

            string error = ValidateIntParameter(commandParameters, "folderID", out folderID);

            if (error != String.Empty)
            {
                return(error);
            }

            PageSlideData pageSlideData;

            BLClient client = null;

            // call WCF BLL Method
            try
            {
                client = new BLClient();

                pageSlideData = client.GetUserStreams(userID, folderID);
            }
            catch (Exception exception)
            {
                return(ErrorWrapper.SendError(exception.Message));
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            return(Flatten(pageSlideData));
        }
コード例 #11
0
        internal override string Execute(System.Collections.Specialized.NameValueCollection commandParameters)
        {
            int channelsSlideID;
            int userID;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                return(String.Empty);
            }

            string error = ValidateIntParameter(commandParameters, "slideID", out channelsSlideID);

            if (error != String.Empty)
            {
                return(error);
            }

            ChannelSlideProperties channelSlideProperties = null;

            BLClient client = null;

            // call WCF BLL Method
            try
            {
                client = new BLClient();

                channelSlideProperties = client.GetChannelSlideProperties(userID, channelsSlideID);
            }
            catch (Exception exception)
            {
                return(ErrorWrapper.SendError(exception.Message));
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            return(Flatten(channelSlideProperties));
        }
コード例 #12
0
        protected void Next_Click(object sender, EventArgs e)
        {
            BLClient client = null;

            try
            {
                client = new BLClient();

                client.SendPasswordReminder(txtEmail.Text);
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            Response.Redirect("PasswordSent.aspx");
        }
コード例 #13
0
        internal override string Execute(string[] parameters)
        {
            int        pcID;
            int        userID = -1;
            List <int> contentIDList;

            string error = null;

            if (_session["User"] != null)
            {
                error = Helper.GetIDs(_session, parameters, out userID, out pcID, out contentIDList);
            }
            else
            {
                error = GetIDs(parameters, out pcID, out contentIDList);
            }

            if (error != "1")
            {
                return(error);
            }

            BLClient client = null;

            try
            {
                client = new BLClient();

                client.RemovePCStream(userID, pcID, contentIDList);
            }
            catch (Exception ex)
            {
                return(ErrorWrapper.SendError(ex.Message));
            }
            finally
            {
                client.Dispose();
            }

            return("1");
        }
コード例 #14
0
ファイル: TopPick.aspx.cs プロジェクト: Oxigen2/Oxigen
        protected void Page_Load(object sender, EventArgs e)
        {
            int            categoryID = -1;
            List <Channel> channels   = null;
            BLClient       client     = null;
            string         categoryName;

            if (Request.Params["categoryID"] == null)
            {
                Response.Redirect("~/Home.aspx");
            }

            if (!int.TryParse(Request.Params["categoryID"], out categoryID))
            {
                Response.Redirect("~/Home.aspx");
            }


            if (!IsPostBack)
            {
                try
                {
                    client = new BLClient();

                    channels = client.GetTop5MostPopular(categoryID);

                    categoryName = client.GetCategoryName(categoryID);
                }
                finally
                {
                    client.Dispose();
                }

                CategoryName1.Text = categoryName;
                CategoryName2.Text = categoryName;

                Channels.DataSource = channels;
                Channels.DataBind();
            }
        }
コード例 #15
0
        internal override string Execute(string[] parameters)
        {
            int userID;
            int channelID;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                return(String.Empty);
            }

            if (parameters.Length < 3)
            {
                return(ErrorWrapper.SendError("Command parameters missing."));
            }

            if (!int.TryParse(parameters[1], out channelID))
            {
                return(ErrorWrapper.SendError("Cannot parse channel ID."));
            }

            BLClient client    = null;
            bool     bUnlocked = false;

            try
            {
                client = new BLClient();

                bUnlocked = client.UnlockStream(userID, channelID, parameters[2]);
            }
            catch (Exception ex)
            {
                return(ErrorWrapper.SendError(ex.Message));
            }
            finally
            {
                client.Dispose();
            }

            return(bUnlocked ? "1" : "0");
        }
コード例 #16
0
ファイル: RenamePCProcessor.cs プロジェクト: Oxigen2/Oxigen
        internal override string Execute(string[] parameters)
        {
            int userID;
            int pcID;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                return(String.Empty);
            }

            if (parameters.Length < 3)
            {
                return(ErrorWrapper.SendError("Command parameters missing."));
            }

            if (!int.TryParse(parameters[1], out pcID))
            {
                return(ErrorWrapper.SendError("Cannot parse PC ID"));
            }

            BLClient client = null;

            try
            {
                client = new BLClient();

                client.RenamePC(userID, pcID, parameters[2]);
            }
            catch (Exception ex)
            {
                return(ErrorWrapper.SendError(ex.Message));
            }
            finally
            {
                client.Dispose();
            }

            return("1");
        }
コード例 #17
0
ファイル: PcStreamProcessor.cs プロジェクト: Oxigen2/Oxigen
        internal override string Execute(System.Collections.Specialized.NameValueCollection commandParameters)
        {
            int pcID;
            int userID;

            Helper.TryGetUserID(_session, out userID);

            string error = ValidateIntParameter(commandParameters, "pcID", out pcID);

            if (error != String.Empty)
            {
                return(error);
            }

            PageChannelData pageChannelData;

            BLClient client = null;

            // call WCF BLL Method
            try
            {
                client = new BLClient();

                pageChannelData = client.GetPcStreams(userID, pcID);
            }
            catch (Exception exception)
            {
                return(ErrorWrapper.SendError(exception.Message));
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            return(Flatten(pageChannelData));
        }
コード例 #18
0
        internal override string Execute(string[] parameters)
        {
            int userID;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                return(String.Empty);
            }

            int             folderID;
            List <string[]> rawContentInfo;

            if (error != "1")
            {
                return(error);
            }

            BLClient   client = null;
            List <int> addedIDs;

            try
            {
                client = new BLClient();

                addedIDs = client.AddAssetContent(userID, folderID, contentIDList);
            }
            catch (Exception ex)
            {
                return(ErrorWrapper.SendError(ex.Message));
            }
            finally
            {
                client.Dispose();
            }

            return(Flatten(addedIDs));
        }
コード例 #19
0
        public void States_SelectedIndexChanged(object sender, EventArgs e)
        {
            BLClient client = null;
            List <LocationNameValue> townCities = null;

            try
            {
                client = new BLClient();

                townCities = Helper.AddToFrontOfDropDown <LocationNameValue>(client.GetChildGeoTTNodes(int.Parse(((DropDownList)sender).SelectedValue)), new LocationNameValue("Please select one ¬", -1, true));
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            ddlTownCities.DataSource     = townCities;
            ddlTownCities.DataTextField  = "Name";
            ddlTownCities.DataValueField = "Value";
            ddlTownCities.DataBind();
        }
コード例 #20
0
        internal override string Execute(NameValueCollection commandParameters)
        {
            int categoryID;

            string error = ValidateIntParameter(commandParameters, "categoryId", out categoryID);

            if (error != string.Empty)
            {
                return(error);
            }

            List <Category> categoryList;

            BLClient client = null;

            // call WCF BLL Method
            try
            {
                client = new BLClient();

                categoryList = client.GetCategoryList(categoryID);
            }
            catch (Exception exception)
            {
                return(ErrorWrapper.SendError(exception.Message));
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            return(Flatten(categoryList));
        }
コード例 #21
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.Params["channelID"] == null)
            {
                Response.Redirect("~AllChannels.aspx");
            }

            int userID = -1;
            int channelID;

            if (!int.TryParse(Request.Params["channelID"], out channelID))
            {
                Response.Redirect("~AllChannels.aspx");
            }

            if (Session["User"] != null)
            {
                userID = ((User)Session["User"]).UserID;
            }

            BLClient client = null;

            try
            {
                client = new BLClient();

                _channel = client.GetChannelToDownload(userID, channelID);
            }
            finally
            {
                client.Dispose();
            }

            StreamName.Text = _channel.ChannelName;
            URL.Text        = System.Configuration.ConfigurationSettings.AppSettings["streamDetailsURL"] + channelID;
        }
コード例 #22
0
ファイル: GetPreviewProcessor.cs プロジェクト: Oxigen2/Oxigen
        internal override string Execute(System.Collections.Specialized.NameValueCollection commandParameters)
        {
            int    mediaID;
            int    userID = -1;
            string subDir;

            string[]    files;
            PreviewType previewType;

            string error = ValidateIntParameter(commandParameters, "ID", out mediaID);

            if (error != String.Empty)
            {
                return(error);
            }

            if (!MediaTypeValid(commandParameters["type"]))
            {
                return(ErrorWrapper.SendError("Invalid Type"));
            }

            string mediaType = commandParameters["type"];

            log.WriteMessage("1");

            // for raw content and slide content, also check if the user is logged in.
            if (mediaType != "C")
            {
                if (!Helper.TryGetUserID(_session, out userID))
                {
                    return(String.Empty);
                }
            }

            BLClient client = null;

            try
            {
                client = new BLClient();

                client.GetPreviewFrames(userID, mediaType, mediaID, out subDir, out files, out previewType);
            }
            catch (Exception exception)
            {
                log.WriteMessage(exception.ToString());
                return(ErrorWrapper.SendError(exception.Message));
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            if (files == null)
            {
                log.WriteMessage("files is null");
                return("A,,/ViewMedia.aspx?noPreview=true");
            }

            log.WriteMessage(Flatten(subDir, files, mediaType, previewType));

            return(Flatten(subDir, files, mediaType, previewType));
        }
コード例 #23
0
        internal override string Execute(string[] parameters)
        {
            int userID;
            int?categoryID = null;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                return(String.Empty);
            }

            if (parameters.Length < 9)
            {
                return(ErrorWrapper.SendError("Command parameters missing."));
            }

            bool bPrivate;
            bool bAcceptPasswordRequests;

            string channelName     = parameters[2].Trim();
            string description     = parameters[3].Trim();
            string longDescription = parameters[4].Trim();
            string keywords        = parameters[5].Trim();
            string password        = parameters[7].Trim();

            if (string.IsNullOrEmpty(channelName))
            {
                return("-1");
            }

            if (string.IsNullOrEmpty(description))
            {
                description = null;
            }

            if (string.IsNullOrEmpty(longDescription))
            {
                longDescription = null;
            }

            if (string.IsNullOrEmpty(keywords))
            {
                keywords = null;
            }
            else
            {
                keywords = keywords.Replace("|", ",");
            }

            if (string.IsNullOrEmpty(password))
            {
                password = null;
            }

            if (!Helper.NullableIntTryParse(parameters[1], out categoryID))
            {
                return(ErrorWrapper.SendError("Cannot parse category."));
            }

            if (categoryID == -1)
            {
                categoryID = null;
            }

            if (!bool.TryParse(parameters[6], out bPrivate))
            {
                return(ErrorWrapper.SendError("Cannot parse channel privacy."));
            }

            if (!bool.TryParse(parameters[8], out bAcceptPasswordRequests))
            {
                return(ErrorWrapper.SendError("Cannot parse channel acceptance of password requests."));
            }

            if (bPrivate && string.IsNullOrEmpty(password))
            {
                return("-2");
            }

            BLClient client = null;

            try
            {
                client = new BLClient();

                client.AddChannel(userID, categoryID, channelName, description, longDescription, keywords, bPrivate, password, bAcceptPasswordRequests);
            }
            catch (Exception ex)
            {
                return(ErrorWrapper.SendError(ex.Message));
            }
            finally
            {
                client.Dispose();
            }

            return("1");
        }
コード例 #24
0
        internal override string Execute(string[] parameters)
        {
            int userID;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                return(String.Empty);
            }

            if (parameters.Length < 8)
            {
                return(ErrorWrapper.SendError("Command parameters missing."));
            }

            int      slideID;
            DateTime?date = null;
            float    displayDuration;

            string trimmedTitle           = parameters[2].Trim();
            string trimmedCreator         = parameters[3].Trim();
            string trimmedCaption         = parameters[4].Trim();
            string trimmedDate            = parameters[5].Trim();
            string trimmedURL             = parameters[6].Trim().Replace("{a001}", ",,");
            string trimmedDisplayDuration = parameters[7].Trim();

            if (!int.TryParse(parameters[1], out slideID))
            {
                return(ErrorWrapper.SendError("Invalid slide ID"));
            }

            if (string.IsNullOrEmpty(trimmedTitle))
            {
                return("-4");
            }

            if (!string.IsNullOrEmpty(trimmedDate) && !Helper.NullableDateTryParse(trimmedDate, out date))
            {
                return("-1"); // invalid date
            }
            if (date != null && !Helper.DateWithinLimits(date))
            {
                return("-1"); // invalid date
            }
            if (string.IsNullOrEmpty(trimmedDate))
            {
                date = null;
            }

            if (!string.IsNullOrEmpty(trimmedDisplayDuration) && trimmedDisplayDuration != Resource.UserDefinedDisplayDuration)
            {
                if (!float.TryParse(trimmedDisplayDuration, out displayDuration))
                {
                    return("-2"); // invalid display duration
                }
                if (displayDuration < _minDisplayDuration || displayDuration > _maxDisplayDuration)
                {
                    return("-3"); // display duration out of bounds
                }
            }
            else
            {
                displayDuration = -1F;
            }

            if (string.IsNullOrEmpty(trimmedCaption))
            {
                trimmedCaption = null;
            }

            if (string.IsNullOrEmpty(trimmedCreator))
            {
                trimmedCreator = null;
            }

            if (string.IsNullOrEmpty(trimmedURL))
            {
                trimmedURL = null;
            }

            BLClient client = null;

            try
            {
                client = new BLClient();

                client.EditSlideContentProperties(userID, slideID, trimmedTitle, trimmedCreator, trimmedCaption,
                                                  date, trimmedURL, displayDuration);
            }
            catch (Exception ex)
            {
                return(ErrorWrapper.SendError(ex.Message));
            }
            finally
            {
                client.Dispose();
            }

            return("1");
        }
コード例 #25
0
        internal override string Execute(NameValueCollection commandParameters)
        {
            int    categoryID;
            int    startPageNo;
            int    endPageNo;
            string sortBy;
            string sortByEnumString;
            int    userID;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                userID = -1;
            }

            string error = ValidateIntParameter(commandParameters, "categoryId", out categoryID);

            if (error != String.Empty)
            {
                return(error);
            }

            error = ValidateIntParameter(commandParameters, "startPageNo", out startPageNo);

            if (error != String.Empty)
            {
                return(error);
            }

            error = ValidateIntParameter(commandParameters, "endPageNo", out endPageNo);

            if (error != String.Empty)
            {
                return(error);
            }

            error = ValidateStringParameter(commandParameters, "sortBy", out sortBy);

            if (error != String.Empty)
            {
                return(error);
            }

            error = GetSortChannelsByFromConfig(sortBy, out sortByEnumString);

            if (error != String.Empty)
            {
                return(error);
            }

            // validate Sort By enum
            SortChannelsBy sortChannelsBy;

            error = TryParseSortChannelsBy(typeof(SortChannelsBy), sortByEnumString, out sortChannelsBy);

            if (error != String.Empty)
            {
                return(error);
            }

            PageChannelData pageChannelData;

            BLClient client = null;

            // call WCF BLL Method
            try
            {
                client = new BLClient();

                pageChannelData = client.GetChannelListByCategoryID(userID, categoryID, startPageNo, endPageNo, sortChannelsBy);
            }
            catch (Exception exception)
            {
                return(ErrorWrapper.SendError(exception.Message));
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            return(Flatten(pageChannelData));
        }
コード例 #26
0
ファイル: CreateWizard.aspx.cs プロジェクト: Oxigen2/Oxigen
        private void UploadAndSaveToDB(out long totalUploadSize)
        {
            int userID;

            totalUploadSize = 0;

            if (!Helper.TryGetUserID(Session, out userID))
            {
                return;
            }

            List <AssetContent> assetContents = new List <AssetContent>();

            int fileCount = Int32.Parse(Request.Form["FileCount"]);

            UploadForm uploadForm = new UploadForm(_inviteToOverrideFieldText)
            {
                Title       = Request.Form["TitleOvr"].Trim(),
                Creator     = Request.Form["CreatorOvr"].Trim(),
                Description = Request.Form["DescriptionOvr"].Trim(),
                Url         = Request.Form["URLOvr"].Trim()
            };

            uploadForm.SetDateIfNotEmpty(Request.Form["DateOvr"].Trim());
            uploadForm.SetDisplayDuration(Request.Form["DisplayDurationOvr"].Trim(), _minDisplayDuration, _maxDisplayDuration);

            //Iterate through uploaded data and save the original file and thumbnail
            for (int i = 1; i <= fileCount; i++)
            {
                HttpPostedFile postedFile   = Request.Files["SourceFile_" + i];
                UploadedFile   uploadedFile = _uploadedFileFactory.CreateUploadedFile(uploadForm, _fileDurationDetectorFactory, Path.GetExtension(postedFile.FileName).ToLower());

                uploadedFile.RawContentPath            = _rawContentPath;
                uploadedFile.ThumbnailAssetContentPath = _thumbnailAssetContentPath;
                uploadedFile.UploadedStream            = postedFile.InputStream;
                uploadedFile.OriginalFileName          = postedFile.FileName;
                uploadedFile.SetDateIfUserHasNotProvidedOne(Request.Params["SourceFileCreatedDateTime_" + i]);

                uploadedFile.Thumbnail1Stream = Request.Files["Thumbnail1_" + i].InputStream;
                uploadedFile.Thumbnail2Stream = Request.Files["Thumbnail2_" + i].InputStream;

                uploadedFile.SaveThumbnail();
                uploadedFile.SaveContent();
                uploadedFile.SetDisplayDuration();

                totalUploadSize += uploadedFile.ContentLength;

                assetContents.Add(new AssetContent(uploadedFile.Title,
                                                   uploadedFile.Folder + "\\" + uploadedFile.GuidFilenameWithExtension,
                                                   uploadedFile.GuidFilenameWithoutExtension,
                                                   uploadedFile.Extension,
                                                   uploadedFile.Folder + "/" + uploadedFile.GuidFilenameWithoutExtension + ".jpg",
                                                   uploadedFile.Folder + "\\" + uploadedFile.GuidFilenameWithoutExtension + ".jpg",
                                                   uploadedFile.Folder,
                                                   uploadedFile.GuidFilenameWithoutExtension + ".jpg",
                                                   uploadForm.Description,
                                                   uploadForm.Creator,
                                                   uploadedFile.Date,
                                                   uploadForm.Url,
                                                   uploadedFile.DisplayDuration,
                                                   uploadedFile.ContentLength,
                                                   uploadedFile.PreviewType));
            }

            BLClient client = null;
            bool     bDurationsAmended;

            try
            {
                client = new BLClient();

                bDurationsAmended = client.AddAssetContent(userID, int.Parse(Request.Form["AssetContentFolderID"]), assetContents);
            }
            finally
            {
                client.Dispose();
            }

            Session.Add("DurationsAmended", bDurationsAmended);
        }
コード例 #27
0
        internal override string Execute(string[] parameters)
        {
            int    userID;
            int    slideID;
            string url;
            string trimmedDisplayDuration;
            float  displayDuration;

            if (!Helper.TryGetUserID(_session, out userID))
            {
                return(String.Empty);
            }

            int parametersLength = parameters.Length;

            if (parametersLength < 5)
            {
                return(ErrorWrapper.SendError("Command parameters missing."));
            }

            if (!int.TryParse(parameters[1], out slideID))
            {
                return(ErrorWrapper.SendError("Invalid Slide ID"));
            }

            url = parameters[2].Trim().Replace("{a001}", ",,");
            trimmedDisplayDuration = parameters[3].Trim();

            if (string.IsNullOrEmpty(url))
            {
                url = null;
            }

            if (!string.IsNullOrEmpty(trimmedDisplayDuration) && trimmedDisplayDuration != Resource.UserDefinedDisplayDuration)
            {
                if (!float.TryParse(trimmedDisplayDuration, out displayDuration))
                {
                    return("-1");
                }

                if (displayDuration < _minDisplayDuration || displayDuration > _maxDisplayDuration)
                {
                    return("-3"); // display duration out of bounds
                }
            }
            else
            {
                displayDuration = -1F;
            }

            string[] startEndDateTimes = null;

            if (!Validate(parametersLength, parameters, ref startEndDateTimes))
            {
                return("-2");
            }

            BLClient client = null;

            try
            {
                client = new BLClient();

                client.EditChannelSlideProperties(userID, slideID, url, displayDuration, parameters[4], startEndDateTimes);
            }
            catch (Exception ex)
            {
                return(ErrorWrapper.SendError(ex.ToString()));
            }
            finally
            {
                client.Dispose();
            }

            return("1");
        }
コード例 #28
0
        public void Next_Click(object sender, EventArgs e)
        {
            string password1               = txtPassword1.Text.Trim();
            string password2               = txtPassword2.Text.Trim();
            int    townCityID              = -1;
            int    occupationSectorID      = -1;
            int    employmentLevelID       = -1;
            int    annualHouseholdIncomeID = -1;
            string gender = null;

            DateTime dob;

            if (!_emailRegex.IsMatch(txtEmail.Text))
            {
                ValidationMessage.Text = "Please enter a valid e-mail address.";
                return;
            }
            else
            {
                ValidationMessage.Text = "";
            }

            if (password1 != password2)
            {
                ValidationMessage.Text = "Passwords do not match";
                return;
            }
            else
            {
                ValidationMessage.Text = "";
            }

            if (!rbGenderFemale.Checked && !rbGenderMale.Checked)
            {
                ValidationMessage.Text = "Please select your gender";
                return;
            }
            else
            {
                gender = rbGenderFemale.Checked ? "female" : "male";
                ValidationMessage.Text = "";
            }

            try
            {
                dob = new DateTime(int.Parse(dobYear.SelectedValue), int.Parse(dobMonth.SelectedValue), int.Parse(dobDay.SelectedValue));
                ValidationMessage.Text = "";
            }
            catch
            {
                ValidationMessage.Text = "Please enter a valid Date of Birth";
                return;
            }

            if (ddlCountry.SelectedValue == "-1")
            {
                ValidationMessage.Text = "Please select your country";
                return;
            }
            else
            {
                ValidationMessage.Text = "";
            }

            if (ddlState.Visible && ddlState.SelectedValue == "-1")
            {
                ValidationMessage.Text = "Please select your state";
                return;
            }
            else
            {
                ValidationMessage.Text = "";
            }

            if (!int.TryParse(ddlTownCities.SelectedValue, out townCityID) || ddlTownCities.SelectedValue == "-1")
            {
                ValidationMessage.Text = "Please select your town or city";
                return;
            }
            else
            {
                ValidationMessage.Text = "";
            }

            if (!int.TryParse(ddlSector.SelectedValue, out occupationSectorID) || ddlSector.SelectedValue == "-1")
            {
                ValidationMessage.Text = "Please select your occupation sector";
                return;
            }
            else
            {
                ValidationMessage.Text = "";
            }

            if (!int.TryParse(ddlLevel.SelectedValue, out employmentLevelID) || ddlLevel.SelectedValue == "-1")
            {
                ValidationMessage.Text = "Please select your employment level";
                return;
            }
            else
            {
                ValidationMessage.Text = "";
            }

            if (!int.TryParse(ddlIncome.SelectedValue, out annualHouseholdIncomeID) || ddlIncome.SelectedValue == "-1")
            {
                ValidationMessage.Text = "Please select your Annual Household Income";
                return;
            }
            else
            {
                ValidationMessage.Text = "";
            }

            // all inputs are ok

            bool     bEmailExists = false;
            BLClient client       = null;

            try
            {
                client = new BLClient();

                bEmailExists = client.EditUserDetails(((User)Session["User"]).UserID, txtEmail.Text, password1, txtFirstName.Text, txtLastName.Text,
                                                      gender, dob, townCityID, occupationSectorID, employmentLevelID, annualHouseholdIncomeID);
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            if (bEmailExists)
            {
                ValidationMessage.Text = "This e-mail address already exists on our system.";
                return;
            }
            else
            {
                ValidationMessage.Text = "";
            }

            Response.Redirect("Home.aspx");
        }
コード例 #29
0
        internal override string Execute(string[] parameters)
        {
            int      channelID;
            string   name          = parameters[2];
            string   emailAddress  = parameters[3];
            string   message       = parameters[4];
            string   captchaString = parameters[5];
            BLClient client        = null;

            logger.WriteTimestampedMessage("no of parameters: " + parameters.Length);

            int counter = 0;

            foreach (string param in parameters)
            {
                logger.WriteTimestampedMessage("Parameter " + counter + " = " + param);

                counter++;
            }

            if (!int.TryParse(parameters[1], out channelID))
            {
                logger.WriteMessage(parameters[1] + " is not a number.");
                throw new FormatException("Parameter must be a number");
            }

            if (string.IsNullOrEmpty(emailAddress) || !_emailRegex.IsMatch(emailAddress))
            {
                logger.WriteTimestampedMessage("0");

                return("0");
            }

            if (captchaString != (string)_session["CaptchaImageText"])
            {
                logger.WriteTimestampedMessage("-1");

                return("-1");
            }

            if (string.IsNullOrEmpty(name))
            {
                logger.WriteTimestampedMessage("-2");

                return("-2");
            }

            try
            {
                client = new BLClient();

                client.SendPasswordRequest(channelID, name, emailAddress, message);
            }
            catch (Exception ex)
            {
                logger.WriteTimestampedMessage(ex.ToString());
                throw ex;
            }
            finally
            {
                if (client != null)
                {
                    client.Dispose();
                }
            }

            return("1");
        }
コード例 #30
0
        private void UploadAndSaveToDB(out long totalUploadSize)
        {
            string rawContentPath = System.Configuration.ConfigurationSettings.AppSettings["assetContentPath"];
            string thumbnailAssetContentRelativePath = System.Configuration.ConfigurationSettings.AppSettings["thumbnailAssetContentRelativePath"];
            string thumbnailAssetContentPath         = System.Configuration.ConfigurationSettings.AppSettings["thumbnailAssetContentPath"];

            int userID;

            totalUploadSize = 0;

            if (!Helper.TryGetUserID(Session, out userID))
            {
                return;
            }

            List <AssetContent> assetContents = new List <AssetContent>();

            int fileCount = Int32.Parse(Request.Form["FileCount"]);

            string title           = Request.Form["TitleOvr"].Trim();
            string creator         = Request.Form["CreatorOvr"].Trim();
            string description     = Request.Form["DescriptionOvr"].Trim();
            string date            = Request.Form["DateOvr"].Trim();
            string url             = Request.Form["URLOvr"].Trim();
            string displayDuration = Request.Form["DisplayDurationOvr"].Trim();

            bool bUseTitleOvr           = !string.IsNullOrEmpty(title) && title != _inviteToOverrideValues;
            bool bUseCreatorOvr         = !string.IsNullOrEmpty(creator) && creator != _inviteToOverrideValues;
            bool bUseDescriptionOvr     = !string.IsNullOrEmpty(description) && description != _inviteToOverrideValues;
            bool bUseDateOvr            = !string.IsNullOrEmpty(date) && date != _inviteToOverrideValues;
            bool bUseURLOvr             = !string.IsNullOrEmpty(url) && url != _inviteToOverrideValues;
            bool bUseDisplayDurationOvr = !string.IsNullOrEmpty(displayDuration) && displayDuration != _inviteToOverrideValues;

            title           = bUseTitleOvr ? title : null;
            creator         = bUseCreatorOvr ? creator : null;
            description     = bUseDescriptionOvr ? description : null;
            date            = bUseDateOvr ? date : null;
            url             = bUseURLOvr ? url : null;
            displayDuration = bUseDisplayDurationOvr ? displayDuration : null;

            DateTime?userGivenDate    = null;
            float    fDisplayDuration = -1F;

            if (bUseDateOvr)
            {
                Helper.NullableDateTryParse(date, out userGivenDate);
            }

            // TODO: pending future development to accept videos, always try to parse user's given display duration
            if (!float.TryParse(displayDuration, out fDisplayDuration) || fDisplayDuration < _minDisplayDuration || fDisplayDuration > _maxDisplayDuration)
            {
                fDisplayDuration = -1F;
            }

            //Iterate through uploaded data and save the original file and thumbnail
            for (int i = 1; i <= fileCount; i++)
            {
                string      newFilename;
                string      newFilenameWithoutExtension;
                string      newFolder;
                PreviewType previewType;

                if (!bUseDateOvr)
                {
                    userGivenDate = ToDotNetFormat(Request.Params["SourceFileCreatedDateTime_" + i]);
                }

                int contentLength = -1;

                //Get source file and save it to disk.
                HttpPostedFile sourceFile = Request.Files["SourceFile_" + i];
                string         fileName   = System.IO.Path.GetFileName(sourceFile.FileName);
                string         extension  = System.IO.Path.GetExtension(sourceFile.FileName).ToLower();

                bool bIsImage = GetIsFileImage(extension);
                bool bIsVideo = GetIsFileVideo(extension);

                if (!bUseTitleOvr)
                {
                    title = Path.GetFileNameWithoutExtension(fileName);
                }

                FilenameMakerLib.FilenameFromGUID.MakeFilenameAndFolder(fileName, out newFilename,
                                                                        out newFilenameWithoutExtension, out newFolder);

                string pathWithoutFilename = rawContentPath + newFolder;

                if (!Directory.Exists(pathWithoutFilename))
                {
                    Directory.CreateDirectory(pathWithoutFilename);
                }

                //Get first thumbnail  and save it to disk.
                HttpPostedFile thumbnail1File = Request.Files["Thumbnail1_" + i];

                string thumbnailFullPhysicalPathWithoutFilename = thumbnailAssetContentPath + newFolder;

                if (!Directory.Exists(thumbnailFullPhysicalPathWithoutFilename))
                {
                    Directory.CreateDirectory(thumbnailFullPhysicalPathWithoutFilename);
                }

                string thumbnailFullPath = thumbnailFullPhysicalPathWithoutFilename + "\\" + newFilenameWithoutExtension + ".jpg";

                if (bIsImage)
                {
                    thumbnail1File.SaveAs(thumbnailFullPath);
                }
                else if (bIsVideo)
                {
                    CopyDefaultThumbnailForType(extension, thumbnailAssetContentPath, thumbnailFullPath);
                }
                else
                {
                    File.Copy(thumbnailAssetContentPath + "flash-swf.jpg", thumbnailFullPath);
                }

                // get resized file and save
                HttpPostedFile thumbnail2File = Request.Files["Thumbnail2_" + i];

                if (bIsImage)
                {
                    thumbnail2File.SaveAs(pathWithoutFilename + "\\" + newFilename);

                    contentLength = thumbnail2File.ContentLength;
                }
                else
                {
                    sourceFile.SaveAs(pathWithoutFilename + "\\" + newFilename);

                    contentLength = sourceFile.ContentLength;
                }

                totalUploadSize += contentLength;

                previewType = GetPreviewType(bIsImage, bIsVideo);

                assetContents.Add(new AssetContent(title,
                                                   newFolder + "\\" + newFilename,
                                                   newFilenameWithoutExtension,
                                                   extension,
                                                   newFolder + "/" + newFilenameWithoutExtension + ".jpg",
                                                   newFolder + "\\" + newFilenameWithoutExtension + ".jpg",
                                                   newFolder,
                                                   newFilenameWithoutExtension + ".jpg",
                                                   description,
                                                   creator,
                                                   userGivenDate,
                                                   url,
                                                   fDisplayDuration,
                                                   contentLength,
                                                   previewType));
            }

            BLClient client            = null;
            bool     bDurationsAmended = false;

            try
            {
                client = new BLClient();

                bDurationsAmended = client.AddAssetContent(userID, int.Parse(Request.Form["AssetContentFolderID"]), assetContents);
            }
            finally
            {
                client.Dispose();
            }

            Session.Add("DurationsAmended", bDurationsAmended);
        }