Ejemplo n.º 1
0
        protected override void OnLoad(EventArgs e)
        {
            DojoMemberTypeTemplateManager    m;
            DojoMemberTypeTemplateCollection templates;

            ComponentArt.Web.UI.TreeViewNode node;

            base.OnLoad(e);
            EnsureChildControls();

            if (tree.Nodes.Count == 0)
            {
                node          = new ComponentArt.Web.UI.TreeViewNode();
                node.Text     = "Member Type Templates";
                node.ImageUrl = "./images/tree/root.gif";
                node.Expanded = true;
                tree.Nodes.Add(node);

                m         = new DojoMemberTypeTemplateManager();
                templates = m.GetCollection(string.Empty, "Name, CreateDate", null);

                TreeMaker.Make(templates, TreeMaker.MakeMode.Collapse);

                foreach (DojoMemberTypeTemplate template in templates)
                {
                    if (template.parent == null)
                    {
                        addTemplate(node, template);
                    }
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Duplicates DojoMemberTypeTemplate object into a database; may or may not be the same database
        /// as the parent object.
        /// </summary>
        /// <returns> A new DojoMemberTypeTemplate object reflecting the replicated DojoMemberTypeTemplate object.</returns>
        public DojoMemberTypeTemplate Duplicate()
        {
            DojoMemberTypeTemplate clonedDojoMemberTypeTemplate = this.Clone();

            // Insert must be called after children are replicated!
            clonedDojoMemberTypeTemplate.iD       = DojoMemberTypeTemplateManager._insert(clonedDojoMemberTypeTemplate);
            clonedDojoMemberTypeTemplate.isSynced = true;
            return(clonedDojoMemberTypeTemplate);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Ensures that the object's fields and children are
        /// pre-loaded before any updates or reads.
        /// </summary>
        public void EnsurePreLoad()
        {
            if (!isPlaceHolder)
            {
                return;
            }

            DojoMemberTypeTemplateManager._fill(this);
            isPlaceHolder = false;
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Saves the DojoMemberTypeTemplate object state to the database.
        /// </summary>
        public int Save()
        {
            if (isSynced)
            {
                return(iD);
            }

            if (iD == -1)
            {
                throw (new Exception("Invalid record; cannot be saved."));
            }
            if (iD == 0)
            {
                iD = DojoMemberTypeTemplateManager._insert(this);
            }
            else
            {
                DojoMemberTypeTemplateManager._update(this);
            }
            isSynced = iD != -1;
            return(iD);
        }
Ejemplo n.º 5
0
        public void LoadDefaults()
        {
            DojoAccessControlGroupCollection accessControls;

            DojoAttendanceEntryCollection     attendanceEntries;
            DojoBulkAttendanceEntryCollection bulkAttendances;
            DojoClassCollection           classes;
            DojoClassDefinitionCollection classDefinitions;

            DojoMemberCollection             members;
            DojoMembershipCollection         memberships;
            DojoMembershipTemplateCollection membershipTemplates;
            DojoMemberTypeCollection         memberTypes;
            DojoMemberTypeTemplateCollection memberTypeTemplates;
            DojoOrganizationCollection       organizations;

            DojoPromotionCollection                promotions;
            DojoPromotionFlagCollection            promotionFlags;
            DojoPromotionStatusCollection          promotionStatuses;
            DojoRankCollection                     ranks;
            DojoTestCollection                     tests;
            DojoTestListCollection                 testLists;
            DojoTestListJournalEntryCollection     testListJournalEntries;
            DojoTestListJournalEntryTypeCollection testListJournalEntryTypes;
            DojoTestListStatusCollection           testListStatuses;

            DojoSeminarCollection                   seminars;
            DojoSeminarOptionCollection             seminarOptions;
            DojoSeminarRegistrationCollection       seminarRegistrations;
            DojoSeminarRegistrationOptionCollection seminarRegistrationOptions;

            GreyFoxContactCollection locations;

            accessControls = new DojoAccessControlGroupCollection();

            attendanceEntries = new DojoAttendanceEntryCollection();
            bulkAttendances   = new DojoBulkAttendanceEntryCollection();
            classes           = new DojoClassCollection();
            classDefinitions  = new DojoClassDefinitionCollection();

            members             = new DojoMemberCollection();
            memberships         = new DojoMembershipCollection();
            membershipTemplates = new DojoMembershipTemplateCollection();
            memberTypes         = new DojoMemberTypeCollection();
            memberTypeTemplates = new DojoMemberTypeTemplateCollection();
            organizations       = new DojoOrganizationCollection();

            promotions                = new DojoPromotionCollection();
            promotionFlags            = new DojoPromotionFlagCollection();
            promotionStatuses         = new DojoPromotionStatusCollection();
            ranks                     = new DojoRankCollection();
            tests                     = new DojoTestCollection();
            testLists                 = new DojoTestListCollection();
            testListJournalEntries    = new DojoTestListJournalEntryCollection();
            testListJournalEntryTypes = new DojoTestListJournalEntryTypeCollection();
            testListStatuses          = new DojoTestListStatusCollection();

            seminars                   = new DojoSeminarCollection();
            seminarOptions             = new DojoSeminarOptionCollection();
            seminarRegistrations       = new DojoSeminarRegistrationCollection();
            seminarRegistrationOptions = new DojoSeminarRegistrationOptionCollection();

            locations = new GreyFoxContactCollection();

            organizations       = new DojoOrganizationManager().GetCollection(string.Empty, string.Empty, null);
            memberTypes         = new DojoMemberTypeManager().GetCollection(string.Empty, string.Empty);
            memberTypeTemplates = new DojoMemberTypeTemplateManager().GetCollection(string.Empty, string.Empty, null);
            ranks = new DojoRankManager().GetCollection(string.Empty, string.Empty, null);
            membershipTemplates = new DojoMembershipTemplateManager().GetCollection(string.Empty, string.Empty, null);

            Dictionary <string, DojoMemberType> memberTypesDictionary =
                new Dictionary <string, DojoMemberType>();

            foreach (DojoMemberType memberType in memberTypes)
            {
                memberTypesDictionary.Add(memberType.Name, memberType);
            }
            Dictionary <string, DojoMemberTypeTemplate> memberTypeTemplatesDictionary =
                new Dictionary <string, DojoMemberTypeTemplate>();

            foreach (DojoMemberTypeTemplate typeTemplate in memberTypeTemplates)
            {
                memberTypeTemplatesDictionary.Add(typeTemplate.Name, typeTemplate);
            }
            Dictionary <string, DojoRank> ranksDictionary =
                new Dictionary <string, DojoRank>();

            foreach (DojoRank rank in ranks)
            {
                ranksDictionary.Add(rank.Name, rank);
            }
            Dictionary <string, DojoMembershipTemplate> membershipTemplatesDictionary =
                new Dictionary <string, DojoMembershipTemplate>();

            foreach (DojoMembershipTemplate template in membershipTemplates)
            {
                membershipTemplatesDictionary.Add(template.Name, template);
            }

            CsvParser.CsvStream csv =
                CsvParser.StreamParse(Localization.Defaults.Defaults_en_US, false);
            string rowType;

            string[] r = csv.GetNextRow();
            while (r != null)
            {
                rowType = r[0];

                if (rowType == Localization.Defaults.CSVMembershipTemplate)
                {
                    DojoMembershipTemplate template =
                        TessenFactory.MembershipTemplate(
                            r[1], r[2],
                            bool.Parse(r[3]), bool.Parse(r[4]), bool.Parse(r[5]),
                            decimal.Parse(r[6]), decimal.Parse(r[7]),
                            (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[8]),
                            (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[9]),
                            DojoOrganization.NewPlaceHolder(0),
                            1,
                            int.Parse(r[11]), int.Parse(r[12]), decimal.Parse(r[13]), (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[14]),
                            int.Parse(r[15]), int.Parse(r[16]), decimal.Parse(r[17]), (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[18]),
                            int.Parse(r[19]), int.Parse(r[20]), decimal.Parse(r[21]), (DojoMembershipDayType)Enum.Parse(typeof(DojoMembershipDayType), r[22]),
                            int.Parse(r[23]), int.Parse(r[24]),
                            int.Parse(r[25]), int.Parse(r[26]),
                            ranksDictionary.ContainsKey(r[27]) ? ranksDictionary[r[27]] : null,
                            ranksDictionary.ContainsKey(r[28]) ? ranksDictionary[r[28]] : null);
                    membershipTemplates.Add(template);
                    membershipTemplatesDictionary.Add(template.Name, template);
                    template.Save();
                }
                else if (rowType == Localization.Defaults.CSVMemberTypeTemplate)
                {
                    DojoMemberTypeTemplate template = TessenFactory.MemberTypeTemplate(
                        r[1], r[2],
                        memberTypeTemplatesDictionary.ContainsKey(r[3].ToString()) ? memberTypeTemplatesDictionary[r[3]] : null,
                        memberTypesDictionary.ContainsKey(r[4]) ? memberTypesDictionary[r[4]] : null,
                        bool.Parse(r[5]), bool.Parse(r[6]), bool.Parse(r[7]), bool.Parse(r[8]),
                        int.Parse(r[9]), int.Parse(r[10]),
                        int.Parse(r[11]), int.Parse(r[12]),
                        ranksDictionary.ContainsKey(r[13]) ? ranksDictionary[r[13]] : null,
                        ranksDictionary.ContainsKey(r[14]) ? ranksDictionary[r[14]] : null,
                        membershipTemplatesDictionary.ContainsKey(r[15]) ? membershipTemplatesDictionary[r[15]] : null,
                        membershipTemplatesDictionary.ContainsKey(r[16]) ? membershipTemplatesDictionary[r[16]] : null,
                        membershipTemplatesDictionary.ContainsKey(r[17]) ? membershipTemplatesDictionary[r[17]] : null,
                        membershipTemplatesDictionary.ContainsKey(r[18]) ? membershipTemplatesDictionary[r[18]] : null,
                        membershipTemplatesDictionary.ContainsKey(r[19]) ? membershipTemplatesDictionary[r[19]] : null);
                    memberTypeTemplates.Add(template);
                    memberTypeTemplatesDictionary.Add(template.Name, template);
                    template.Save();
                }

                r = csv.GetNextRow();
            }
        }
Ejemplo n.º 6
0
        private static void compileTask(object type)
        {
            if (type == null)
            {
                return;
            }

            if (type == typeof(DojoMemberTypeTemplateCollection) |
                type == typeof(DojoMemberTypeTemplate))
            {
                DojoMemberTypeTemplateCollection templates =
                    new DojoMemberTypeTemplateManager().GetCollection(
                        string.Empty,
                        string.Empty,
                        null);

                lock (lockObject)
                {
                    itemCount = templates.Count;
                }

                TreeMaker.Make(templates, TreeMaker.MakeMode.Flat);
                Build(templates);

                for (int i = 0; i < templates.Count; i++)
                {
                    lock (lockObject)
                    {
                        itemNumber = i;
                    }

                    if (abortRequest)
                    {
                        break;
                    }

                    templates[i].MemberTypeTreeHash = templates[i].treeHash;
                    templates[i].Root = templates[i].treeRoot;
                    templates[i].Save();
                }
            }
            else if (type == typeof(DojoMemberCollection) |
                     type == typeof(DojoMember))
            {
                DojoMemberCollection members =
                    new DojoMemberManager().GetCollection(
                        string.Empty,
                        "PrivateContact.LastName, PrivateContact.FirstName, PrivateContact.MiddleName",
                        DojoMemberFlags.PrivateContact);

                lock (lockObject)
                {
                    itemCount = members.Count;
                }

                TreeMaker.Make(members, TreeMaker.MakeMode.Flat);
                Build(members);

                for (int i = 0; i < members.Count; i++)
                {
                    lock (lockObject)
                    {
                        itemNumber = i;
                    }
                    if (abortRequest)
                    {
                        break;
                    }

                    members[i].MemberTypeTreeHash = members[i].treeHash;
                    members[i].Root = members[i].treeRoot;
                    members[i].Save();
                }
            }

            lock (lockObject)
            {
                isCompiling = false;
            }
        }
Ejemplo n.º 7
0
 /// <summary>
 /// Overwrites and existing DojoMemberTypeTemplate object in the database.
 /// </summary>
 public void Overwrite(int id)
 {
     iD = id;
     DojoMemberTypeTemplateManager._update(this);
     isSynced = true;
 }
Ejemplo n.º 8
0
 public void Delete()
 {
     DojoMemberTypeTemplateManager._delete(this.iD);
     this.iD  = 0;
     isSynced = false;
 }
Ejemplo n.º 9
0
 public DojoMemberTypeTemplate(int id)
 {
     this.iD  = id;
     isSynced = DojoMemberTypeTemplateManager._fill(this);
 }
Ejemplo n.º 10
0
        private void bind()
        {
            DojoMemberManager    dojoMemberManager    = new DojoMemberManager();
            DojoMemberCollection dojoMemberCollection = dojoMemberManager.GetCollection(string.Empty, string.Empty);

            foreach (DojoMember itemObject in dojoMemberCollection)
            {
                ComponentArt.Web.UI.ComboBoxItem item = new ComponentArt.Web.UI.ComboBoxItem();
                item.Text  = itemObject.ToString();
                item.Value = itemObject.ID.ToString();
                comboMember.Items.Add(item);
            }


            DojoOrganizationManager    dojoOrganizationManager    = new DojoOrganizationManager();
            DojoOrganizationCollection dojoOrganizationCollection = dojoOrganizationManager.GetCollection(string.Empty, string.Empty);

            foreach (DojoOrganization itemObject in dojoOrganizationCollection)
            {
                ComponentArt.Web.UI.ComboBoxItem item = new ComponentArt.Web.UI.ComboBoxItem();
                item.Text  = itemObject.ToString();
                item.Value = itemObject.ID.ToString();
                comboOrganization.Items.Add(item);
            }


            DojoMembershipManager    dojoMembershipManager    = new DojoMembershipManager();
            DojoMembershipCollection dojoMembershipCollection = dojoMembershipManager.GetCollection(string.Empty, string.Empty);

            ddParent.Items.Add(new ListItem("             ", "null"));
            foreach (DojoMembership itemObject in dojoMembershipCollection)
            {
                ddParent.Items.Add(new ListItem(itemObject.ToString(), itemObject.ID.ToString()));
            }


            DojoMemberTypeTemplateManager    dojoMemberTypeTemplateManager    = new DojoMemberTypeTemplateManager();
            DojoMemberTypeTemplateCollection dojoMemberTypeTemplateCollection = dojoMemberTypeTemplateManager.GetCollection(string.Empty, string.Empty);

            foreach (DojoMemberTypeTemplate itemObject in dojoMemberTypeTemplateCollection)
            {
                ComponentArt.Web.UI.ComboBoxItem item = new ComponentArt.Web.UI.ComboBoxItem();
                item.Text  = itemObject.ToString();
                item.Value = itemObject.ID.ToString();
                comboMemberTypeTemplate.Items.Add(item);
            }


            DojoMembershipTemplateManager    dojoMembershipTemplateManager    = new DojoMembershipTemplateManager();
            DojoMembershipTemplateCollection dojoMembershipTemplateCollection = dojoMembershipTemplateManager.GetCollection(string.Empty, string.Empty);

            foreach (DojoMembershipTemplate itemObject in dojoMembershipTemplateCollection)
            {
                ComponentArt.Web.UI.ComboBoxItem item = new ComponentArt.Web.UI.ComboBoxItem();
                item.Text  = itemObject.ToString();
                item.Value = itemObject.ID.ToString();
                comboMembershipTemplate.Items.Add(item);
            }



            RHInvoiceLineManager    rHInvoiceLineManager    = new RHInvoiceLineManager();
            RHInvoiceLineCollection rHInvoiceLineCollection = rHInvoiceLineManager.GetCollection(string.Empty, string.Empty);

            ddInvoiceLine.Items.Add(new ListItem("             ", "null"));
            foreach (RHInvoiceLine itemObject in rHInvoiceLineCollection)
            {
                ddInvoiceLine.Items.Add(new ListItem(itemObject.ToString(), itemObject.ID.ToString()));
            }
        }