Пример #1
0
        /// <summary>
        /// 输出运行信息
        /// </summary>
        /// <param name="richTextBox"></param>
        /// <param name="text"></param>
        /// <param name="outputType"></param>
        private void OutputRunInfo(RichTextBox richTextBox, string text, eOutputType outputType = eOutputType.Normal)
        {
            this.InvokeEx(() =>
            {
                if (richTextBox.TextLength > 100000)
                {
                    richTextBox.Clear();
                }

                text = string.Format(" # {0} - {1}", DateTime.Now.ToString("HH:mm:ss"), text);

                richTextBox.SelectionStart = richTextBox.TextLength;

                switch (outputType)
                {
                case eOutputType.Normal:
                    richTextBox.SelectionColor = Color.Black;
                    break;

                case eOutputType.Error:
                    richTextBox.SelectionColor = ColorTranslator.FromHtml("#DB2606");
                    break;

                default:
                    richTextBox.SelectionColor = Color.White;
                    break;
                }

                richTextBox.AppendText(string.Format("{0}\r", text));

                richTextBox.ScrollToCaret();
            });
        }
Пример #2
0
 /// <summary>
 /// 信息输出
 /// </summary>
 /// <param name="messageStr"></param>
 public void ShowInfomation(string messageStr, eOutputType outputType = eOutputType.Normal)
 {
     InvokeEx(() =>
     {
         rTxtOutputer.Output(messageStr);
     });
 }
Пример #3
0
        public void LoadDefault()
        {
            //先讀取Default的數值;//
            nudLenEmployeeID.Value = Properties.Settings.Default.EmployeeIDLen;
            nudLenCardID.Value     = Properties.Settings.Default.CardNoLen;

            DataTable dt = DaoSQL.Instance.GetOutFileSetting();

            eOutputType type = (eOutputType)dt.Rows[0]["Type"].ToInt();

            if (type == eOutputType.eEmployeeID)
            {
                rbEmployeeID.Checked   = true;
                nudLenEmployeeID.Value = dt.Rows[0]["Length"].ToInt();
            }
            else
            {
                rbCardID.Checked   = true;
                nudLenCardID.Value = dt.Rows[0]["Length"].ToInt();
            }

            this.LoadContext(dt.Rows[1], nudLenStr1, tbStr1);
            this.LoadContext(dt.Rows[2], nudLenStr2, tbStr2);
            this.LoadContext(dt.Rows[3], nudLenStr3, tbStr3);
            this.LoadContext(dt.Rows[4], nudLenStr4, tbStr4);
            this.LoadContext(dt.Rows[5], nudLenStr5, tbStr5);
            this.LoadContext(dt.Rows[6], nudLenStr6, tbStr6);
        }
Пример #4
0
 /// <summary>
 /// 输出信息
 /// </summary>
 /// <param name="describe"></param>
 /// <param name="ex"></param>
 void OutputInfoMethod(string describe, eOutputType outputType)
 {
     if (OutputInfo != null)
     {
         OutputInfo(describe, outputType);
     }
 }
Пример #5
0
        public static string GetFileExtension(this eOutputType type)
        {
            switch (type)
            {
            case eOutputType.pngalpha:
            case eOutputType.png16m:
            case eOutputType.png256:
            case eOutputType.png16:
            case eOutputType.pnggray:
            case eOutputType.pngmono:
                return(".png");

            case eOutputType.jpeg:
            case eOutputType.jpeggray:
                return(".jpg");

            case eOutputType.bmp32b:
            case eOutputType.bmp16m:
            case eOutputType.bmp256:
            case eOutputType.bmp16:
            case eOutputType.bmpsep8:
            case eOutputType.bmpgray:
            case eOutputType.bmpmono:
                return(".bmp");

            default:
                throw new NotSupportedException("Not supported output type");
            }
        }
        public ClassBuilder(string nameSpace, eOutputType outputtype)
        {
            outputAs = outputtype;
            JsonSchema4 js = new JsonSchema4();

            csgs           = new CSharpGeneratorSettings();
            csgs.Namespace = nameSpace;
            resolver       = new CSharpTypeResolver(csgs);
            CSharpGenerator generator = new CSharpGenerator(js, csgs, resolver);

            schemaTextList = new List <RedoxJsonSchema>();
            AllObjects.Clear();
            ObjectTypeDict.Clear();
            ComplexObjectDict.Clear();
            ComplexObjectLists.Clear();
            defs = new JObject();
        }
