protected void cmdSubmit_Click(object sender, EventArgs e)
        {
            //parse through the checked items in the list and approve them.
            try
            {
                foreach (GridViewRow gvr in dgItems.Rows)
                {
                    try
                    {
                        HyperLink hlId = (HyperLink)gvr.FindControl("hlId");
                        CheckBox  cb   = (CheckBox)gvr.FindControl("chkSelect");
                        if (hlId != null && cb != null && cb.Checked)
                        {
                            //approve
                            Article a = (Article)Item.GetItem(Convert.ToInt32(hlId.Text), PortalId, ItemType.Article.GetId(), false);


                            CommunityCreditService cs = new CommunityCreditService(Settings["AffiliateCode"].ToString(), Settings["AffiliateKey"].ToString());

                            CommunityCredit.Components.Earner                  ec  = new CommunityCredit.Components.Earner(UserInfo.FirstName, UserInfo.LastName, UserInfo.Email);
                            CommunityCredit.Components.PointCategory           pc  = null;
                            CommunityCredit.Components.PointCategoryCollection pcc = cs.GetPointCategories();

                            foreach (PointCategory pcat in pcc)
                            {
                                //regular blog post
                                if (pcat.ID.ToString() == cboCCCategories.SelectedValue)
                                {
                                    pc = pcat;
                                    break;
                                }
                            }

                            //build up the Publish urls and submit
                            //TODO: localize this text
                            CommunityCredit.Components.Task tc = new CommunityCredit.Components.Task("Blog post: " + a.Name,
                                                                                                     Utility.GetItemLinkUrl(a.ItemId.ToString(), PortalId), pc);
                            if (tc != null)
                            {
                                cs.AddCommunityCredit(ec, tc, Convert.ToDateTime(a.StartDate));
                            }
                        }
                    }
                    catch (Exception exc)
                    {
                        Exceptions.ProcessModuleLoadException(this, exc);
                    }
                }
                //success
                //TODO: we need to display a friendly submission message here.
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }
        private void FillDropDown()
        {
            ItemRelationship.DisplayCategoryHierarchy(cboCategories, -1, PortalId, false);

            ListItem li = new ListItem(Localization.GetString("ChooseOne", LocalResourceFile), "-1");

            this.cboCategories.Items.Insert(0, li);

            //module settings for CC API
            CommunityCreditService cs = new CommunityCreditService(Settings["AffiliateCode"].ToString(), Settings["AffiliateKey"].ToString());

            CommunityCredit.Components.PointCategoryCollection pcc = cs.GetPointCategories();

            foreach (PointCategory pcat in pcc)
            {
                cboCCCategories.Items.Add(new ListItem(pcat.Code, pcat.ID.ToString()));
            }
        }
Example #3
0
        protected void ddlCategory_SelectedIndexChanged(object sender, EventArgs e)
        {
            ddlSubCategory.Items.Clear();

            //module settings for CC API
            CommunityCreditService cs = new CommunityCreditService(Settings["AffiliateCode"].ToString(), Settings["AffiliateKey"].ToString());

            CommunityCredit.Components.PointCategoryCollection pcc = cs.GetPointCategories();
            //generate a list of Areas

            foreach (PointCategory pcat in pcc)
            {
                if (pcat.Area == ddlCategory.SelectedValue)
                {
                    ddlSubCategory.Items.Add(new ListItem(pcat.Code + " (" + pcat.Value + "pts)", pcat.ID.ToString()));
                }
            }
        }
Example #4
0
        private void FillDropDown()
        {
            //module settings for CC API
            CommunityCreditService cs = new CommunityCreditService(Settings["AffiliateCode"].ToString(), Settings["AffiliateKey"].ToString());

            CommunityCredit.Components.PointCategoryCollection pcc = cs.GetPointCategories();
            //generate a list of Areas
            ListItem blank = new ListItem(Localization.GetString("ChooseOne", LocalResourceFile), "-1");

            ddlCategory.Items.Clear();
            ddlCategory.Items.Add(blank);

            foreach (PointCategory pcat in pcc)
            {
                ListItem li = new ListItem(pcat.Area, pcat.Area);
                if (!ddlCategory.Items.Contains(li))
                {
                    ddlCategory.Items.Add(li);
                }
            }
        }
Example #5
0
        protected void lbSubmit_Click(object sender, EventArgs e)
        {
            try
            {
                CommunityCreditService                             cs  = new CommunityCreditService(Settings["AffiliateCode"].ToString(), Settings["AffiliateKey"].ToString());
                CommunityCredit.Components.Earner                  ec  = new CommunityCredit.Components.Earner(UserInfo.FirstName, UserInfo.LastName, UserInfo.Email);
                CommunityCredit.Components.PointCategory           pc  = null;
                CommunityCredit.Components.PointCategoryCollection pcc = cs.GetPointCategories();

                foreach (PointCategory pcat in pcc)
                {
                    if (pcat.ID.ToString() == ddlSubCategory.SelectedValue)
                    {
                        pc = pcat;
                        break;
                    }
                }
                //TODO: localize this text
                CommunityCredit.Components.Task tc = new CommunityCredit.Components.Task(txtDescription.Text.Trim(),
                                                                                         txtUrl.Text.Trim(), pc);
                if (tc != null)
                {
                    cs.AddCommunityCredit(ec, tc, Convert.ToDateTime(txtDateEarned.Text.Trim()));
                }

                //add submission confirmation text
                lblError.Text    = Localization.GetString("SubmissionConfirmed", LocalResourceFile);
                lblError.Visible = true;
                //txtDateEarned.Text = string.Empty;
                txtUrl.Text = string.Empty;
                //txtDescription.Text = string.Empty;
            }
            catch (Exception exc)
            {
                Exceptions.ProcessModuleLoadException(this, exc);
            }
        }