protected void btnSave_OnClick(object sender, System.EventArgs e)
    {
        int user_id = Convert.ToInt32(Context.Items["UserID"]);
        searchType = Convert.ToString(Request.QueryString["searchType"]);

        if (!String.IsNullOrEmpty(Request.QueryString["taskID"]))
        {
            task_id = Convert.ToInt32(Request.QueryString["taskID"]);
            qPtl_Task task = new qPtl_Task(task_id);

            task.PercentCompleted = Convert.ToInt32(ddlPercentCompleted.SelectedValue);
            if (Convert.ToInt32(ddlPercentCompleted.SelectedValue) == 100)
                task.Status = "Completed";
            else
                task.Status = "Open";
            task.Importance = Convert.ToInt32(txtImportance.Text);
            if (!String.IsNullOrEmpty(Convert.ToString(ddlAssignedTo.SelectedItem)))
                task.AssignedTo = Convert.ToInt32(ddlAssignedTo.SelectedValue);
            else
                task.AssignedTo = null;
            task.Update();
        }

        Response.Redirect("~/qPtl/tasks-list.aspx?searchType=" + searchType);
    }
        public void Insert()
        {
            ReportID = Convert.ToInt32(container.Insert());

            qPtl_Reports report = new qPtl_Reports();

            qPtl_Task task = new qPtl_Task();

            task.Insert(report.UserID, 4, null, null, null, null, 0, "Pending", "Pending Site Report", "Report pending review -- report = " + report.message, 2, 22, report.ReportID);
        }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        task_id = Convert.ToInt32(Request.QueryString["taskID"]);
        qPtl_Task task = new qPtl_Task(task_id);

        task.Available = "No";
        task.MarkAsDelete = 0;
        task.Update();

        Response.Redirect("~/qPtl/tasks-list.aspx?searchType=" + searchType);
    }
