Esempio n. 1
0
		public UserReport(User reportedUser, UserReportType reportType, User user, string hostname, string notes)
			: base(user, hostname, notes) {

			ReportedUser = reportedUser;
			ReportType = reportType;

		}
Esempio n. 2
0
        /// <summary>
        /// Parses the response received from the server.
        /// </summary>
        protected override void UnpackResponse()
        {
            base.UnpackResponse();

            // Create the streams we will be reading from.
            MemoryStream responseStream = new MemoryStream(m_responsePayload);
            BinaryReader responseReader = new BinaryReader(responseStream, Encoding.Unicode);

            // Seek past return code.
            responseReader.BaseStream.Seek(sizeof(int), SeekOrigin.Begin);

            ushort          groupCount = 0, reportCount = 0, tempLength = 0, parameterCount = 0;
            int             tempID = 0, tempTypeID = 0;
            string          tempName = string.Empty;
            UserReportType  tempType;
            UserReportGroup tempGroup;
            ReportInfo      tempReport;
            ushort          typeCount = responseReader.ReadUInt16();

            for (int iType = 0; iType < typeCount; iType++)
            {
                tempID     = responseReader.ReadInt32();
                tempLength = responseReader.ReadUInt16();
                tempName   = new string(responseReader.ReadChars(tempLength));
                tempType   = new UserReportType(tempID, tempName);
                groupCount = responseReader.ReadUInt16();
                for (int iGroup = 0; iGroup < groupCount; iGroup++)
                {
                    tempID      = responseReader.ReadInt32();
                    tempLength  = responseReader.ReadUInt16();
                    tempName    = new string(responseReader.ReadChars(tempLength));
                    tempGroup   = new UserReportGroup(tempID, tempName);
                    reportCount = responseReader.ReadUInt16();
                    for (int iReport = 0; iReport < reportCount; iReport++)
                    {
                        tempID         = responseReader.ReadInt32();
                        tempTypeID     = responseReader.ReadInt32();
                        tempLength     = responseReader.ReadUInt16();
                        tempName       = new string(responseReader.ReadChars(tempLength));
                        tempReport     = new ReportInfo(tempID, tempTypeID, tempName);
                        parameterCount = responseReader.ReadUInt16();
                        for (int iParameter = 0; iParameter < parameterCount; iParameter++)
                        {
                            tempID     = responseReader.ReadInt32();
                            tempLength = responseReader.ReadUInt16();
                            tempName   = new string(responseReader.ReadChars(tempLength));

                            tempReport.Parameters.Add(tempID, tempName);
                        }
                        tempGroup.ReportsArray.Add(tempReport);
                    }
                    tempType.UserReportGroups.Add(tempGroup.UserGroupID, tempGroup);
                }

                mReportTypes.Add(tempType.UserReportTypeID, tempType);
            }

            // Close the streams.
            responseReader.Close();
        }
Esempio n. 3
0
 internal SetUserReportList(int operatorID, int staffID, string locale,
                            UserReportType type)
 {
     m_id       = 18110;
     OperatorID = operatorID;
     StaffID    = staffID;
     Locale     = locale;
     ReportType = type;
 }
