Exemple #1
0
        protected override void OnElementChanged(ElementChangedEventArgs <Label> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement == null)
            {
                return;
            }

//			var element = this.Element as DurationPicker;

            if (Element != null)
            {
                picker = (DurationPicker)Element;
//				TimeInMins = element.Time;
                picker.ShowAction = new Action(Show);
            }
        }
    public void OkButton_Click(object sender, EventArgs e)
    {
        RadioButton    rbLead           = null;
        DurationPicker ReminderDuration = null;

        TabWorkspace ActivityTabs = PageWorkItem.Workspaces["TabControl"] as TabWorkspace;

        if (ActivityTabs != null)
        {
            Control tabControl = ActivityTabs.GetSmartPartByID("ActivityDetails");
            rbLead           = tabControl.FindControl("rbLead") as RadioButton;
            ReminderDuration = tabControl.FindControl("ReminderDuration") as DurationPicker;
        }

        //break associations if not on that radio button per 1-61398
        if (rbLead != null)
        {
            if (rbLead.Checked)
            {
                Activity.ContactId     = null;
                Activity.OpportunityId = null;
                Activity.TicketId      = null;
                Activity.AccountId     = null;
                Activity.ContactName   = null;
                if (Activity.LeadId == null)
                {
                    Activity.AccountName = null;
                }
                Activity.OpportunityName = null;
                Activity.TicketNumber    = null;
            }
            else
            {
                Activity.LeadName = null;
                if (Activity.AccountId == null)
                {
                    Activity.AccountName = null;
                }
                Activity.LeadId = null;
            }
        }

        // save insert mode status since save will change it
        bool insertMode = Activity.ActivityId.Length != 12;
        bool recurring  = Activity.RecurrenceState == RecurrenceState.rstOccurrence;

        if (recurring)
        {
            ActivityOccurrence occ = (ActivityOccurrence)Activity;
            if (ReminderDuration != null)
            {
                occ.ReminderDuration = ReminderDuration.Value;
            }
            occ.Save();
        }
        else
        {
            if (ReminderDuration != null)
            {
                Activity.ReminderDuration = ReminderDuration.Value;
            }
            Activity.Save();
        }

        if (insertMode)
        {
            UpdateTempAttachments();
            if (recurring)
            {
                HandleRecurringAttachments();
            }
        }

        CloseParentDialog(true);
    }
Exemple #3
0
        private void motionsDataGrid_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            if (Motions.Count == 0 || e.RowIndex == -1)
            {
                return;
            }

            switch (e.ColumnIndex)
            {
            case 0:
            {         //Proposer Column
                var result = IndexPicker.IndexPicker.ShowDialog(Council.PresentShortf, "Pick the proposer", "Proposer");
                if (result == -1)
                {
                    return;
                }

                SelectedMotion.Proposer = Council.Present[result];
                motionsDataGrid.Rows[_SelectedMotion].Cells[0].Value = SelectedMotion.Proposer.Shortf;
                break;
            }

            case 1:
            {         //Motion Column
                var result = IndexPicker.IndexPicker.ShowDialog(Council.MotionsAsList.Select(x => x.Name).ToArray(),
                                                                "Pick the type of motion", "Motion");
                if (result == -1)
                {
                    return;
                }

                SelectedMotion.Internal = Council.MotionsAsList[result];
                MotionRow(SelectedMotion, _SelectedMotion);
                break;
            }

            case 2:
            {
                //Duration Column
                if (!SelectedMotion.HasDuration)
                {
                    return;
                }

                var result = DurationPicker.ShowDialog("New Duration", "Select the new duration", SelectedMotion.Duration);
                if (result == TimeSpan.Zero)
                {
                    return;
                }

                SelectedMotion.Duration = result;
                MotionRow(SelectedMotion, _SelectedMotion);
                break;
            }

            case 3:
            {
                //Speaking Time Column
                if (!SelectedMotion.HasSpeakTime)
                {
                    return;
                }
                var result = DurationPicker.ShowDialog("New speaking time", "Select the new speaking time", SelectedMotion.SpeakTime);
                if (result == TimeSpan.Zero)
                {
                    return;
                }

                SelectedMotion.Duration = result;
                MotionRow(SelectedMotion, _SelectedMotion);
                break;
            }

            case 4:
            {
                //Topic Column
                if (!SelectedMotion.HasTopic)
                {
                    motionsDataGrid.Rows[_SelectedMotion].Cells[4].Value = "-";
                    return;
                }

                SelectedMotion.Topic = motionsDataGrid.Rows[_SelectedMotion].Cells[4].Value.ToString();
                break;
            }

            case 5:
            {         //Pass fail column
                foreach (var each in motionsStateMenuStrip.Items)
                {
                    ((ToolStripMenuItem)each).Checked = false;
                }

                ((ToolStripMenuItem)motionsStateMenuStrip.Items[(int)SelectedMotion.State]).Checked = true;
                motionsStateMenuStrip.Show(PointToClient(Cursor.Position));
                break;
            }
            }
        }