コード例 #1
0
 public void AddEventTest()
 {
     //int AddEvent(int moduleId, int itemId, String userName, String title, DateTime expireDate,
     //         String description, String wherewhen)
     DesktopModulesFacade facade = new DesktopModulesFacade();
     PortalEvent portalevent = new PortalEvent();
     portalevent.ModuleID = 0;
     portalevent.ItemID = 0;
     portalevent.CreatedByUser = "******";
     portalevent.Title = "t";
     portalevent.ExpireDate = new DateTime(2011, 1, 1);
     portalevent.Description = "d";
     portalevent.WhereWhen = "ww";
     facade.AddEvent(portalevent);
 }
コード例 #2
0
        public int AddEvent(PortalEvent portalevent)
        {
            // TODO: add access security here..
            // TODO: add argument validation here..

            int retval;
            // Run within the context of a database transaction.
            // The Decorator Design Pattern.
            using (TransactionDecorator transaction = new TransactionDecorator())
            {
                retval = eventsDAO.AddEvent(portalevent.ModuleID, portalevent.ItemID, portalevent.CreatedByUser,
                                            portalevent.Title, portalevent.ExpireDate.Value,
                                            portalevent.Description, portalevent.WhereWhen);
                transaction.Complete();
            }
            return retval;
        }
コード例 #3
0
        //****************************************************************
        //
        // The UpdateBtn_Click event handler on this Page is used to either
        // create or update an event.  It uses the Nairc.KPWPortal.EventsDB()
        // data component to encapsulate all data functionality.
        //
        //****************************************************************
        protected void UpdateBtn_Click(Object sender, EventArgs e)
        {
            // Only Update if the Entered Data is Valid
            if (Page.IsValid == true)
            {
                IDesktopModulesFacade facade = new DesktopModulesFacade();
                PortalEvent portalevent = new PortalEvent();
                portalevent.ModuleID =moduleId;
                portalevent.ItemID =itemId;
                portalevent.CreatedByUser =Context.User.Identity.Name;
                portalevent.Title =TitleField.Text;
                portalevent.ExpireDate =DateTime.Parse(ExpireField.Text);
                portalevent.Description =DescriptionField.Text;
                portalevent.WhereWhen =WhereWhenField.Text;

                if (itemId == 0)
                {
                    // Add the event within the Events table
                    facade.AddEvent(portalevent);
                }
                else
                {
                    // Update the event within the Events table
                    facade.UpdateEvent(portalevent);
                }

                // Redirect back to the portal home page
                Response.Redirect((String) ViewState["UrlReferrer"]);
            }
        }