示例#1
0
        private void btSub_Click(object sender, EventArgs e)
        {
            DojoClass selectedClass = new DojoClass(selectedID);

            selectedClass.Instructor = DojoMember.NewPlaceHolder(int.Parse(ddInstructors.SelectedItem.Value));
            selectedClass.Save();
            selectedID = 0;
        }
示例#2
0
        private void btSwitch_Click(object sender, EventArgs e)
        {
            DojoClass           selectedClass    = new DojoClass(selectedID);
            DojoClassDefinition parentDefinition = selectedClass.ParentDefinition;

            // BUGFIX... DO NOT REMOVE!
            // FOR SOME REASON THE INSTRUCTOR IS NOT CHANGED IF THIS HAS NOT BEEN LOADED.
            // WTF!
            parentDefinition.EnsurePreLoad();

            selectedClass.Instructor    = DojoMember.NewPlaceHolder(int.Parse(ddInstructors.SelectedItem.Value));
            parentDefinition.Instructor = selectedClass.Instructor;

            selectedClass.Save();
            parentDefinition.Save();

            selectedID = 0;
        }
示例#3
0
        public override void ProcessCommand(string command, string parameters)
        {
            switch (command)
            {
            case "copy":
                this.copyID = this.selectedID;
                break;

            case "paste":
                if (this.copyID != -1)
                {
                    DojoClass srcClass  = new DojoClass(this.copyID);
                    DojoClass destClass = new DojoClass(this.selectedID);

                    // Copy class times only across days
                    if (srcClass.ClassStart.Date != destClass.ClassStart.Date)
                    {
                        destClass.ClassStart = new DateTime(destClass.ClassStart.Year,
                                                            destClass.ClassStart.Month,
                                                            destClass.ClassStart.Day,
                                                            srcClass.ClassStart.Hour,
                                                            srcClass.ClassStart.Minute,
                                                            srcClass.ClassStart.Second,
                                                            srcClass.ClassStart.Millisecond);
                        destClass.ClassEnd = new DateTime(destClass.ClassEnd.Year,
                                                          destClass.ClassEnd.Month,
                                                          destClass.ClassEnd.Day,
                                                          srcClass.ClassEnd.Hour,
                                                          srcClass.ClassEnd.Minute,
                                                          srcClass.ClassEnd.Second,
                                                          srcClass.ClassEnd.Millisecond);
                    }
                    destClass.Name       = srcClass.Name;
                    destClass.Instructor = srcClass.Instructor;

                    // TODO: Check parent definition to see if this copied class falls in the definition specs.
                    destClass.ParentDefinition = null;
                    destClass.ParentSeminar    = srcClass.ParentSeminar;
                    destClass.Location         = srcClass.Location;
                    destClass.Save();
                }
                break;
            }
        }
示例#4
0
        protected void ok_Click(object sender, EventArgs e)
        {
            if (dojoClassID == 0)
            {
                obj = new DojoClass();
            }
            else
            {
                obj = new DojoClass(dojoClassID);
            }

            obj.Name = tbName.Text;
            if (comboInstructor.SelectedItem != null && comboInstructor.SelectedItem.Value != "Null")
            {
                obj.Instructor = DojoMember.NewPlaceHolder(
                    int.Parse(comboInstructor.SelectedItem.Value));
            }
            else
            {
                obj.Instructor = null;
            }

            if (comboParentSeminar.SelectedItem != null && comboParentSeminar.SelectedItem.Value != "Null")
            {
                obj.ParentSeminar = DojoSeminar.NewPlaceHolder(
                    int.Parse(comboParentSeminar.SelectedItem.Value));
            }
            else
            {
                obj.ParentSeminar = null;
            }

            if (comboParentDefinition.SelectedItem != null && comboParentDefinition.SelectedItem.Value != "Null")
            {
                obj.ParentDefinition = DojoClassDefinition.NewPlaceHolder(
                    int.Parse(comboParentDefinition.SelectedItem.Value));
            }
            else
            {
                obj.ParentDefinition = null;
            }

            if (comboLocation.SelectedItem != null && comboLocation.SelectedItem.Value != "Null")
            {
                obj.Location = GreyFoxContact.NewPlaceHolder("kitTessen_Locations",
                                                             int.Parse(comboLocation.SelectedItem.Value));
            }
            else
            {
                obj.Location = null;
            }

            if (comboAccessControlGroup.SelectedItem != null && comboAccessControlGroup.SelectedItem.Value != "Null")
            {
                obj.AccessControlGroup = DojoAccessControlGroup.NewPlaceHolder(
                    int.Parse(comboAccessControlGroup.SelectedItem.Value));
            }
            else
            {
                obj.AccessControlGroup = null;
            }

            obj.OccupancyMax       = int.Parse(tbOccupancyMax.Text);
            obj.OccupancyTarget    = int.Parse(tbOccupancyTarget.Text);
            obj.OccupancyCurrent   = int.Parse(tbOccupancyCurrent.Text);
            obj.OccupancyCheckDate = DateTime.Parse(tbOccupancyCheckDate.Text);
            obj.SigninStart        = DateTime.Parse(tbSigninStart.Text);
            obj.SigninEnd          = DateTime.Parse(tbSigninEnd.Text);
            obj.ClassStart         = DateTime.Parse(tbClassStart.Text);
            obj.ClassEnd           = DateTime.Parse(tbClassEnd.Text);
            if (editOnAdd)
            {
                dojoClassID = obj.Save();
            }
            else
            {
                obj.Save();
            }

            if (resetOnAdd)
            {
                tbName.Text                           = string.Empty;
                tbOccupancyMax.Text                   = string.Empty;
                tbOccupancyTarget.Text                = string.Empty;
                tbOccupancyCurrent.Text               = string.Empty;
                tbOccupancyCheckDate.Text             = DateTime.Now.ToString();
                tbSigninStart.Text                    = DateTime.Now.ToString();
                tbSigninEnd.Text                      = DateTime.Now.ToString();
                tbClassStart.Text                     = DateTime.Now.ToString();
                tbClassEnd.Text                       = DateTime.Now.ToString();
                comboInstructor.SelectedIndex         = 0;
                comboParentSeminar.SelectedIndex      = 0;
                comboParentDefinition.SelectedIndex   = 0;
                comboLocation.SelectedIndex           = 0;
                comboAccessControlGroup.SelectedIndex = 0;
            }

            OnUpdated(EventArgs.Empty);
        }