示例#1
0
        /// <summary>
        /// ¸Þ½ÃÁö â¿¡ ³»¿ëÀ» º¸¿© ÁØ´Ù.
        /// </summary>
        /// <param name="msgType">¿¡·¯ ¿©ºÎ</param>
        /// <param name="strMessage"></param>
        /// <param name="isLog"></param>
        protected virtual void SetLastMessage(enMsgType msgType, string strMessage, bool isLog)
        {
            if (stBar.InvokeRequired)
            {
                stBar.Invoke(new delSetMessage(SetLastMessage), new object[] { msgType, strMessage, isLog });
                return;
            }


            if (msgType != enMsgType.Error && strMessage.Equals(string.Empty))
            {
                tsLabel.Image = null;
                tsLabel.Text  = string.Empty;
                return;
            }

            SetMessageIcon(msgType);

            tsLabel.Text     = LastMessage = strMessage;
            LastMessageError = msgType == enMsgType.Error;

            //if (clsLog != null && isLog)
            //	clsLog.WLog(strMessage);

            if (_onMessageChanged != null)
            {
                _onMessageChanged(LastMessageError, strMessage);
            }
        }
示例#2
0
        /// <summary>
        /// ¸Þ½ÃÁö â¿¡ ³»¿ëÀ» º¸¿© ÁØ´Ù.(¸Þ½ÃÁö ŸÀÔ »ç¿ë)
        /// </summary>
        /// <param name="msgType"></param>
        /// <param name="strMessage"></param>
        /// <param name="isLog"></param>
        protected virtual void SetMessage(enMsgType msgType, string strMessage, bool isLog)
        {
            if (stBar.InvokeRequired)
            {
                stBar.Invoke(new delSetMessage(SetMessage), new object[] { msgType, strMessage, isLog });
                return;
            }



            if (msgType != enMsgType.Error && strMessage.Equals(string.Empty))
            {
                tsLabel.Image = null;
                tsLabel.Text  = string.Empty;
                return;
            }

            //¾ÆÀÌÄÜ ¼³Á¤
            SetMessageIcon(msgType);


            tsLabel.Text     = LastMessage = string.Format("[{0}] {1}", Fnc.Date2String(DateTime.Now, Fnc.enDateType.Time), strMessage);
            LastMessageError = msgType == enMsgType.Error;

            if (clsLog != null && isLog)
            {
                clsLog.WLog(strMessage);
            }

            if (_onMessageChanged != null)
            {
                _onMessageChanged(LastMessageError, strMessage);
            }
        }
示例#3
0
        //-------------------------------------
        // Add a row to the in-memory Table
        //-------------------------------------

        public void WriteExcelrow(string iResult, enMsgType iMsgTyp, string iFilePrefix,
                                  string ipharmacyName, string iFileName, DateTime iLastWriteTime, string iDetails, ref DataTable iTbl)
        {
            if (iTbl == null)
            {
                iTbl = new DataTable(iFilePrefix + "_Results");
                iTbl.Columns.Add("Pharmacy Name", Type.GetType("System.String"));
                iTbl.Columns.Add("File Name", Type.GetType("System.String"));
                iTbl.Columns.Add("File Creation Date", Type.GetType("System.DateTime"));
                iTbl.Columns.Add("Download Result", Type.GetType("System.String"));
                iTbl.Columns.Add("Details", Type.GetType("System.String"));
            }
            try
            {
                iTbl.Rows.Add(new object[] { ipharmacyName, iFileName, iLastWriteTime, iResult, iDetails });
                //List<Test> list1 = new List<Test>();
                //list1.Add(new Test() { A = 3, B = "Pharmacy X" });
                //list1.Add(new Test() { A = 4, B = "Pharmacy Z" });

                //iTbl.Rows.Add(new object[] { ,  new DateTime(2017, 3, 19) });
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }
示例#4
0
        /// <summary>
        /// ¸Þ½ÃÁö â¿¡ ¾ÆÀÌÄÜÀ» Ç¥½Ã ÇÕ´Ï´Ù.
        /// </summary>
        /// <param name="msgType"></param>
        protected void SetMessageIcon(enMsgType msgType)
        {
            switch (msgType)
            {
            case enMsgType.Error:
                tsLabel.Image = ((System.Drawing.Image)(Function.resIcon16.stop));                                      //Function.Properties.Resources.stop));
                break;

            case enMsgType.OK:
                tsLabel.Image = ((System.Drawing.Image)(Function.resIcon16.button_green));                              //(Function.Properties.Resources.button_green));
                break;

            default:
                tsLabel.Image = ((System.Drawing.Image)(Function.resIcon16.button_withe));                              //(Function.Properties.Resources.button_green));
                break;
            }
        }
        public void WriteLog(string iMsg, enMsgType iMsgTyp, string iLogFilePrefix, string iPath)
        {
            string LogPathAndFileName = iPath;
            string myMsg = iMsg;

            try
            {
                if (LogPathAndFileName.LastIndexOf("\\") != LogPathAndFileName.Length - 1)// 'Make sure there is a \ at the end of the path
                {
                    LogPathAndFileName = LogPathAndFileName + "\\";
                }
                LogPathAndFileName = LogPathAndFileName + iLogFilePrefix + "_" + DateTime.Now.Year.ToString("0000") + DateTime.Now.Month.ToString("00") + DateTime.Now.Day.ToString("00") + ".log";

                switch (iMsgTyp)
                {
                case enMsgType.enMsgType_Info:
                    LogMsg("INFO" + iLogFilePrefix, myMsg, LogPathAndFileName);
                    break;

                case enMsgType.enMsgType_Ok:
                    LogMsg("OK", myMsg, LogPathAndFileName);
                    break;

                case enMsgType.enMsgType_Warn:
                    LogMsg("WARN", myMsg, LogPathAndFileName);

                    break;

                case enMsgType.enMsgType_Error:
                    myMsg = "An error occurred in the processing. \n" + iMsg;
                    LogMsg("ERROR", myMsg, LogPathAndFileName);

                    break;

                default:
                    LogMsg("UNKNOWN!", myMsg, LogPathAndFileName);
                    break;
                }
            }
            catch (Exception Ex)
            {
                throw Ex;
            }
        }