コード例 #1
0
        int FindPromotionRequest(int occurrenceAttendanceID)
        {
            PromotionRequestCollection prc = new PromotionRequestCollection();


            prc.LoadCurrentWebRequests(TopicAreaID.ToString(), "primary", CampusID, 100, false, -1);
            foreach (PromotionRequest promotion in prc)
            {
                try
                {
                    if (Convert.ToInt32(promotion.Title) == occurrenceAttendanceID)
                    {
                        return(promotion.PromotionRequestID);
                    }
                }
                catch { }
            }

            return(-1);
        }
コード例 #2
0
        public void dgNote_ReBind(object sender, EventArgs e)
        {
            PromotionRequestCollection prc = new PromotionRequestCollection();
            DataTable dt   = new DataTable();
            ArrayList data = new ArrayList();


            dt.Columns.Add("promotion_id");
            dt.Columns.Add("number_string");
            dt.Columns.Add("created_date");
            dt.Columns.Add("created_string");
            dt.Columns.Add("created_by");
            dt.Columns.Add("first_name");
            dt.Columns.Add("full_name");
            dt.Columns.Add("sort_name");
            dt.Columns.Add("location_name");
            dt.Columns.Add("show_name");

            prc.LoadCurrentWebRequests(TopicAreaID.ToString(), "primary", CampusID, 1000, false, -1);
            foreach (PromotionRequest promotion in prc)
            {
                OccurrenceAttendance oa;
                DataRow row = dt.NewRow();

                try
                {
                    oa = new OccurrenceAttendance(Convert.ToInt32(promotion.Title));
                    row["first_name"]    = oa.Person.FirstName;
                    row["full_name"]     = oa.Person.FullName;
                    row["sort_name"]     = oa.Person.LastName + ", " + oa.Person.FirstName;
                    row["location_name"] = oa.Occurrence.Location;
                }
                catch
                {
                    row["first_name"]    = "";
                    row["full_name"]     = "";
                    row["sort_name"]     = "";
                    row["location_name"] = "";
                }
                row["promotion_id"]   = promotion.PromotionRequestID;
                row["created_date"]   = promotion.DateCreated;
                row["created_string"] = promotion.DateCreated.ToShortDateTimeString();
                row["created_by"]     = promotion.CreatedBy;
                row["show_name"]      = false;

                //
                // Pull out the number and status of the first name.
                //
                try
                {
                    XmlDocument xdoc = new XmlDocument();
                    xdoc.LoadXml("<body>" + promotion.WebSummary + "</body>");
                    row["number_string"] = xdoc.ChildNodes[0].ChildNodes[0].ChildNodes[0].Value.ToString();
                    if (xdoc.ChildNodes[0].ChildNodes.Count == 2)
                    {
                        row["show_name"] = true;
                    }
                }
                catch
                {
                }

                dt.Rows.Add(row);
            }

            dgNote.DataSource = dt;
            dgNote.DataBind();
        }