示例#1
0
        //сохраняет лог
        public void SaveLog(ref ScanLog slog)
        {
            string insertCommandText = @" INSERT INTO ScanLog(ArtCode, id_gamma, Dt, Qty, Barcode, ActionType) 
VALUES(@artcode, @id_gamma, @Dt, @Qty, @Barcode, @ActionType) ";

            using (SQLiteConnection connect = GetConnect())
            {
                connect.Open();
                SQLiteTransaction tx      = connect.BeginTransaction();
                SQLiteCommand     command = connect.CreateCommand();
                command.CommandText = insertCommandText;
                command.Parameters.Add("artcode", DbType.Int32).Value    = slog.ArtCode;
                command.Parameters.Add("id_gamma", DbType.Int32).Value   = GlobalArea.CurrentEmployee.GammaID;
                command.Parameters.Add("Dt", DbType.String).Value        = GlobalArea.CurrentDateSQLStr;
                command.Parameters.Add("Qty", DbType.Int32).Value        = slog.Qty;
                command.Parameters.Add("Barcode", DbType.String).Value   = slog.Barcode;
                command.Parameters.Add("ActionType", DbType.Int32).Value = (int)slog.ActType;
                command.Transaction = tx;
                try
                {
                    int rowsAffected = command.ExecuteNonQuery();
                    tx.Commit();
                    GlobalArea.Logger.Info("Commit inserting into ScanLog table.");
                }
                catch (Exception e)
                {
                    GlobalArea.Logger.Error("[Exception][Rollback inserting into ScanLog table.] " + e.ToString());
                    MessageBox.Show(e.Message);
                    tx.Rollback();
                }
            }
        }
示例#2
0
        //сохраняет лог
        public void SaveLog(ref ScanLog slog)
        {
            string insertCommandText = @" INSERT INTO ScanLog(ArtCode, id_gamma, Dt, Qty, Barcode, ActionType) 
VALUES(@artcode, @id_gamma, @Dt, @Qty, @Barcode, @ActionType) ";

            using (SqlCeConnection connect = new SqlCeConnection(Datasource))
            {
                connect.Open();
                SqlCeTransaction tx      = connect.BeginTransaction();
                SqlCeCommand     command = connect.CreateCommand();
                command.CommandText = insertCommandText;
                command.Parameters.Add("artcode", SqlDbType.Int).Value      = slog.ArtCode;
                command.Parameters.Add("id_gamma", SqlDbType.Int).Value     = GlobalArea.CurrentEmployee.GammaID;
                command.Parameters.Add("Dt", SqlDbType.NVarChar).Value      = GlobalArea.CurrentDateSQLStr;
                command.Parameters.Add("Qty", SqlDbType.Int).Value          = slog.Qty;
                command.Parameters.Add("Barcode", SqlDbType.NVarChar).Value = slog.Barcode;
                command.Parameters.Add("ActionType", SqlDbType.Int).Value   = (int)slog.ActType;
                command.Transaction = tx;
                try
                {
                    int rowsAffected = command.ExecuteNonQuery();
                    tx.Commit();
                }
                catch (Exception e)
                {
                    MessageBox.Show(e.Message);
                    tx.Rollback();
                }
            }
        }
示例#3
0
 public void SaveLog(ref ScanLog slog)
 {
     throw new NotImplementedException();
 }