コード例 #1
0
        public int AddMessage(string Message, Enums.enMsgType MessageType, System.DateTime MessageDate, String MessageSource, String MessageMethod, String StackTrace, String LinkedControlName, Type LinkedControlType)
        {
            RTNMessage MSG = new RTNMessage(Message, MessageType, MessageDate, MessageSource, MessageMethod, StackTrace);

            MsgArray.Add(MSG);
            return(MsgArray.Count);
        }
コード例 #2
0
        public static void LogEvent(string message, Enums.enMsgType messageType, string source)
        {
            try
            {
                EventLogEntryType type = EventLogEntryType.Error;
                switch (messageType)
                {
                case Enums.enMsgType.OK:
                    type = EventLogEntryType.Information;
                    break;

                case Enums.enMsgType.Warn:
                    type = EventLogEntryType.Warning;
                    break;

                case Enums.enMsgType.Err:
                    type = EventLogEntryType.Error;
                    break;
                }
                EventLog.WriteEntry(source, message, type);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
コード例 #3
0
        public int AddMessage(String Message, Enums.enMsgType MessageType, System.DateTime MessageDate, String MessageSource, String MessageMethod)
        {
            RTNMessage MSG = new RTNMessage(Message, MessageType, MessageDate, MessageSource, MessageMethod);

            MsgArray.Add(MSG);
            return(MsgArray.Count);
        }
コード例 #4
0
        private void MarkControl(string controlName, Type controlType, Enums.enMsgType messageType)
        {
            switch (controlType.Name)
            {
            case "TextBox":
                TextBox txt;
                txt = ((TextBox)this.Page.Master.FindControlRecursive("txt" + controlName));
                if (txt == null)
                {
                    txt = ((TextBox)this.Page.Master.FindControlRecursive(controlName));
                }
                if (messageType == Enums.enMsgType.Err)
                {
                    txt.CssClass = "validation-err";
                }
                else     // warning
                {
                    txt.CssClass = "validation-warn";
                }
                break;

            case "DropDownList":
                DropDownList ddl;
                ddl = ((DropDownList)this.Page.Master.FindControlRecursive("ddl" + controlName));
                if (ddl == null)
                {
                    ddl = ((DropDownList)this.Page.Master.FindControlRecursive(controlName));
                }
                if (messageType == Enums.enMsgType.Err)
                {
                    ddl.CssClass = "validation-err";
                }
                else     // warning
                {
                    ddl.CssClass = "validation-warn";
                }
                break;

            case "RadioButtonList":
                RadioButtonList rbl;
                rbl = ((RadioButtonList)this.Page.Master.FindControlRecursive("rbl" + controlName));
                if (rbl == null)
                {
                    rbl = ((RadioButtonList)this.Page.Master.FindControlRecursive(controlName));
                }
                if (messageType == Enums.enMsgType.Err)
                {
                    rbl.CssClass = "validation-err";
                }
                else     // warning
                {
                    rbl.CssClass = "validation-warn";
                }
                break;

            default:
                // do nothing
                break;
            }
        }
コード例 #5
0
 public RTNMessage(string Message, Enums.enMsgType MessageType, System.DateTime MessageDate, string MessageSource, string MessageSourceMethod, string StackTrace)
 {
     this.Message             = Message;
     this.MessageType         = MessageType;
     this.MessageDate         = MessageDate;
     this.MessageSource       = MessageSource;
     this.MessageSourceMethod = MessageSourceMethod;
     this.StackTrace          = StackTrace;
     this.LinkedControlName   = "";
     this.LinkedControlType   = null;
 }
コード例 #6
0
        public RTNMessage(string Message, Enums.enMsgType MessageType, System.DateTime MessageDate)
        {
            this.Message     = Message;
            this.MessageType = MessageType;
            this.MessageDate = MessageDate;
            this.GetSource();
            this.StackTrace        = "";
            this.LinkedControlName = "";

            if (this.MessageType == Enums.enMsgType.Err)
            {
                this.StackTrace = new StackTrace(false).ToString().Trim().Replace(System.Environment.NewLine + System.Environment.NewLine, "").Replace("\t", "");
            }
        }
コード例 #7
0
        public void ProcessMessage(string message, Enums.enMsgType messageType, string[] controlNames, Type controlType, bool clearPrevious)
        {
            if (clearPrevious == true)
            {
                this.Controls.Clear();
            }

            System.Web.UI.WebControls.Image img = new System.Web.UI.WebControls.Image();
            Label lbl             = new Label();
            HtmlGenericControl br = new HtmlGenericControl("BR");

            img.ImageAlign = ImageAlign.TextTop;
            lbl.Text       = " " + message;
            switch (messageType)
            {
            case Enums.enMsgType.OK:
                img.ImageUrl  = "~/images/info16x16.png";
                lbl.ForeColor = Color.Green;
                break;

            case Enums.enMsgType.Warn:
                img.ImageUrl  = "~/images/warning16x16.png";
                lbl.ForeColor = Color.FromArgb(206, 113, 9);
                break;

            case Enums.enMsgType.Err:
                img.ImageUrl  = "~/images/error16x16.png";
                lbl.ForeColor = Color.Red;
                break;
            }
            this.Controls.Add(img);
            this.Controls.Add(lbl);
            this.Controls.Add(br);

            foreach (string controlName in controlNames)
            {
                if (controlName != "")
                {
                    MarkControl(controlName, controlType, messageType);
                }
            }
        }
コード例 #8
0
 public void ProcessMessage(string message, Enums.enMsgType messageType, string controlName, Type controlType, bool clearPrevious)
 {
     string[] controlNames = new string[1];
     controlNames[0] = controlName;
     ProcessMessage(message, messageType, controlNames, controlType, clearPrevious);
 }