示例#1
0
        protected void Page_PreRender( object sender, EventArgs e )
        {
            if ( Global.DefEventLoadedWptsCount == 0 )
              {
            TrackerDataSetTableAdapters.GroupTableAdapter groupTableAdapter =
              new TrackerDataSetTableAdapters.GroupTableAdapter( );

            int totalUserGroupsCount = groupTableAdapter.GetUserGroupsCount( Global.UserId ).Value;

            if ( totalUserGroupsCount == 0 )
            {
              this.waypointsMultiView.SetActiveView( this.noGroupAtAll );
            }
            else
            {
              this.waypointsMultiView.SetActiveView( this.waypointsNotLoadedView );
            }
            this.taskMultiView.Visible = false;
              }
              else
              {
            this.taskMultiView.Visible = true;
            this.waypointsMultiView.SetActiveView( this.waypointsLoadedView );
            if ( Global.DefEventTaskWptsCount == 0 )
            {
              this.taskMultiView.SetActiveView( this.taskNotSetView );
            }
            else
            {
              this.taskMultiView.SetActiveView( this.taskSetupView );
            }

            this.oneWptWarningLabel.Visible = Global.DefEventTaskWptsCount == 1;
              }
        }
示例#2
0
        protected void assignedGroupsCheckBoxList_DataBound(object sender, EventArgs e)
        {
            TrackerDataSetTableAdapters.GroupTableAdapter groupTableAdapter = new TrackerDataSetTableAdapters.GroupTableAdapter();
              TrackerDataSet.GroupDataTable assignedGroups = groupTableAdapter.GetAssignedGroups(Global.UserId, EventId);

              foreach (ListItem li in assignedGroupsCheckBoxList.Items)
              {
            int groupId = int.Parse(li.Value);
            li.Selected = assignedGroups.FindById(groupId) != null;
              }
        }
示例#3
0
        protected void eventsGridView_RowDataBound( object sender , GridViewRowEventArgs e )
        {
            if ( e.Row.RowType == DataControlRowType.EmptyDataRow )
              {
            MultiView noEventMultiView = e.Row.FindControl( "noEventMultiView" ) as MultiView;
            if ( noEventMultiView != null )
            {
              TrackerDataSetTableAdapters.GroupTableAdapter groupTableAdapter =
            new TrackerDataSetTableAdapters.GroupTableAdapter( );

              int totalUserGroupsCount = groupTableAdapter.GetUserGroupsCount( Global.UserId ).Value;

              if ( totalUserGroupsCount == 0 )
              {
            noEventMultiView.ActiveViewIndex = 0;
              }
              else
              {
            noEventMultiView.ActiveViewIndex = 1;

            // for some reason it's possible that in case of the empty grid
            // there were some data and RowType was equal to DataControlRowType.DataRow.
            // So roll back everything we possible did in this case:
            this.createEventPanel.Visible = false;
            this.defaultAnnotationPanel.Visible = false;
            this.switchToSingleEventModePanel.Visible = false;
              }
            }
              }
              else if ( e.Row.RowType == DataControlRowType.DataRow )
              {
            // !!!!!!!!!!!!!!!!!!
            // See above actions for EmptyDataRow. It's possible that everything that we're
            // doing here will need a roll back. So if anything is made visible here - hide it
            // in the case for EmptyDataRow above.
            // !!!!!!!!!!!!!!!!!!
            DataRowView drv = e.Row.DataItem as DataRowView;
            if ( ( bool ) drv[ "IsDefault" ] )
            {
              this.defaultAnnotationPanel.Visible = true;
            }
            this.switchToSingleEventModePanel.Visible = true;
            this.createEventPanel.Visible = true;
              }
        }
示例#4
0
        protected void savePublicOptionChangeButton_Click( object sender, EventArgs e )
        {
            TrackerDataSetTableAdapters.GroupTableAdapter adapter = new TrackerDataSetTableAdapters.GroupTableAdapter( );

              string newIsPublicValueStr = this.publicOptionRadioButtonList.SelectedValue;
              bool newIsPublicValue;
              if ( newIsPublicValueStr == "public" )
              {
            newIsPublicValue = true;
              }
              else if ( newIsPublicValueStr == "unlisted" )
              {
            newIsPublicValue = false;
              }
              else
              {
            throw new InvalidOperationException( string.Format( "Unknown public option value '{0}'", newIsPublicValueStr ) );
              }

              this.groupTable[0].IsPublic = newIsPublicValue;
              adapter.Update( this.groupTable );
              this.publicOptionMultiView.SetActiveView( this.dispayPublicOptionView );
        }
