public void dgNote_Delete(object sender, DataGridCommandEventArgs e)
        {
            DataBoundLiteralControl lb        = (DataBoundLiteralControl)e.Item.Cells[0].Controls[3].Controls[0];
            PromotionRequest        promotion = new PromotionRequest(Convert.ToInt32(lb.Text));

            promotion.Delete();

            dgNote_ReBind(null, null);
        }
Ejemplo n.º 2
0
        public void btnNumberBoard_Click(object sender, CommandEventArgs e)
        {
            OccurrenceAttendance oa = new OccurrenceAttendance(Convert.ToInt32(e.CommandArgument));

            Arena.DataLayer.Organization.OrganizationData org = new Arena.DataLayer.Organization.OrganizationData();
            String securityNumber = oa.SecurityCode.Substring(2);
            int    promotionRequestID;


            //
            // Check if the security code is already posted.
            //
            promotionRequestID = FindPromotionRequest(oa.OccurrenceAttendanceID);
            if (promotionRequestID != -1)
            {
                PromotionRequest promotion = new PromotionRequest(promotionRequestID);

                promotion.Delete();
            }
            else
            {
                PromotionRequest promotion = new PromotionRequest();
                String           html;

                //
                // Generate the HTML for this note.
                //
                html = String.Format("<p id=\"SecurityCode\">{0}</p>", securityNumber);

                //
                // Create the new promotion.
                //
                if (CampusID != -1)
                {
                    promotion.Campus = new Campus(CampusID);
                }
                promotion.ContactName     = ArenaContext.Current.Person.FullName;
                promotion.ContactEmail    = "";
                promotion.ContactPhone    = "";
                promotion.Title           = oa.OccurrenceAttendanceID.ToString();
                promotion.TopicArea       = new Lookup(TopicAreaID);
                promotion.WebSummary      = html;
                promotion.WebPromote      = true;
                promotion.WebStartDate    = new DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day);
                promotion.WebEndDate      = promotion.WebStartDate.AddYears(1);
                promotion.WebApprovedBy   = ArenaContext.Current.User.Identity.Name;
                promotion.WebApprovedDate = DateTime.Now;
                promotion.Save(ArenaContext.Current.User.Identity.Name);
            }

            dgAttendance_ReBind(null, null);
        }
        /// <summary>
        /// Delete the identified promotion and then reload the list.
        /// </summary>
        /// <param name="sender">The object causing this event to be triggered.</param>
        /// <param name="e">The arguments for this event.</param>
        protected void dgPromotions_DeleteCommand(object sender, DataGridCommandEventArgs e)
        {
            PromotionRequest promotion = new PromotionRequest(Convert.ToInt32(e.Item.Cells[0].Text));


            //
            // Delete all documents/images.
            //
            while (promotion.Documents.Count > 0)
            {
                promotion.Documents[0].Delete();
                promotion.Documents.RemoveAt(0);
            }

            //
            // Delete the promotion and reload the list.
            //
            promotion.Delete();
            dgPromotions_ReBind(this, null);
        }