Пример #7
0
        /// <summary>
        /// 输出运行信息
        /// </summary>
        /// <param name="text"></param>
        /// <param name="type"></param>
        public void Output(string text, eOutputType outputType = eOutputType.Normal)
        {
            lock (lockObject)
            {
                try
                {
                    rTxtOutputer.Invoke((Action)(() =>
                    {
                        if (rTxtOutputer.TextLength > 5000)
                        {
                            rTxtOutputer.Clear();
                        }

                        text = string.Format(" # {0} - {1}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"), text);

                        rTxtOutputer.SelectionStart = rTxtOutputer.TextLength;

                        if (outputType == eOutputType.Normal)
                        {
                            rTxtOutputer.SelectionColor = ColorTranslator.FromHtml("#bbe16c");
                        }
                        else if (outputType == eOutputType.Important)
                        {
                            rTxtOutputer.SelectionColor = ColorTranslator.FromHtml("#ff91c5");
                        }
                        else if (outputType == eOutputType.Warn)
                        {
                            rTxtOutputer.SelectionColor = ColorTranslator.FromHtml("#ec7967");
                        }
                        else if (outputType == eOutputType.Error)
                        {
                            rTxtOutputer.SelectionColor = ColorTranslator.FromHtml("#f11030");
                        }
                        else if (outputType == eOutputType.Success)
                        {
                            rTxtOutputer.SelectionColor = ColorTranslator.FromHtml("#11e347");
                        }

                        rTxtOutputer.AppendText(string.Format("{0}\r", text));

                        rTxtOutputer.ScrollToCaret();
                    }));
                }
                catch { }
            }
        }
Пример #8
0
        /// <summary>
        /// 输出运行信息
        /// </summary>
        /// <param name="richTextBox"></param>
        /// <param name="text"></param>
        /// <param name="outputType"></param>
        private void OutputRunInfo(TextBox richTextBox, string text, eOutputType outputType = eOutputType.Normal)
        {
            this.Invoke((EventHandler)(delegate
            {
                if (richTextBox.TextLength > 100000)
                {
                    richTextBox.Clear();
                }

                text = string.Format("{0}  {1}", DateTime.Now.ToString("HH:mm:ss"), text);

                richTextBox.SelectionStart = richTextBox.TextLength;

                switch (outputType)
                {
                case eOutputType.Normal:
                    richTextBox.ForeColor = ColorTranslator.FromHtml("#BD86FA");
                    break;

                case eOutputType.Important:
                    richTextBox.ForeColor = ColorTranslator.FromHtml("#A50081");
                    break;

                case eOutputType.Warn:
                    richTextBox.ForeColor = ColorTranslator.FromHtml("#F9C916");
                    break;

                case eOutputType.Error:
                    richTextBox.ForeColor = ColorTranslator.FromHtml("#DB2606");
                    break;

                default:
                    richTextBox.ForeColor = Color.White;
                    break;
                }

                richTextBox.AppendText(string.Format("{0}\r", text));

                richTextBox.ScrollToCaret();
            }));
        }
Пример #9
0
 private void ShowMessage(string info, eOutputType outputType = eOutputType.Normal)
 {
     OutputRunInfo(rtxtMakeWeightInfo, info, outputType);
 }
Пример #10
0
 public Pdf2ImageConverter SelectOutputType(eOutputType outputType)
 {
     _outputType         = outputType;
     _outputTypeSelected = true;
     return(this);
 }
Пример #11
0
 private void ShowMessage(string info, eOutputType outputType)
 {
     OutputRunInfo(rtxtOutputInfo, info, outputType);
 }