示例#5
0
        protected void assignGroupsButton_Click(object sender, EventArgs e)
        {
            if (groupsPanelMultiView.GetActiveView() == defaultGroupPanelView)
              {
            groupsPanelMultiView.SetActiveView(expandedGroupPanelView);
              }

              if (assignedTaskMultiView.GetActiveView() != assignedTaskEditView)
              {
            assignedTaskMultiView.SetActiveView(assignedTaskEditView);

            // If "default Event controls" was in edit mode, cancel any changes and return it to the read mode:
            defaultEventControlsMultiView.SetActiveView(defaultEventReadView);
              }
              else
              {
            bool isChanged = false;
            if (sender == assignGroupsSaveButton)
            {
              TrackerDataSetTableAdapters.GroupTableAdapter groupTableAdapter = new TrackerDataSetTableAdapters.GroupTableAdapter();
              TrackerDataSet.GroupDataTable userGroups = groupTableAdapter.GetDataByUserId(Global.UserId);

              int tempAssignedGroupsCount = 0;
              foreach (ListItem li in assignedGroupsCheckBoxList.Items)
              {
            int groupId = int.Parse(li.Value);
            TrackerDataSet.GroupRow groupRow = userGroups.FindById(groupId);

            // Note that the content of assignedGroupsCheckBoxList came from the ViewState, and the group
            // can be actually deleted by that time (or replaced in ViewState by another user's group). So check
            // if it's valid group to prevent NullReferenceExcpetion:
            if (groupRow == null)
              continue;

            if (li.Selected)
            {
              tempAssignedGroupsCount++;
              if (groupRow.IsEventIdNull() ||
                   groupRow.EventId != EventId)
                groupRow.EventId = EventId;
            }
            else
            {
              if (!groupRow.IsEventIdNull() &&
                   groupRow.EventId == EventId)
              {
                groupRow.SetEventIdNull();
              }
            }
              }

              int updatedRecords = groupTableAdapter.Update(userGroups);
              _assignedGroupsCount = tempAssignedGroupsCount;
              isChanged = updatedRecords > 0;
              if (isChanged)
              {
            TrackerDataSetTableAdapters.ProcsAdapter procsAdapter = new TrackerDataSetTableAdapters.ProcsAdapter();
            procsAdapter.SetEventAsDefault(EventId);

            // We just set event as default in the DB - now we need to update this.IsEventDefault that is used in the markup
            IsEventDefault = true;
              }
            }

            SetAssignedGroupsReadView();
            SetNoGroupWarningVisibility();
            if (isChanged)
            {
              assignedGroupsGridView.DataBind();
            }
              }
        }
示例#6
0
        protected void Page_PreInit(object sender, EventArgs e)
        {
            string strEventId = Request.QueryString["event"];
              int eventId;

              if (strEventId != null && int.TryParse(strEventId, out eventId))
              {
            // To make sure that there is no hacking, check that the event
            // belongs to the current user before setting this.EventId property:
            if (Global.IsAuthenticated)
            {
              TrackerDataSetTableAdapters.EventTableAdapter eventAdapter = new TrackerDataSetTableAdapters.EventTableAdapter();
              TrackerDataSet.EventDataTable eventTable = eventAdapter.GetDataByEventId(eventId);
              if (eventTable.Count > 0)
              {
            if (Global.UserId == eventTable[0].UserId)
            {
              _eventRow = eventTable[0];
              EventId = _eventRow.Id;
              IsEventDefault = _eventRow.IsDefault;
            }
              }
            }
              }

              if (EventId == 0)
              {
            Response.Redirect("~/default.aspx", true);
              }
              else if (Global.IsSimpleEventsModel && !_eventRow.IsDefault)
              {
            Response.Redirect("~/default.aspx", true);
              }
              else
              {
            LoadAllWaypoints();

            TrackerDataSetTableAdapters.GroupTableAdapter groupTableAdapter = new TrackerDataSetTableAdapters.GroupTableAdapter();
            _assignedGroupsCount =
              groupTableAdapter.GetAssignedGroupsCount(Global.UserId, EventId) ?? 0;

            if (!IsPostBack)
            {
              SetAssignedGroupsReadView();
              SetNoGroupWarningVisibility();
            }
              }
        }