Beispiel #1
0
        private void WriteTextFormat(Database db, KQTextFormatInfo textFormat, TAttLog attLog, int MacSN)
        {
            if (attLog.CardTime == null || attLog.CardTime.ToOADate() == 0)
            {
                return;
            }
            DataTableReader dr      = null;
            string          EmpNo   = "";
            string          EmpName = "";
            bool            IsError = false;

            try
            {
                dr = db.GetDataReader(Pub.GetSQL(DBCode.DB_002001, new string[] { "106", SystemInfo.CardType.ToString(),
                                                                                  attLog.CardID }));
                if (dr.Read())
                {
                    EmpNo   = dr["EmpNo"].ToString();
                    EmpName = dr["EmpName"].ToString();
                }
            }
            catch (Exception E)
            {
                IsError = true;
                Pub.ShowErrorMsg(E);
            }
            finally
            {
                if (dr != null)
                {
                    dr.Close();
                }
                dr = null;
            }
            if (IsError)
            {
                return;
            }
            DateTime t        = Convert.ToDateTime(attLog.CardTime);
            string   fileName = SystemInfo.DataFilePath + "KQ" + t.ToString(SystemInfo.DateFormatLog) + "_Format.txt";
            string   msg      = textFormat.GetKQFormatText(MacSN, EmpNo, EmpName, attLog.CardID, t);

            Pub.WriteTextFile(fileName, msg);
        }
 private void btnShowFormat_Click(object sender, EventArgs e)
 {
     textFormat     = new KQTextFormatInfo(GetFieldsString());
     txtFormat.Text = textFormat.GetKQFormatText(1, "E0001", "ZhangSan", "1", DateTime.Now);
 }