示例#4
0
        public void Insert()
        {
            TaskID = Convert.ToInt32(container.Insert());

            // send email to site admin(s) with task info
            try
            {
                qPtl_Task new_task = new qPtl_Task(TaskID);
                SendTaskEmail(new_task.TaskTypeID, new_task.CreatedBy, new_task.ReferenceID, new_task.Description);
            }
            catch
            {
            }
        }
    protected void btnDelete_Click(object sender, EventArgs e)
    {
        warning_id = Convert.ToInt32(Request.QueryString["warningID"]);
        qSoc_Warning warning = new qSoc_Warning(warning_id);

        warning.Available = "No";
        warning.Update();

        // if being processed as a task then close task
        if (Request.QueryString["source"] == "tasks")
        {
            int task_id = Convert.ToInt32(Request.QueryString["taskID"]);
            qPtl_Task task = new qPtl_Task(task_id);

            task.PercentCompleted = 100;
            task.Status = "Completed";
            task.Update();
        }
        else
        {
            // check to see if there there a pending task
            qPtl_Task task = new qPtl_Task(warning.ContentTypeID, warning_id);

            if (task != null)
            {
                if (task.TaskID > 0)
                {
                    task.PercentCompleted = 100;
                    task.Status = "Completed";
                    task.Update();
                }
            }
        }

        if (Request.QueryString["source"] == "tasks")
            Response.Redirect("~/manage/members/task-list.aspx?searchType=open");
        else if (!String.IsNullOrEmpty(Request.QueryString["status"]))
            Response.Redirect("~/manage/members/warnings-list.aspx?status=" + Request.QueryString["status"]);
        else
            Response.Redirect("~/manage/members/warnings-list.aspx");
    }
        public void Insert(Int32 user_id, Int32 scope_id, String available, DateTime?created, Int32 created_by, DateTime?last_modified, Int32 last_modified_by, Int32 mark_as_delete, String message, String contact_name, String contact_email, String status, Int32 temp_session_id, String referral_url)
        {
            UserID         = user_id;
            ScopeID        = scope_id;
            Available      = available;
            Created        = created;
            CreatedBy      = created_by;
            LastModified   = last_modified;
            LastModifiedBy = last_modified_by;
            MarkAsDelete   = mark_as_delete;
            Message        = message;
            ContactName    = contact_name;
            ContactEmail   = contact_email;
            Status         = status;
            TempSessionID  = temp_session_id;
            ReferralURL    = referral_url;

            ReportID = Convert.ToInt32(container.Insert());

            qPtl_Task task = new qPtl_Task();

            task.Insert(UserID, 4, null, null, null, null, 0, "Pending", "Pending Site Report", "Report pending review -- report = " + message, 2, 22, ReportID);
        }
    protected void btnSave_OnClick(object sender, System.EventArgs e)
    {
        int user_id = Convert.ToInt32(Context.Items["UserID"]);

        if (!String.IsNullOrEmpty(Request.QueryString["warningID"]))
        {
            warning_id = Convert.ToInt32(Request.QueryString["warningID"]);
            qSoc_Warning warning = new qSoc_Warning(warning_id);

            warning.Status = ddlStatus.SelectedValue;
            warning.LastModifiedBy = Convert.ToInt32(Context.Items["UserID"]);
            warning.LastModified = DateTime.Now;
            warning.Update();

            // if being processed as a task then close task
            if (Request.QueryString["source"] == "tasks")
            {
                int task_id = Convert.ToInt32(Request.QueryString["taskID"]);
                qPtl_Task task = new qPtl_Task(task_id);

                if (ddlStatus.SelectedValue == "Reviewed")
                {
                    task.PercentCompleted = 100;
                    task.Status = "Completed";
                    task.Update();
                }
            }
            else
            {
                // check to see if there there a pending task
                qPtl_Task task = new qPtl_Task(warning.ContentTypeID, warning_id);

                if (task != null)
                {
                    if (task.TaskID > 0)
                    {
                        task.PercentCompleted = 100;
                        task.Status = "Completed";
                        task.Update();
                    }
                }
            }
        }

        if (Request.QueryString["source"] == "tasks")
            Response.Redirect("~/manage/members/task-list.aspx?searchType=open");
        else if (!String.IsNullOrEmpty(Request.QueryString["status"]))
            Response.Redirect("~/manage/members/warnings-list.aspx?status=" + Request.QueryString["status"]);
        else
            Response.Redirect("~/qSoc/warnings-list.aspx");
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!Page.IsPostBack)
        {
            searchType = Convert.ToString(Request.QueryString["searchType"]);
            hplBackTop.NavigateUrl = "tasks-list.aspx?searchType=" + searchType;
            hplBackBottom.NavigateUrl = "tasks-list.aspx?searchType=" + searchType;

            hplRefreshBottom.NavigateUrl = Request.Url.ToString();
            hplRefreshTop.NavigateUrl = Request.Url.ToString();

            if (!String.IsNullOrEmpty(Request.QueryString["taskID"]))
            {
                string curr_role = string.Empty;
                qPtl_Role role = new qPtl_Role("host");

                ddlAssignedTo.DataSource = qPtl_UserRole_View.GetRoleUsers(role.RoleID);
                ddlAssignedTo.DataTextField = "FullName";
                ddlAssignedTo.DataValueField = "UserID";
                ddlAssignedTo.DataBind();
                ddlAssignedTo.Items.Insert(0, new ListItem("", string.Empty));

                task_id = Convert.ToInt32(Request.QueryString["taskID"]);
                qPtl_Task task = new qPtl_Task(task_id);

                qPtl_User user = new qPtl_User(Convert.ToInt32(task.LastModifiedBy));
                actor_id = user.UserID;
                actor = user.UserName;

                lblTaskName.Text = task.Name;
                lblStatus.Text = task.Status;
                txtImportance.Text = Convert.ToString(task.Importance);

                if (!String.IsNullOrEmpty(Convert.ToString(task.PercentCompleted)))
                {
                    ddlPercentCompleted.SelectedValue = Convert.ToString(task.PercentCompleted);
                }
                if (!String.IsNullOrEmpty(Convert.ToString(task.AssignedTo)))
                {
                    ddlAssignedTo.SelectedValue = Convert.ToString(task.AssignedTo);
                }

                lblTitle.Text = "Edit Task (ID: " + task.TaskID +")";

                if (task.LastModifiedBy > 0)
                {
                    qPtl_User reviewed_by = new qPtl_User(Convert.ToInt32(task.LastModifiedBy));
                    lblLastUpdated.Text = "Reviewed by " + reviewed_by.UserName + " at " + task.LastModified;
                }
                else
                    lblLastUpdated.Visible = false;
            }
        }
    }
    protected void btnSave_OnClick(object sender, System.EventArgs e)
    {
        Page.Validate("form");

        if (Page.IsValid)
        {

            int user_id = Convert.ToInt32(Context.Items["UserID"]);
            video_id = Convert.ToInt32(Request.QueryString["videoID"]);

            string user_name = (new qPtl_User(user_id)).UserName;

            qSoc_Video video = new qSoc_Video(video_id);
            video.Title = txtTitle.Text;
            video.Description = txtDescription.Text;
            if (!String.IsNullOrEmpty(ddlTheme.SelectedValue))
                video.ThemeID = Convert.ToInt32(ddlTheme.SelectedValue);
            video.Status = "Approved";
            video.Created = video.Created;
            video.CreatedBy = video.CreatedBy;
            video.Approved = DateTime.Now;
            video.Source = lblVideoType.Text;
            video.LastModified = DateTime.Now;
            video.LastModifiedBy = user_id;
            video.Length = video.Length;
            video.EmbedCode = txtEmbed.Text;
            if (txtPreviewImage.Visible == true)
                video.ThumbnailURL = txtPreviewImage.Text;
            video.SourceVideoID = txtSourceVideoID.Text;
            if (!String.IsNullOrEmpty(ddlExternalSource.SelectedValue))
                video.ExternalSourceName = ddlExternalSource.SelectedValue;
            string author = string.Empty;
            author = ddlAuthor.SelectedValue;
            if (!String.IsNullOrEmpty(author))
                video.AuthorID = Convert.ToInt32(ddlAuthor.SelectedValue);
            video.Available = rblAvailable.SelectedValue;

            // process if highlighted video
            qDbs_SQLcode sql = new qDbs_SQLcode();
            string sqlCode = string.Empty;
            sqlCode = "UPDATE qSoc_Videos SET HighlightedWF = null";

            qSoc_HighlightedVideo.Delete(video_id);

            if (lblHighlightedMessage.Text.Contains("current") && chkHighlightedVideo.Checked == false)
            {
                sql.ExecuteSQL(sqlCode);
                video.HighlightedWF = null;
            }
            else if (chkHighlightedVideo.Checked && lblHighlightedMessage.Text.Contains("current"))
            {
                sql.ExecuteSQL(sqlCode);
                qSoc_HighlightedVideo high_video = new qSoc_HighlightedVideo();
                high_video = qSoc_HighlightedVideo.GetLatest();
                high_video.Available = "No";
                high_video.Created = DateTime.Now;
                high_video.CreatedBy = user_id;
                high_video.LastModified = DateTime.Now;
                high_video.LastModifiedBy = user_id;
                high_video.MarkAsDelete = 1;
                high_video.Status = "Hidden";
                high_video.Update();
            }
            else if (chkHighlightedVideo.Checked && lblHighlightedMessage.Text.Contains("Check"))
            {
                sql.ExecuteSQL(sqlCode);
                qSoc_HighlightedVideo new_highlighted = new qSoc_HighlightedVideo();
                new_highlighted.VideoID = video_id;
                new_highlighted.ScopeID = Convert.ToInt32(Context.Items["ScopeID"]);
                new_highlighted.Available = "Yes";
                new_highlighted.Created = DateTime.Now;
                new_highlighted.CreatedBy = user_id;
                new_highlighted.LastModified = DateTime.Now;
                new_highlighted.LastModifiedBy = user_id;
                new_highlighted.MarkAsDelete = 0;
                new_highlighted.Status = "Visible";
                new_highlighted.Insert();
                video.HighlightedWF = "Yes";
            }
            video.Update();

            // add keywords
            string owner_keywords = string.Empty;
            qPtl_KeywordReference.DeleteKeywordReferencesByContent((int)qSoc_ContentType.Types.Video, video_id);
            foreach (ListItem item in cblKeywords.Items)
            {
                if (item.Selected)
                {
                    if (!String.IsNullOrEmpty(owner_keywords))
                        owner_keywords += "," + item.Text;
                    else
                        owner_keywords += item.Text;
                    qPtl_KeywordReference keyword = new qPtl_KeywordReference();
                    keyword.Available = "Yes";
                    keyword.ScopeID = Convert.ToInt32(Context.Items["ScopeID"]);
                    keyword.KeywordID = Convert.ToInt32(item.Value);
                    keyword.ContentTypeID = (int)qSoc_ContentType.Types.Video;
                    keyword.ReferenceID = video_id;
                    keyword.Created = DateTime.Now;
                    keyword.LastModified = DateTime.Now;
                    keyword.CreatedBy = Convert.ToInt32(Context.Items["UserID"]);
                    keyword.LastModifiedBy = Convert.ToInt32(Context.Items["UserID"]);
                    keyword.MarkAsDelete = 0;
                    keyword.Insert();
                }
            }

            string reserved_keywords = string.Empty;
            foreach (ListItem item in chkTopics.Items)
            {
                if (item.Selected)
                {
                    if (!String.IsNullOrEmpty(reserved_keywords))
                        reserved_keywords += "," + item.Text;
                    else
                        reserved_keywords += item.Text;
                }
            }

            qSoc_Feed feed = new qSoc_Feed((int)qSoc_ContentType.Types.Video, video.VideoID);

            if (!chkDisplayInFeed.Checked && !chkDisplayInExplore.Checked)
            {
                if (feed != null)
                {
                    if (feed.FeedID > 0)
                    {
                        feed.MarkAsDelete = 1;
                        feed.Available = "No";
                        feed.ReservedKeywords = reserved_keywords;
                        if (!chkDisplayInFeed.Checked)
                            feed.VisibleFeed = false;
                        if (!chkDisplayInExplore.Checked)
                            feed.VisibleExplore = false;
                        feed.Update();
                    }
                }
            }
            else if (chkDisplayInFeed.Checked || chkDisplayInExplore.Checked || !string.IsNullOrEmpty(reserved_keywords))
            {
                int p_user_id = user_id;
                if (post_as_user_id > 0)
                    p_user_id = post_as_user_id;

                qPtl_User user = new qPtl_User(p_user_id);
                var u_space = qSoc_UserSpace_View.GetUserSpaces(video.CreatedBy);

                if (feed != null)
                {
                    if (feed.FeedID > 0)
                    {
                        feed.Available = video.Available;
                        feed.ScopeID = Convert.ToInt32(Context.Items["ScopeID"]);
                        feed.CreatedBy = user.UserID;
                        if (chkMoveToTop.Checked)
                            feed.LastModified = DateTime.Now;
                        feed.LastModified = video.LastModified;
                        feed.LastModifiedBy = user.UserID;
                        feed.MarkAsDelete = video.MarkAsDelete;
                        feed.OwnerMarkAsDelete = video.MarkAsDelete;
                        feed.ContentTypeID = (int)qSoc_ContentType.Types.Video;
                        feed.ReferenceID = video.VideoID;
                        feed.OwnerID = user.UserID;
                        feed.OwnerName = user.UserName;
                        feed.OwnerProfilePic = user.ProfilePict;
                        feed.Type = "video";
                        feed.Title = video.Title;
                        feed.Description = video.Description;
                        feed.OwnerRole = user.HighestRole;
                        feed.OwnerRoleID = user.HighestRank;
                        feed.OwnerKeywords = owner_keywords;
                        feed.UploadedFrom = "manager";
                        feed.ReservedKeywords = reserved_keywords;
                        feed.Thumbnail = video.ThumbnailURL;
                        if (!String.IsNullOrEmpty(ddlTheme.SelectedValue))
                        {
                            feed.ThemeID = Convert.ToInt32(ddlTheme.SelectedValue);
                            feed.ThemeName = Convert.ToString(ddlTheme.SelectedItem);
                        }
                        if (video.Source == "internal")
                        {
                            feed.VideoKey = video.ViddlerID;
                        }
                        else
                        {
                            string embed_code = Convert.ToString(video.EmbedCode);
                            feed.Embed = embed_code;
                            feed.VideoKey = null;
                        }
                        if (chkDisplayInFeed.Checked)
                            feed.VisibleFeed = true;
                        else
                            feed.VisibleFeed = false;
                        if (chkDisplayInExplore.Checked)
                            feed.VisibleExplore = true;
                        else
                            feed.VisibleExplore = false;
                        feed.Update();
                    }
                    else
                    {
                        // create new feed item
                        if (u_space != null)
                        {
                            foreach (var s in u_space)
                            {
                                feed.SpaceID = s.SpaceID;
                                feed.SpaceName = s.SpaceShortName;
                            }
                        }
                        feed.Available = video.Available;
                        feed.ScopeID = Convert.ToInt32(Context.Items["ScopeID"]);
                        feed.Created = DateTime.Now;    //video.Created;
                        feed.CreatedBy = user.UserID;
                        feed.LastModified = DateTime.Now;
                        feed.LastModifiedBy = user.UserID;
                        feed.MarkAsDelete = video.MarkAsDelete;
                        feed.OwnerMarkAsDelete = video.MarkAsDelete;
                        feed.ContentTypeID = (int)qSoc_ContentType.Types.Video;
                        feed.ReferenceID = video.VideoID;
                        feed.OwnerID = user.UserID;
                        feed.OwnerName = user.UserName;
                        feed.OwnerProfilePic = user.ProfilePict;
                        feed.Type = "video";
                        feed.Title = video.Title;
                        feed.Description = video.Description;
                        feed.OwnerRole = user.HighestRole;
                        feed.OwnerRoleID = user.HighestRank;
                        feed.OwnerKeywords = owner_keywords;
                        feed.UploadedFrom = "manager";
                        feed.ReservedKeywords = reserved_keywords;
                        feed.Thumbnail = video.ThumbnailURL;
                        if (!String.IsNullOrEmpty(ddlTheme.SelectedValue))
                        {
                            feed.ThemeID = Convert.ToInt32(ddlTheme.SelectedValue);
                            feed.ThemeName = Convert.ToString(ddlTheme.SelectedItem);
                        }
                        if (video.Source == "internal")
                        {
                            feed.VideoKey = video.ViddlerID;
                        }
                        else
                        {
                            string embed_code = Convert.ToString(video.EmbedCode);
                            feed.Embed = embed_code;
                        }

                        feed.VisibleAll = true;
                        feed.VisibleFriends = true;
                        feed.VisibleFollowers = true;
                        feed.VisibleSpace = true;
                        feed.VisiblePrivate = true;
                        feed.VisibleFeed = true;
                        feed.VisibleOwnerFeed = true;
                        feed.VisibleOwnerProfile = true;
                        if (!String.IsNullOrEmpty(owner_keywords))
                        {
                            feed.OwnerKeywords = owner_keywords;
                        }
                        if (chkDisplayInFeed.Checked)
                            feed.VisibleFeed = true;
                        else
                            feed.VisibleFeed = false;
                        if (chkDisplayInExplore.Checked)
                            feed.VisibleExplore = true;
                        else
                            feed.VisibleExplore = false;
                        feed.Insert();

                    }
                }
            }

            // see if there is a pending task for this video
            if (video.Status == "Approved")
            {
                qPtl_Task task = new qPtl_Task((int)qSoc_ContentType.Types.Video, video_id);

                if (task != null)
                {
                    if (task.TaskID > 0)
                    {
                        task.PercentCompleted = 100;
                        task.Status = "Completed";
                        task.Update();
                    }
                }
            }

            // redirect to page to add theme + keywords
            //  Response.Redirect("~/qSoc/videos-list.aspx");
            lblMessage.Text = "*** Record Successfully Updated ***";
            lblMessageBottom.Text = "*** Record Successfully Updated ***";
        }
    }
        public void Insert()
        {
            TaskID = Convert.ToInt32(container.Insert());

            // send email to site admin(s) with task info
            try
            {
                qPtl_Task new_task = new qPtl_Task(TaskID);
                SendTaskEmail(new_task.TaskTypeID, new_task.CreatedBy, new_task.ReferenceID, new_task.Description);
            }
            catch
            {
            }
        }