예제 #1
0
        /// <summary>
        /// 儲存測試結果資訊
        /// </summary>
        /// <param name="Serial"></param>
        /// <param name="Machine"></param>
        /// <param name="User"></param>
        /// <param name="PN"></param>
        /// <param name="Result"></param>
        /// <param name="TestTime"></param>
        /// <returns></returns>
        internal DaoErrMsg SaveTestResult(string Serial, DaoMachine Machine, DaoUser User, DaoPartNumber PN, string Result, DateTime TestTime)
        {
            string ResultSerial = string.Format("{0}{1}{2}", Machine.機台代碼, PN.簡碼, Serial);

            string strSchema = string.Format(@"INSERT INTO 測試結果(流水號, 件號, 車型名稱, 生產日期, 生產時間, 測試結果, 作業員代碼)
                                                            VALUES('{0}','{1}','{2}','{3}','{3}','{4}','{5}');",
                                             ResultSerial,
                                             PN.件號,
                                             PN.車型,
                                             TestTime.ToString("yyyy-MM-dd HH:mm:ss"),
                                             Result,
                                             User.代碼);

            return(m_SQL.ExecuteNonQuery(strSchema));
        }
예제 #2
0
        /// <summary>
        /// 刪除使用者
        /// </summary>
        /// <param name="User"></param>
        /// <returns></returns>
        internal DaoErrMsg DeleteUser(DaoUser User)
        {
            string strSchema = string.Empty;
            string strOut    = "";

            //先取得作業員剩餘數量,數量剩餘1就不可刪除;//
            strSchema = "select count(*) from 作業員;";
            m_SQL.ExecuteScalar(strSchema, out strOut);
            if (strOut.ToInt() <= 1)
            {
                return(new DaoErrMsg(true, "最少需保留一組作業員資訊."));
            }

            strSchema = string.Format("DELETE FROM 作業員 WHERE 代碼 = '{0}' ", User.代碼);

            return(m_SQL.ExecuteNonQuery(strSchema));
        }