public void btnAddPost_Click(object sender, EventArgs e) { PromotionRequest promotion = new PromotionRequest(); StringBuilder html; if (tbAddNumber.Text.Length > 0) { html = new StringBuilder(String.Format("<p id=\"SecurityCode\">{0}</p>", tbAddNumber.Text)); // // Create the new promotion. // if (CampusID != -1) { promotion.Campus = new Arena.Organization.Campus(CampusID); } promotion.ContactName = ArenaContext.Current.Person.FullName; promotion.ContactEmail = ""; promotion.ContactPhone = ""; promotion.Title = "Generic Number"; promotion.TopicArea = new Lookup(TopicAreaID); promotion.WebSummary = html.ToString(); 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); } dgNote_ReBind(null, null); }
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); }
public void dgNote_Update(object sender, DataGridCommandEventArgs e) { PromotionRequest promotion; StringBuilder html; Hashtable hash = (Hashtable)ViewState["editData"]; CheckBox cb; cb = (CheckBox)e.Item.Controls[1].Controls[3]; html = new StringBuilder(String.Format("<p id=\"SecurityCode\">{0}</p>", hash["number_string"])); if (cb.Checked) { html.AppendFormat("<p id=\"Name\">{0}</p>", hash["first_name"]); } promotion = new PromotionRequest(Convert.ToInt32(hash["promotion_id"])); promotion.WebSummary = html.ToString(); promotion.Save(ArenaContext.Current.User.Identity.Name); dgNote.EditItemIndex = -1; dgNote_ReBind(null, null); }
/// <summary> /// The page is being loaded, we need to do some initialization information. /// </summary> /// <param name="sender">The object causing the event to be triggered.</param> /// <param name="e">Information about the event itself.</param> protected void Page_Load(object sender, EventArgs e) { // // If this is an initial page load, set the initial values. // if (!IsPostBack) { tbTitle.Text = promotion.Title; if (promotion.PromotionRequestID == -1) { promotion.WebStartDate = DateTime.Now; promotion.WebEndDate = DateTime.Now; } tbStartDate.Text = promotion.WebStartDate.ToString("MM/dd/yyyy hh:mm tt").ToLower(); tbEndDate.Text = promotion.WebEndDate.ToString("MM/dd/yyyy hh:mm tt").ToLower(); try { ddlTopicArea.SelectedValue = promotion.TopicArea.LookupID.ToString(); } catch { ddlTopicArea.SelectedValue = "-1"; } cbWeekly.Checked = (promotion.WebSummary == "Weekly"); } // // Handle a document image being uploaded. // pnlWrongSize.Visible = false; if (this.ihBlobID.Value != string.Empty) { PromotionRequestDocument item = new PromotionRequestDocument(promotion.PromotionRequestID, Convert.ToInt32(this.ihBlobID.Value)); Arena.Utility.ArenaImage img = new Arena.Utility.ArenaImage(Convert.ToInt32(this.ihBlobID.Value)); System.Drawing.Image image = img.GetImage(0, 0); // // Check if the image being uploaded fits the required dimensions. // if ((RequiredWidthSetting == 0 || RequiredWidthSetting == image.Width) && (RequiredHeightSetting == 0 || RequiredHeightSetting == image.Height)) { bool flag = false; // // Look for an existing image in the promotion. // for (int i = 0; i < promotion.Documents.Count; i++) { if (promotion.Documents[i].DocumentID == item.DocumentID) { promotion.Documents[i] = item; flag = true; break; } } // // If not found, add this image to the promotion. // if (!flag) { int ignored = item.ByteArray.Length; promotion.Save(CurrentUser.Identity.Name); item.PromotionRequestID = promotion.PromotionRequestID; item.BlobID = Convert.ToInt32(this.ihBlobID.Value); item.Description = "999"; item.Save(CurrentUser.Identity.Name); promotion.Documents.Add(item); } } else { // // Delete the image from the database. // img.Delete(); // // Inform the user it was the wrong size. // ltWrongSize.Text = ""; if (RequiredWidthSetting != 0 && RequiredHeightSetting != 0) { ltWrongSize.Text = String.Format("Your image was not uploaded. It must be exactly {0} by {1} pixels in size.", RequiredWidthSetting, RequiredHeightSetting); } else if (RequiredWidthSetting != 0) { ltWrongSize.Text = String.Format("Your image was not uploaded. It must be exactly {0} pixels wide.", RequiredWidthSetting); } else { ltWrongSize.Text = String.Format("Your image was not uploaded. It must be exactly {0} pixels high.", RequiredHeightSetting); } pnlWrongSize.Visible = true; } this.ihBlobID.Value = string.Empty; } // // Do final initialization. // RegisterScripts(); ShowDocuments(); lbAddItem.OnClientClick = string.Format("openChooseDocumentWindow('{0}', '-1','-1'); return false;", DocumentTypeSetting); }