Пример #12
0
        /// <summary>
        /// 輸出考勤資訊到文字檔
        /// </summary>
        /// <param name="attInfo"></param>
        private void ExportAttendanceToTxt(List <DaoAttendance> attInfo, bool isHistory = false)
        {
            string FileName = DaoConfigFile.Instance.DirAttExport + "/";

            if (isHistory == false)
            {
                FileName = FileName + DateTime.Now.ToString("yyyyMMddHHmm") + ".txt";
            }
            else
            {
                FileName = FileName + "History_" + DateTime.Now.ToString("yyyyMMddHHmm") + ".txt";
            }
            FileStream fs = new FileStream(FileName, FileMode.Append);

            StreamWriter sw = new StreamWriter(fs);

            //取得匯出檔案的格式;//
            DataTable   dt      = DaoSQL.Instance.GetOutFileSetting();
            eOutputType outType = (eOutputType)dt.Rows[0]["Type"].ToInt();
            int         outLen  = dt.Rows[0]["Length"].ToInt();

            List <OutputFormat> fmt = new List <OutputFormat>();

            for (int i = 1; i < 7; i++)
            {
                fmt.Add(new OutputFormat(eOutputType.eString, dt.Rows[i]["Length"].ToInt(), dt.Rows[i]["Contex"].ToString()));
            }

            StringBuilder sb = new StringBuilder();

            foreach (DaoAttendance att in attInfo)
            {
                try
                {
                    sb.Init();

                    string type = outType == eOutputType.eEmployeeID ? att.sUserID : att.CardNum;
                    if (outLen <= type.Length)
                    {
                        type = type.Substring(type.Length - outLen, outLen);
                    }
                    else
                    {
                        type = type.PadLeft(outLen, '0');
                    }

                    sb.AppendFormat("{0}{1}{2}{3}{4}{5}{6}{7}{8}{9}{10}{11}{12}\r\n",
                                                                               //outType == eOutputType.eEmployeeID ? att.sUserID.PadLeft(outLen, '0') : att.CardNum.PadLeft(outLen, '0'),
                                    type,
                                    fmt[0].contex.PadLeft(fmt[0].length, ' '), //1:str1
                                    att.RecordTime.ToString("yyyy"),           //2:year
                                    fmt[1].contex.PadLeft(fmt[1].length, ' '), //3:str2
                                    att.RecordTime.ToString("MM"),             //4:mounth
                                    fmt[2].contex.PadLeft(fmt[2].length, ' '), //5:str3
                                    att.RecordTime.ToString("dd"),             //6:day
                                    fmt[3].contex.PadLeft(fmt[3].length, ' '), //7:str4
                                    att.RecordTime.ToString("HH"),             //8:hour
                                    fmt[4].contex.PadLeft(fmt[4].length, ' '), //9:str5
                                    att.RecordTime.ToString("mm"),             //10:minute
                                    fmt[5].contex.PadLeft(fmt[5].length, ' '), //11:str6
                                    att.Location                               //12:location
                                    );
                    sw.Write(sb);
                }
                catch (Exception ex)
                {
                    Logger.Debug(ex.Message);
                    Logger.Debug(string.Format("fmt Count:{0}", fmt));
                    Logger.Debug(string.Format("outType:{0}", outType.ToString()));
                    Logger.Debug(string.Format("UserID:{0}", att.sUserID));
                    Logger.Debug(string.Format("CardNum:{0}", att.CardNum));
                    Logger.Debug(string.Format("fmt[0]:{0}", fmt[0].contex));
                    Logger.Debug(string.Format("fmt[1]:{0}", fmt[1].contex));
                    Logger.Debug(string.Format("fmt[2]:{0}", fmt[2].contex));
                    Logger.Debug(string.Format("fmt[3]:{0}", fmt[3].contex));
                    Logger.Debug(string.Format("fmt[4]:{0}", fmt[4].contex));
                    Logger.Debug(string.Format("fmt[5]:{0}", fmt[5].contex));
                }
            }

            //清空緩衝區
            sw.Flush();
            //關閉流
            sw.Close();
            fs.Close();
        }
Пример #13
0
 public OutputFormat(eOutputType type, int length, string contex)
 {
     this.type   = type;
     this.length = length;
     this.contex = contex;
 }
Пример #14
0
        void tableSynchDAO_OutputInfo(string info, eOutputType outputType)
        {
            OutputRunInfo(rtxtOutput, info, outputType);

            Log4netUtil.Info(info);
        }