Esempio n. 4
0
        public object Create(object parent, object configContext, System.Xml.XmlNode section)
        {
            UserReportConfig config = new UserReportConfig();

            foreach (XmlNode xmlReportNode in section.ChildNodes)
            {
                switch (xmlReportNode.Name)
                {
                case "add":
                    if (xmlReportNode.Attributes["name"] == null)
                    {
                        throw new ConfigurationErrorsException("Expected 'name' attribute.", xmlReportNode);
                    }

                    if (xmlReportNode.Attributes["url"] == null)
                    {
                        throw new ConfigurationErrorsException("Expected 'url' attribute.", xmlReportNode);
                    }

                    UserReportType type = UserReportType.Global;
                    if (xmlReportNode.Attributes["type"] != null)
                    {
                        type = (UserReportType)Enum.Parse(typeof(UserReportType), xmlReportNode.Attributes["type"].Value);
                    }

                    config.Reports.Add(xmlReportNode.Attributes["name"].Value,
                                       xmlReportNode.Attributes["url"].Value,
                                       type,
                                       xmlReportNode.Attributes["infoClass"] != null?xmlReportNode.Attributes["infoClass"].Value:string.Empty);
                    break;

                case "remove":
                    if (xmlReportNode.Attributes["name"] == null)
                    {
                        throw new ConfigurationErrorsException("Expected 'name' attribute.", xmlReportNode);
                    }
                    config.Reports.Remove(xmlReportNode.Attributes["name"].Value);
                    break;

                case "clear":
                    config.Reports.Clear();
                    break;

                default:
                    break;
                }
            }

            return(config);
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UserReportInfo"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="url">The URL.</param>
        /// <param name="type">The type.</param>
        /// <param name="infoType">Type of the info.</param>
        public UserReportInfo(string name, string url, UserReportType type, string infoClass)
        {
            _name = name;
            _url = url;

            _type = type;

            _infoClass = infoClass;

            if(infoClass!=null && infoClass!= string.Empty)
            {
                try
                {
                    _info = (IUserReportInfo)AssemblyHelper.LoadObject(infoClass, typeof(IUserReportInfo));
                }
                catch(Exception ex)
                {
                    System.Diagnostics.Trace.WriteLine(ex);
                }
            }
        }
Esempio n. 6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="UserReportInfo"/> class.
        /// </summary>
        /// <param name="name">The name.</param>
        /// <param name="url">The URL.</param>
        /// <param name="type">The type.</param>
        /// <param name="infoType">Type of the info.</param>
        public UserReportInfo(string name, string url, UserReportType type, string infoClass)
        {
            _name = name;
            _url  = url;

            _type = type;

            _infoClass = infoClass;

            if (infoClass != null && infoClass != string.Empty)
            {
                try
                {
                    _info = (IUserReportInfo)AssemblyHelper.LoadObject(infoClass, typeof(IUserReportInfo));
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Trace.WriteLine(ex);
                }
            }
        }
Esempio n. 7
0
        private void SaveTree()
        {
            foreach (UserReportTypeTreeNode typeNode in customReportTreeView.Nodes)
            {
                int            typeId = typeNode.ReportType.UserReportTypeID;
                UserReportType reportType;
                m_userReportDictionary.TryGetValue(typeId, out reportType);
                if (reportType == null)
                {
                    reportType = new UserReportType(m_tmpTypeId, typeNode.ReportType.UserReportTypeName);
                    m_userReportDictionary.Add(m_tmpTypeId, reportType);
                    m_tmpTypeId--;
                }

                foreach (UserReportGroupTreeNode groupNode in typeNode.Nodes)
                {
                    int             groupId = groupNode.ReportGroup.UserGroupID;
                    UserReportGroup group;
                    reportType.UserReportGroups.TryGetValue(groupId, out group);
                    if (group == null)
                    {
                        group = new UserReportGroup(m_tmpGroupId, groupNode.ReportGroup.UserGroupName);
                        reportType.UserReportGroups.Add(m_tmpGroupId, group);
                        m_tmpGroupId--;
                    }

                    foreach (ReportSetTreeNode setNode in groupNode.Nodes)
                    {
                        foreach (ReportTreeNode reportNode in setNode.Nodes)
                        {
                            if (reportNode.IsNewNode)
                            {
                                group.ReportsArray.Add(reportNode.ReportInfo);
                            }
                        }
                    }
                }
            }
        }
Esempio n. 8
0
 public UserReportTypeTreeNode(UserReportType type, bool isNew)
     : base(type.UserReportTypeName)
 {
     IsNewNode  = isNew;
     ReportType = type;
 }
Esempio n. 9
0
 public UserReportTypeTreeNode(string text, bool isNew)
     : base(text)
 {
     IsNewNode  = isNew;
     ReportType = new UserReportType(0, text);
 }
Esempio n. 10
0
 public UserReport(User reportedUser, UserReportType reportType, User user, string hostname, string notes)
     : base(user, hostname, notes)
 {
     ReportedUser = reportedUser;
     ReportType   = reportType;
 }
Esempio n. 11
0
 /// <summary>
 /// Adds the specified name.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="url">The URL.</param>
 /// <param name="isPersonal">if set to <c>true</c> [is personal].</param>
 /// <param name="infoType">Type of the info.</param>
 /// <returns></returns>
 public int Add(string name, string url, UserReportType type, string infoType)
 {
     return this.Add(new UserReportInfo(name, url, type, infoType));
 }
Esempio n. 12
0
 /// <summary>
 /// Adds the specified name.
 /// </summary>
 /// <param name="name">The name.</param>
 /// <param name="url">The URL.</param>
 /// <param name="isPersonal">if set to <c>true</c> [is personal].</param>
 /// <param name="infoType">Type of the info.</param>
 /// <returns></returns>
 public int Add(string name, string url, UserReportType type, string infoType)
 {
     return(this.Add(new UserReportInfo(name, url, type, infoType)));
 }