Esempio n. 1
0
        static void Controller_1()
        {
            //hard-code new issue mapping
            ObjectMappingEntry entry;

            entry                    = new ObjectMappingEntry();
            entry.Action             = ControllerActions.View;
            entry.BusinessObjectName = "IssueCollection";
            entry.Viewer             = "WinUI.FormIssueSummary";
            _ObjectMappings.Add(entry);

            entry                    = new ObjectMappingEntry();
            entry.Action             = ControllerActions.View;
            entry.BusinessObjectName = "Issue";
            entry.Viewer             = "WinUI.FormIssueDetails";
            _ObjectMappings.Add(entry);

            entry                    = new ObjectMappingEntry();
            entry.Action             = ControllerActions.New;
            entry.BusinessObjectName = "Issue";
            entry.Viewer             = "WinUI.FormIssueDetails";
            _ObjectMappings.Add(entry);

            return;
        }
Esempio n. 2
0
        static Controller()
        {
            ObjectMappingEntry entry;

            XmlDocument xmldoc = new XmlDocument();

            xmldoc.Load("WinUI.exe.config");
            XmlNode root = xmldoc.DocumentElement;

            try
            {
                XmlNodeList xnodelist =
                    root.SelectNodes("/configuration/Viewers/Include");

                foreach (XmlNode xnode in xnodelist)
                {
                    //create a new entry object
                    entry = new ObjectMappingEntry();

                    //translate the integer into a ControllerAction
                    switch (int.Parse(xnode.Attributes["Action"].Value))
                    {
                    case 1:
                        entry.Action = ControllerActions.New;
                        break;

                    case 2:
                        entry.Action = ControllerActions.View;
                        break;

                    case 3:
                        entry.Action = ControllerActions.Edit;
                        break;

                    case 4:
                        entry.Action = ControllerActions.Delete;
                        break;
                    }

                    //set the BusinessObjectName
                    entry.BusinessObjectName =
                        xnode.Attributes["BusinessObjectName"].Value;

                    //set the viewer name
                    entry.Viewer = xnode.Attributes["Viewer"].Value;

                    //add this mapping to the collection
                    _ObjectMappings.Add(entry);
                }
            }
            catch (Exception x)
            {
                EventLog systemLog = new EventLog();
                systemLog.Source = "IssueTracker";
                systemLog.WriteEntry(x.Message, EventLogEntryType.Error, 0);
            }

            return;
        }